Skip to content

Commit daa99c5

Browse files
committed
iomap: only set iocb->private for polled bio
iocb->private is only used for polled IO, where the completer will find the bio to poll through that field. Assign it when we're submitting a polled bio, and get rid of the dio->poll_bio indirection. Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 3a0be38 commit daa99c5

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

fs/iomap/direct-io.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ struct iomap_dio {
4141
struct {
4242
struct iov_iter *iter;
4343
struct task_struct *waiter;
44-
struct bio *poll_bio;
4544
} submit;
4645

4746
/* used for aio completion: */
@@ -63,12 +62,14 @@ static struct bio *iomap_dio_alloc_bio(const struct iomap_iter *iter,
6362
static void iomap_dio_submit_bio(const struct iomap_iter *iter,
6463
struct iomap_dio *dio, struct bio *bio, loff_t pos)
6564
{
65+
struct kiocb *iocb = dio->iocb;
66+
6667
atomic_inc(&dio->ref);
6768

6869
/* Sync dio can't be polled reliably */
69-
if ((dio->iocb->ki_flags & IOCB_HIPRI) && !is_sync_kiocb(dio->iocb)) {
70-
bio_set_polled(bio, dio->iocb);
71-
dio->submit.poll_bio = bio;
70+
if ((iocb->ki_flags & IOCB_HIPRI) && !is_sync_kiocb(iocb)) {
71+
bio_set_polled(bio, iocb);
72+
WRITE_ONCE(iocb->private, bio);
7273
}
7374

7475
if (dio->dops && dio->dops->submit_io)
@@ -184,7 +185,6 @@ void iomap_dio_bio_end_io(struct bio *bio)
184185
* more IO to be issued to finalise filesystem metadata changes or
185186
* guarantee data integrity.
186187
*/
187-
WRITE_ONCE(iocb->private, NULL);
188188
INIT_WORK(&dio->aio.work, iomap_dio_complete_work);
189189
queue_work(file_inode(iocb->ki_filp)->i_sb->s_dio_done_wq,
190190
&dio->aio.work);
@@ -523,7 +523,6 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
523523

524524
dio->submit.iter = iter;
525525
dio->submit.waiter = current;
526-
dio->submit.poll_bio = NULL;
527526

528527
if (iocb->ki_flags & IOCB_NOWAIT)
529528
iomi.flags |= IOMAP_NOWAIT;
@@ -633,8 +632,6 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
633632
if (dio->flags & IOMAP_DIO_WRITE_THROUGH)
634633
dio->flags &= ~IOMAP_DIO_NEED_SYNC;
635634

636-
WRITE_ONCE(iocb->private, dio->submit.poll_bio);
637-
638635
/*
639636
* We are about to drop our additional submission reference, which
640637
* might be the last reference to the dio. There are three different

0 commit comments

Comments
 (0)