Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aacfc19c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro
Browse files

fs: simplify the blockdev_direct_IO prototype



Simple filesystems always pass inode->i_sb_bdev as the block device
argument, and never need a end_io handler.  Let's simply things for
them and for my grepping activity by dropping these arguments.  The
only thing not falling into that scheme is ext4, which passes and
end_io handler without needing special flags (yet), but given how
messy the direct I/O code there is use of __blockdev_direct_IO
in one instead of two out of three cases isn't going to make a large
difference anyway.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent df2d6f26
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -843,8 +843,8 @@ ext2_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
	struct inode *inode = mapping->host;
	ssize_t ret;

	ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
				iov, offset, nr_segs, ext2_get_block, NULL);
	ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
				 ext2_get_block);
	if (ret < 0 && (rw & WRITE))
		ext2_write_failed(mapping, offset + iov_length(iov, nr_segs));
	return ret;
+2 −3
Original line number Diff line number Diff line
@@ -1816,9 +1816,8 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
	}

retry:
	ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
				 offset, nr_segs,
				 ext3_get_block, NULL);
	ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
				 ext3_get_block);
	/*
	 * In case of error extending write may have instantiated a few
	 * blocks outside i_size. Trim these off again.
+6 −6
Original line number Diff line number Diff line
@@ -3501,10 +3501,8 @@ static ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
				 offset, nr_segs,
				 ext4_get_block, NULL, NULL, 0);
	else {
		ret = blockdev_direct_IO(rw, iocb, inode,
				 inode->i_sb->s_bdev, iov,
				 offset, nr_segs,
				 ext4_get_block, NULL);
		ret = blockdev_direct_IO(rw, iocb, inode, iov,
				 offset, nr_segs, ext4_get_block);

		if (unlikely((rw & WRITE) && ret < 0)) {
			loff_t isize = i_size_read(inode);
@@ -3748,11 +3746,13 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
			EXT4_I(inode)->cur_aio_dio = iocb->private;
		}

		ret = blockdev_direct_IO(rw, iocb, inode,
		ret = __blockdev_direct_IO(rw, iocb, inode,
					 inode->i_sb->s_bdev, iov,
					 offset, nr_segs,
					 ext4_get_block_write,
					 ext4_end_io_dio);
					 ext4_end_io_dio,
					 NULL,
					 DIO_LOCKING | DIO_SKIP_HOLES);
		if (iocb->private)
			EXT4_I(inode)->cur_aio_dio = NULL;
		/*
+2 −2
Original line number Diff line number Diff line
@@ -211,8 +211,8 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
	 * FAT need to use the DIO_LOCKING for avoiding the race
	 * condition of fat_get_block() and ->truncate().
	 */
	ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
				 iov, offset, nr_segs, fat_get_block, NULL);
	ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
				 fat_get_block);
	if (ret < 0 && (rw & WRITE))
		fat_write_failed(mapping, offset + iov_length(iov, nr_segs));

+2 −2
Original line number Diff line number Diff line
@@ -123,8 +123,8 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
	struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
	ssize_t ret;

	ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
				  offset, nr_segs, hfs_get_block, NULL);
	ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
				 hfs_get_block);

	/*
	 * In case of error extending write may have instantiated a few
Loading