vfs: Make sys_sync() use fsync_super() (version 4)
[linux-2.6-block.git] / fs / block_dev.c
index fe47f72276186199b1a5715128d7880a494a9829..4b6a3b9d01effcbfa7f09a85950c1ccb1e53b99f 100644 (file)
@@ -176,17 +176,22 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
                                iov, offset, nr_segs, blkdev_get_blocks, NULL);
 }
 
+int __sync_blockdev(struct block_device *bdev, int wait)
+{
+       if (!bdev)
+               return 0;
+       if (!wait)
+               return filemap_flush(bdev->bd_inode->i_mapping);
+       return filemap_write_and_wait(bdev->bd_inode->i_mapping);
+}
+
 /*
  * Write out and wait upon all the dirty data associated with a block
  * device via its mapping.  Does not take the superblock lock.
  */
 int sync_blockdev(struct block_device *bdev)
 {
-       int ret = 0;
-
-       if (bdev)
-               ret = filemap_write_and_wait(bdev->bd_inode->i_mapping);
-       return ret;
+       return __sync_blockdev(bdev, 1);
 }
 EXPORT_SYMBOL(sync_blockdev);