diff mbox series

[GIT,PULL] Remove ->ki_complete() res2 argument

Message ID 966b2cbc-8f25-edd9-29b7-f390a85bba61@kernel.dk (mailing list archive)
State New, archived
Headers show
Series [GIT,PULL] Remove ->ki_complete() res2 argument | expand

Pull-request

git://git.kernel.dk/linux-block.git tags/for-5.16/ki_complete-2021-10-29

Commit Message

Jens Axboe Oct. 31, 2021, 7:42 p.m. UTC
Hi Linus,

On top of the core block branch, this pull request removes the res2
argument from kiocb->ki_complete(). Only the USB gadget code used it,
everybody else passes 0. The USB guys checked the user gadget code they
could find, and everybody just uses res as expected for the async
interface.

Note that this will throw one merge conflict in block/fops.c which is
trivial to resolve, but it will miss the other addition of a ki_complete
call in there. The '0' just needs to be removed there, I've included my
merge resolution below.

Please pull!


The following changes since commit e94f68527a35271131cdf9d3fb4eb3c2513dc3d0:

  block: kill extra rcu lock/unlock in queue enter (2021-10-21 08:37:26 -0600)

are available in the Git repository at:

  git://git.kernel.dk/linux-block.git tags/for-5.16/ki_complete-2021-10-29

for you to fetch changes up to 6b19b766e8f077f29cdb47da5003469a85bbfb9c:

  fs: get rid of the res2 iocb->ki_complete argument (2021-10-25 10:36:24 -0600)

----------------------------------------------------------------
for-5.16/ki_complete-2021-10-29

----------------------------------------------------------------
Jens Axboe (2):
      usb: remove res2 argument from gadget code completions
      fs: get rid of the res2 iocb->ki_complete argument

 block/fops.c                       |  2 +-
 crypto/af_alg.c                    |  2 +-
 drivers/block/loop.c               |  4 ++--
 drivers/nvme/target/io-cmd-file.c  |  4 ++--
 drivers/target/target_core_file.c  |  4 ++--
 drivers/usb/gadget/function/f_fs.c |  2 +-
 drivers/usb/gadget/legacy/inode.c  |  7 ++-----
 fs/aio.c                           |  6 +++---
 fs/cachefiles/io.c                 | 12 ++++++------
 fs/ceph/file.c                     |  2 +-
 fs/cifs/file.c                     |  4 ++--
 fs/direct-io.c                     |  2 +-
 fs/fuse/file.c                     |  2 +-
 fs/io_uring.c                      |  6 +++---
 fs/iomap/direct-io.c               |  2 +-
 fs/nfs/direct.c                    |  2 +-
 fs/overlayfs/file.c                |  4 ++--
 include/linux/fs.h                 |  2 +-
 18 files changed, 33 insertions(+), 36 deletions(-)


+++ b/block/fops.c
@@@ -282,94 -305,6 +283,94 @@@ static ssize_t __blkdev_direct_IO(struc
  	return ret;
  }
  
 +static void blkdev_bio_end_io_async(struct bio *bio)
 +{
 +	struct blkdev_dio *dio = container_of(bio, struct blkdev_dio, bio);
 +	struct kiocb *iocb = dio->iocb;
 +	ssize_t ret;
 +
 +	if (likely(!bio->bi_status)) {
 +		ret = dio->size;
 +		iocb->ki_pos += ret;
 +	} else {
 +		ret = blk_status_to_errno(bio->bi_status);
 +	}
 +
- 	iocb->ki_complete(iocb, ret, 0);
++	iocb->ki_complete(iocb, ret);
 +
 +	if (dio->flags & DIO_SHOULD_DIRTY) {
 +		bio_check_pages_dirty(bio);
 +	} else {
 +		bio_release_pages(bio, false);
 +		bio_put(bio);
 +	}
 +}
 +
 +static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
 +					struct iov_iter *iter,
 +					unsigned int nr_pages)
 +{
 +	struct block_device *bdev = iocb->ki_filp->private_data;
 +	struct blkdev_dio *dio;
 +	struct bio *bio;
 +	loff_t pos = iocb->ki_pos;
 +	int ret = 0;
 +
 +	if ((pos | iov_iter_alignment(iter)) &
 +	    (bdev_logical_block_size(bdev) - 1))
 +		return -EINVAL;
 +
 +	bio = bio_alloc_kiocb(iocb, nr_pages, &blkdev_dio_pool);
 +	dio = container_of(bio, struct blkdev_dio, bio);
 +	dio->flags = 0;
 +	dio->iocb = iocb;
 +	bio_set_dev(bio, bdev);
 +	bio->bi_iter.bi_sector = pos >> SECTOR_SHIFT;
 +	bio->bi_write_hint = iocb->ki_hint;
 +	bio->bi_end_io = blkdev_bio_end_io_async;
 +	bio->bi_ioprio = iocb->ki_ioprio;
 +
 +	if (iov_iter_is_bvec(iter)) {
 +		/*
 +		 * Users don't rely on the iterator being in any particular
 +		 * state for async I/O returning -EIOCBQUEUED, hence we can
 +		 * avoid expensive iov_iter_advance(). Bypass
 +		 * bio_iov_iter_get_pages() and set the bvec directly.
 +		 */
 +		bio_iov_bvec_set(bio, iter);
 +	} else {
 +		ret = bio_iov_iter_get_pages(bio, iter);
 +		if (unlikely(ret)) {
 +			bio->bi_status = BLK_STS_IOERR;
 +			bio_endio(bio);
 +			return ret;
 +		}
 +	}
 +	dio->size = bio->bi_iter.bi_size;
 +
 +	if (iov_iter_rw(iter) == READ) {
 +		bio->bi_opf = REQ_OP_READ;
 +		if (iter_is_iovec(iter)) {
 +			dio->flags |= DIO_SHOULD_DIRTY;
 +			bio_set_pages_dirty(bio);
 +		}
 +	} else {
 +		bio->bi_opf = dio_bio_write_op(iocb);
 +		task_io_account_write(bio->bi_iter.bi_size);
 +	}
 +
 +	if (iocb->ki_flags & IOCB_HIPRI) {
 +		bio->bi_opf |= REQ_POLLED | REQ_NOWAIT;
 +		submit_bio(bio);
 +		WRITE_ONCE(iocb->private, bio);
 +	} else {
 +		if (iocb->ki_flags & IOCB_NOWAIT)
 +			bio->bi_opf |= REQ_NOWAIT;
 +		submit_bio(bio);
 +	}
 +	return -EIOCBQUEUED;
 +}
 +
  static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
  {
  	unsigned int nr_pages;

Comments

pr-tracker-bot@kernel.org Nov. 1, 2021, 5:28 p.m. UTC | #1
The pull request you sent on Sun, 31 Oct 2021 13:42:10 -0600:

> git://git.kernel.dk/linux-block.git tags/for-5.16/ki_complete-2021-10-29

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/b6773cdb0e9fa75993946753d12f05eb3bbf3bce

Thank you!
diff mbox series

Patch

diff --cc block/fops.c
index 3777c7b76eae,d86ebda73e8c..450bcbc0e90c
--- a/block/fops.c