public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/5]: ufs: fsync implementation
@ 2006-06-17 10:16 Evgeniy Dushistov
  0 siblings, 0 replies; only message in thread
From: Evgeniy Dushistov @ 2006-06-17 10:16 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-fsdevel

At now, ufs doesn't support "fsync",
this make some applications unhappy, for example vim.
This patch fixes this situation.

Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>

---

Index: linux-2.6.17-rc6-mm2/fs/ufs/file.c
===================================================================
--- linux-2.6.17-rc6-mm2.orig/fs/ufs/file.c
+++ linux-2.6.17-rc6-mm2/fs/ufs/file.c
@@ -25,6 +25,26 @@
 
 #include <linux/fs.h>
 #include <linux/ufs_fs.h>
+#include <linux/buffer_head.h>	/* for sync_mapping_buffers() */
+
+static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync)
+{
+	struct inode *inode = dentry->d_inode;
+	int err;
+	int ret;
+
+	ret = sync_mapping_buffers(inode->i_mapping);
+	if (!(inode->i_state & I_DIRTY))
+		return ret;
+	if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
+		return ret;
+
+	err = ufs_sync_inode(inode);
+	if (ret == 0)
+		ret = err;
+	return ret;
+}
+
 
 /*
  * We have mostly NULL's here: the current defaults are ok for
@@ -37,6 +57,7 @@ const struct file_operations ufs_file_op
 	.write		= generic_file_write,
 	.mmap		= generic_file_mmap,
 	.open           = generic_file_open,
+	.fsync		= ufs_sync_file,
 	.sendfile	= generic_file_sendfile,
 };
 

-- 
/Evgeniy


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-06-17 10:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-17 10:16 [PATCH 3/5]: ufs: fsync implementation Evgeniy Dushistov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox