aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index b3171fb0dc9a..451afbd543b5 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -172,9 +172,8 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
172 struct file *file = iocb->ki_filp; 172 struct file *file = iocb->ki_filp;
173 struct inode *inode = file->f_mapping->host; 173 struct inode *inode = file->f_mapping->host;
174 174
175 return blockdev_direct_IO_no_locking_newtrunc(rw, iocb, inode, 175 return __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iov, offset,
176 I_BDEV(inode), iov, offset, nr_segs, 176 nr_segs, blkdev_get_blocks, NULL, NULL, 0);
177 blkdev_get_blocks, NULL);
178} 177}
179 178
180int __sync_blockdev(struct block_device *bdev, int wait) 179int __sync_blockdev(struct block_device *bdev, int wait)
@@ -309,9 +308,8 @@ static int blkdev_write_begin(struct file *file, struct address_space *mapping,
309 loff_t pos, unsigned len, unsigned flags, 308 loff_t pos, unsigned len, unsigned flags,
310 struct page **pagep, void **fsdata) 309 struct page **pagep, void **fsdata)
311{ 310{
312 *pagep = NULL; 311 return block_write_begin(mapping, pos, len, flags, pagep,
313 return block_write_begin_newtrunc(file, mapping, pos, len, flags, 312 blkdev_get_block);
314 pagep, fsdata, blkdev_get_block);
315} 313}
316 314
317static int blkdev_write_end(struct file *file, struct address_space *mapping, 315static int blkdev_write_end(struct file *file, struct address_space *mapping,
@@ -428,10 +426,13 @@ static inline void __bd_forget(struct inode *inode)
428 inode->i_mapping = &inode->i_data; 426 inode->i_mapping = &inode->i_data;
429} 427}
430 428
431static void bdev_clear_inode(struct inode *inode) 429static void bdev_evict_inode(struct inode *inode)
432{ 430{
433 struct block_device *bdev = &BDEV_I(inode)->bdev; 431 struct block_device *bdev = &BDEV_I(inode)->bdev;
434 struct list_head *p; 432 struct list_head *p;
433 truncate_inode_pages(&inode->i_data, 0);
434 invalidate_inode_buffers(inode); /* is it needed here? */
435 end_writeback(inode);
435 spin_lock(&bdev_lock); 436 spin_lock(&bdev_lock);
436 while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) { 437 while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
437 __bd_forget(list_entry(p, struct inode, i_devices)); 438 __bd_forget(list_entry(p, struct inode, i_devices));
@@ -445,7 +446,7 @@ static const struct super_operations bdev_sops = {
445 .alloc_inode = bdev_alloc_inode, 446 .alloc_inode = bdev_alloc_inode,
446 .destroy_inode = bdev_destroy_inode, 447 .destroy_inode = bdev_destroy_inode,
447 .drop_inode = generic_delete_inode, 448 .drop_inode = generic_delete_inode,
448 .clear_inode = bdev_clear_inode, 449 .evict_inode = bdev_evict_inode,
449}; 450};
450 451
451static int bd_get_sb(struct file_system_type *fs_type, 452static int bd_get_sb(struct file_system_type *fs_type,