diff options
Diffstat (limited to 'fs/block_dev.c')
| -rw-r--r-- | fs/block_dev.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 94dfda24c06e..71e7e03ac343 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -420,7 +420,6 @@ static void bdev_destroy_inode(struct inode *inode) | |||
| 420 | { | 420 | { |
| 421 | struct bdev_inode *bdi = BDEV_I(inode); | 421 | struct bdev_inode *bdi = BDEV_I(inode); |
| 422 | 422 | ||
| 423 | bdi->bdev.bd_inode_backing_dev_info = NULL; | ||
| 424 | kmem_cache_free(bdev_cachep, bdi); | 423 | kmem_cache_free(bdev_cachep, bdi); |
| 425 | } | 424 | } |
| 426 | 425 | ||
| @@ -1405,6 +1404,33 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
| 1405 | } | 1404 | } |
| 1406 | 1405 | ||
| 1407 | /* | 1406 | /* |
| 1407 | * Write data to the block device. Only intended for the block device itself | ||
| 1408 | * and the raw driver which basically is a fake block device. | ||
| 1409 | * | ||
| 1410 | * Does not take i_mutex for the write and thus is not for general purpose | ||
| 1411 | * use. | ||
| 1412 | */ | ||
| 1413 | ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | ||
| 1414 | unsigned long nr_segs, loff_t pos) | ||
| 1415 | { | ||
| 1416 | struct file *file = iocb->ki_filp; | ||
| 1417 | ssize_t ret; | ||
| 1418 | |||
| 1419 | BUG_ON(iocb->ki_pos != pos); | ||
| 1420 | |||
| 1421 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); | ||
| 1422 | if (ret > 0 || ret == -EIOCBQUEUED) { | ||
| 1423 | ssize_t err; | ||
| 1424 | |||
| 1425 | err = generic_write_sync(file, pos, ret); | ||
| 1426 | if (err < 0 && ret > 0) | ||
| 1427 | ret = err; | ||
| 1428 | } | ||
| 1429 | return ret; | ||
| 1430 | } | ||
| 1431 | EXPORT_SYMBOL_GPL(blkdev_aio_write); | ||
| 1432 | |||
| 1433 | /* | ||
| 1408 | * Try to release a page associated with block device when the system | 1434 | * Try to release a page associated with block device when the system |
| 1409 | * is under memory pressure. | 1435 | * is under memory pressure. |
| 1410 | */ | 1436 | */ |
| @@ -1436,7 +1462,7 @@ const struct file_operations def_blk_fops = { | |||
| 1436 | .read = do_sync_read, | 1462 | .read = do_sync_read, |
| 1437 | .write = do_sync_write, | 1463 | .write = do_sync_write, |
| 1438 | .aio_read = generic_file_aio_read, | 1464 | .aio_read = generic_file_aio_read, |
| 1439 | .aio_write = generic_file_aio_write_nolock, | 1465 | .aio_write = blkdev_aio_write, |
| 1440 | .mmap = generic_file_mmap, | 1466 | .mmap = generic_file_mmap, |
| 1441 | .fsync = block_fsync, | 1467 | .fsync = block_fsync, |
| 1442 | .unlocked_ioctl = block_ioctl, | 1468 | .unlocked_ioctl = block_ioctl, |
