diff options
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 931f6b8c4b2f..3a6d4fb2a329 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 | ||
179 | int __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 | */ |
183 | int sync_blockdev(struct block_device *bdev) | 192 | int 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 | } |
191 | EXPORT_SYMBOL(sync_blockdev); | 196 | EXPORT_SYMBOL(sync_blockdev); |
192 | 197 | ||
@@ -199,7 +204,7 @@ int fsync_bdev(struct block_device *bdev) | |||
199 | { | 204 | { |
200 | struct super_block *sb = get_super(bdev); | 205 | struct super_block *sb = get_super(bdev); |
201 | if (sb) { | 206 | if (sb) { |
202 | int res = fsync_super(sb); | 207 | int res = sync_filesystem(sb); |
203 | drop_super(sb); | 208 | drop_super(sb); |
204 | return res; | 209 | return res; |
205 | } | 210 | } |
@@ -241,7 +246,7 @@ struct super_block *freeze_bdev(struct block_device *bdev) | |||
241 | sb->s_frozen = SB_FREEZE_WRITE; | 246 | sb->s_frozen = SB_FREEZE_WRITE; |
242 | smp_wmb(); | 247 | smp_wmb(); |
243 | 248 | ||
244 | __fsync_super(sb); | 249 | sync_filesystem(sb); |
245 | 250 | ||
246 | sb->s_frozen = SB_FREEZE_TRANS; | 251 | sb->s_frozen = SB_FREEZE_TRANS; |
247 | smp_wmb(); | 252 | smp_wmb(); |