aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-04-27 10:43:51 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-06-11 21:36:03 -0400
commit5cee5815d1564bbbd505fea86f4550f1efdb5cd0 (patch)
treeba99c38932dc534bf56f0d7dcfeeca153f50b007 /fs/block_dev.c
parent429479f031322a0cc5c921ffb2321a51718dc875 (diff)
vfs: Make sys_sync() use fsync_super() (version 4)
It is unnecessarily fragile to have two places (fsync_super() and do_sync()) doing data integrity sync of the filesystem. Alter __fsync_super() to accommodate needs of both callers and use it. So after this patch __fsync_super() is the only place where we gather all the calls needed to properly send all data on a filesystem to disk. Nice bonus is that we get a complete livelock avoidance and write_supers() is now only used for periodic writeback of superblocks. sync_blockdevs() introduced a couple of patches ago is gone now. [build fixes folded] Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index fe47f7227618..4b6a3b9d01ef 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -176,17 +176,22 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
176 iov, offset, nr_segs, blkdev_get_blocks, NULL); 176 iov, offset, nr_segs, blkdev_get_blocks, NULL);
177} 177}
178 178
179int __sync_blockdev(struct block_device *bdev, int wait)
180{
181 if (!bdev)
182 return 0;
183 if (!wait)
184 return filemap_flush(bdev->bd_inode->i_mapping);
185 return filemap_write_and_wait(bdev->bd_inode->i_mapping);
186}
187
179/* 188/*
180 * Write out and wait upon all the dirty data associated with a block 189 * Write out and wait upon all the dirty data associated with a block
181 * device via its mapping. Does not take the superblock lock. 190 * device via its mapping. Does not take the superblock lock.
182 */ 191 */
183int sync_blockdev(struct block_device *bdev) 192int sync_blockdev(struct block_device *bdev)
184{ 193{
185 int ret = 0; 194 return __sync_blockdev(bdev, 1);
186
187 if (bdev)
188 ret = filemap_write_and_wait(bdev->bd_inode->i_mapping);
189 return ret;
190} 195}
191EXPORT_SYMBOL(sync_blockdev); 196EXPORT_SYMBOL(sync_blockdev);
192 197