Message ID | 8e6003932f65ecd9ada5d6296c6eb9d1b946a1eb.1634676157.git.asml.silence@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block optimisation round | expand |
On Tue, Oct 19, 2021 at 10:24:19PM +0100, Pavel Begunkov wrote: > Save dio->flags in a variable, so it doesn't reload it a bunch of times. > Also use cached in a var iocb for the same reason. Same question again, does this really make a difference? We really shouldn't have to try to work around the compiler like this (even if this relatively harmless in the end).
On 10/20/21 07:30, Christoph Hellwig wrote: > On Tue, Oct 19, 2021 at 10:24:19PM +0100, Pavel Begunkov wrote: >> Save dio->flags in a variable, so it doesn't reload it a bunch of times. >> Also use cached in a var iocb for the same reason. > > Same question again, does this really make a difference? We really No, will remove the patch > shouldn't have to try to work around the compiler like this (even if > this relatively harmless in the end).
diff --git a/block/fops.c b/block/fops.c index 8f733c919ed1..8e3790faafb8 100644 --- a/block/fops.c +++ b/block/fops.c @@ -145,13 +145,13 @@ static struct bio_set blkdev_dio_pool; static void blkdev_bio_end_io(struct bio *bio) { struct blkdev_dio *dio = bio->bi_private; - bool should_dirty = dio->flags & DIO_SHOULD_DIRTY; + unsigned int flags = dio->flags; if (bio->bi_status && !dio->bio.bi_status) dio->bio.bi_status = bio->bi_status; - if (!(dio->flags & DIO_MULTI_BIO) || atomic_dec_and_test(&dio->ref)) { - if (!(dio->flags & DIO_IS_SYNC)) { + if (!(flags & DIO_MULTI_BIO) || atomic_dec_and_test(&dio->ref)) { + if (!(flags & DIO_IS_SYNC)) { struct kiocb *iocb = dio->iocb; ssize_t ret; @@ -164,8 +164,8 @@ static void blkdev_bio_end_io(struct bio *bio) ret = blk_status_to_errno(dio->bio.bi_status); } - dio->iocb->ki_complete(iocb, ret, 0); - if (dio->flags & DIO_MULTI_BIO) + iocb->ki_complete(iocb, ret, 0); + if (flags & DIO_MULTI_BIO) bio_put(&dio->bio); } else { struct task_struct *waiter = dio->waiter; @@ -175,7 +175,7 @@ static void blkdev_bio_end_io(struct bio *bio) } } - if (should_dirty) { + if (flags & DIO_SHOULD_DIRTY) { bio_check_pages_dirty(bio); } else { bio_release_pages(bio, false);
Save dio->flags in a variable, so it doesn't reload it a bunch of times. Also use cached in a var iocb for the same reason. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> --- block/fops.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)