#endif
-const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.25 2009-03-05 01:47:17 charles Exp $";
+const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.26 2009-09-23 23:24:55 charles Exp $";
// configurationList is the list of devices that are supported
static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
return handle;
}
-int yaffs_flush(int fd)
+int yaffs_Dofsync(int fd,int datasync)
{
yaffsfs_Handle *h = NULL;
int retVal = 0;
if(h && h->inUse)
{
// flush the file
- yaffs_FlushFile(h->obj,1);
+ yaffs_FlushFile(h->obj,1,datasync);
}
else
{
return retVal;
}
+int yaffs_fsync(int fd)
+{
+ return yaffs_Dofsync(fd,0);
+}
+
+int yaffs_fdatasync(int fd)
+{
+ return yaffs_Dofsync(fd,1);
+}
int yaffs_close(int fd)
{
if(h && h->inUse)
{
// clean up
- yaffs_FlushFile(h->obj,1);
+ yaffs_FlushFile(h->obj,1,0);
h->obj->inUse--;
if(h->obj->inUse <= 0 && h->obj->unlinked)
{
}
obj->dirty = 1;
- result = yaffs_FlushFile(obj,0);
+ result = yaffs_FlushFile(obj,0,0);
retVal = 0;
}
else
{
obj->yst_mode = mode;
obj->dirty = 1;
- result = yaffs_FlushFile(obj,0);
+ result = yaffs_FlushFile(obj,0,0);
}
return result == YAFFS_OK ? 0 : -1;
int yaffs_open(const YCHAR *path, int oflag, int mode) ;
int yaffs_close(int fd) ;
-int yaffs_flush(int fd) ;
+int yaffs_fsync(int fd) ;
+int yaffs_fdatasync(int fd) ;
+int yaffs_flush(int fd) ; /* same as yaffs_fsync() */
int yaffs_access(const YCHAR *path, int amode);
*/
const char *yaffs_fs_c_version =
- "$Id: yaffs_fs.c,v 1.82 2009-09-18 00:39:21 charles Exp $";
+ "$Id: yaffs_fs.c,v 1.83 2009-09-23 23:24:55 charles Exp $";
extern const char *yaffs_guts_c_version;
#include <linux/version.h>
yaffs_GrossLock(dev);
- yaffs_FlushFile(obj, 1);
+ yaffs_FlushFile(obj, 1,0);
yaffs_GrossUnlock(dev);
T(YAFFS_TRACE_OS, ("yaffs_sync_object\n"));
yaffs_GrossLock(dev);
- yaffs_FlushFile(obj, 1);
+ yaffs_FlushFile(obj, 1, datasync);
yaffs_GrossUnlock(dev);
return 0;
}
}
+
+static void yaffs_flush_sb_inodes(struct super_block *sb)
+{
+ struct inode *iptr;
+ yaffs_Object *obj;
+
+ list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){
+ obj = yaffs_InodeToObject(iptr);
+ if(obj){
+ T(YAFFS_TRACE_OS, ("flushing obj %d\n",obj->objectId));
+ yaffs_FlushFile(obj,1,0);
+ }
+ }
+}
+
static int yaffs_do_sync_fs(struct super_block *sb)
{
if (dev) {
yaffs_FlushEntireDeviceCache(dev);
+ yaffs_flush_sb_inodes(sb);
yaffs_CheckpointSave(dev);
}
*/
const char *yaffs_guts_c_version =
- "$Id: yaffs_guts.c,v 1.89 2009-09-09 00:56:53 charles Exp $";
+ "$Id: yaffs_guts.c,v 1.90 2009-09-23 23:24:55 charles Exp $";
#include "yportenv.h"
-int yaffs_FlushFile(yaffs_Object *in, int updateTime)
+int yaffs_FlushFile(yaffs_Object *in, int updateTime, int dataSync)
{
int retVal;
if (in->dirty) {
yaffs_FlushFilesChunkCache(in);
- if (updateTime) {
+ if(dataSync) /* Only sync data */
+ retVal=YAFFS_OK;
+ else {
+ if (updateTime) {
#ifdef CONFIG_YAFFS_WINCE
- yfsd_WinFileTimeNow(in->win_mtime);
+ yfsd_WinFileTimeNow(in->win_mtime);
#else
- in->yst_mtime = Y_CURRENT_TIME;
+ in->yst_mtime = Y_CURRENT_TIME;
#endif
- }
+ }
- retVal = (yaffs_UpdateObjectHeader(in, NULL, 0, 0, 0) >=
- 0) ? YAFFS_OK : YAFFS_FAIL;
+ retVal = (yaffs_UpdateObjectHeader(in, NULL, 0, 0, 0) >=
+ 0) ? YAFFS_OK : YAFFS_FAIL;
+ }
} else {
retVal = YAFFS_OK;
}
yaffs_Object *yaffs_MknodFile(yaffs_Object *parent, const YCHAR *name,
__u32 mode, __u32 uid, __u32 gid);
-int yaffs_FlushFile(yaffs_Object *obj, int updateTime);
+
+int yaffs_FlushFile(yaffs_Object *obj, int updateTime, int dataSync);
/* Flushing and checkpointing */
void yaffs_FlushEntireDeviceCache(yaffs_Device *dev);