summary refs log tree commit diff
path: root/fs/fat/file.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-08-17 17:00:02 +0200
committerJan Kara <jack@suse.cz>2009-09-14 17:08:17 +0200
commit2f3d675bcd4a84251d6e8eea8096ec8fc795e5d6 (patch)
tree3b186e4960d4553fac577be5f1def6d17196beca /fs/fat/file.c
parentaa3caafe53cab7ef60605e481cd5d7943e1c3022 (diff)
downloadlinux-2f3d675bcd4a84251d6e8eea8096ec8fc795e5d6.tar.gz
fat: Opencode sync_page_range_nolock()
fat_cont_expand() is the only user of sync_page_range_nolock(). It's also the
only user of generic_osync_inode() which does not have a file open.  So
opencode needed actions for FAT so that we can convert generic_osync_inode() to
a standard syncing path.

Update a comment about generic_osync_inode().

CC: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r--fs/fat/file.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/fs/fat/file.c b/fs/fat/file.c
index f042b965c95c..e8c159de236b 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -176,8 +176,26 @@ static int fat_cont_expand(struct inode *inode, loff_t size)
 
 	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
 	mark_inode_dirty(inode);
-	if (IS_SYNC(inode))
-		err = sync_page_range_nolock(inode, mapping, start, count);
+	if (IS_SYNC(inode)) {
+		int err2;
+
+		/*
+		 * Opencode syncing since we don't have a file open to use
+		 * standard fsync path.
+		 */
+		err = filemap_fdatawrite_range(mapping, start,
+					       start + count - 1);
+		err2 = sync_mapping_buffers(mapping);
+		if (!err)
+			err = err2;
+		err2 = write_inode_now(inode, 1);
+		if (!err)
+			err = err2;
+		if (!err) {
+			err =  filemap_fdatawait_range(mapping, start,
+						       start + count - 1);
+		}
+	}
 out:
 	return err;
 }