aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 12:19:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 12:19:43 -0400
commitbf25db365428dbd182768baa9850bef7afaac80d (patch)
tree4373037b00459643f0d661672eb6688f80800d72 /fs/exofs/file.c
parent682c30ed2165d5694a414d31eac7c63ac5700fb0 (diff)
parent5002dd18c5940ce63b917d84f2b852c3b96009bb (diff)
Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
* 'for-linus' of git://git.open-osd.org/linux-open-osd: exofs: Fix groups code when num_devices is not divisible by group_width exofs: Remove useless optimization exofs: exofs_file_fsync and exofs_file_flush correctness exofs: Remove superfluous dependency on buffer_head and writeback
Diffstat (limited to 'fs/exofs/file.c')
-rw-r--r--fs/exofs/file.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/exofs/file.c b/fs/exofs/file.c
index f9bfe2b501d5..68cb23e3bb98 100644
--- a/fs/exofs/file.c
+++ b/fs/exofs/file.c
@@ -30,9 +30,6 @@
30 * along with exofs; if not, write to the Free Software 30 * along with exofs; if not, write to the Free Software
31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 */ 32 */
33
34#include <linux/buffer_head.h>
35
36#include "exofs.h" 33#include "exofs.h"
37 34
38static int exofs_release_file(struct inode *inode, struct file *filp) 35static int exofs_release_file(struct inode *inode, struct file *filp)
@@ -40,19 +37,27 @@ static int exofs_release_file(struct inode *inode, struct file *filp)
40 return 0; 37 return 0;
41} 38}
42 39
40/* exofs_file_fsync - flush the inode to disk
41 *
42 * Note, in exofs all metadata is written as part of inode, regardless.
43 * The writeout is synchronous
44 */
43static int exofs_file_fsync(struct file *filp, int datasync) 45static int exofs_file_fsync(struct file *filp, int datasync)
44{ 46{
45 int ret; 47 int ret;
46 struct address_space *mapping = filp->f_mapping; 48 struct inode *inode = filp->f_mapping->host;
47 struct inode *inode = mapping->host; 49 struct writeback_control wbc = {
50 .sync_mode = WB_SYNC_ALL,
51 .nr_to_write = 0, /* metadata-only; caller takes care of data */
52 };
48 struct super_block *sb; 53 struct super_block *sb;
49 54
50 ret = filemap_write_and_wait(mapping); 55 if (!(inode->i_state & I_DIRTY))
51 if (ret) 56 return 0;
52 return ret; 57 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
58 return 0;
53 59
54 /* sync the inode attributes */ 60 ret = sync_inode(inode, &wbc);
55 ret = write_inode_now(inode, 1);
56 61
57 /* This is a good place to write the sb */ 62 /* This is a good place to write the sb */
58 /* TODO: Sechedule an sb-sync on create */ 63 /* TODO: Sechedule an sb-sync on create */
@@ -65,9 +70,9 @@ static int exofs_file_fsync(struct file *filp, int datasync)
65 70
66static int exofs_flush(struct file *file, fl_owner_t id) 71static int exofs_flush(struct file *file, fl_owner_t id)
67{ 72{
68 exofs_file_fsync(file, 1); 73 int ret = vfs_fsync(file, 0);
69 /* TODO: Flush the OSD target */ 74 /* TODO: Flush the OSD target */
70 return 0; 75 return ret;
71} 76}
72 77
73const struct file_operations exofs_file_operations = { 78const struct file_operations exofs_file_operations = {