[PATCH 02/12] iomap: save copy of bdev for direct io
Keith Busch
kbusch at fb.com
Thu Jun 30 13:42:02 PDT 2022
From: Keith Busch <kbusch at kernel.org>
The block_device is used three times already, so save a copy instead of
following the iomap pointer each time.
Signed-off-by: Keith Busch <kbusch at kernel.org>
---
fs/iomap/direct-io.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 5d098adba443..5d478a95efdf 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -240,7 +240,8 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
{
const struct iomap *iomap = &iter->iomap;
struct inode *inode = iter->inode;
- unsigned int blkbits = blksize_bits(bdev_logical_block_size(iomap->bdev));
+ struct block_device *bdev = iomap->bdev;
+ unsigned int blkbits = blksize_bits(bdev_logical_block_size(bdev));
unsigned int fs_block_size = i_blocksize(inode), pad;
loff_t length = iomap_length(iter);
loff_t pos = iter->pos;
@@ -253,7 +254,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
size_t orig_count;
if ((pos | length) & ((1 << blkbits) - 1) ||
- !bdev_iter_is_aligned(iomap->bdev, dio->submit.iter))
+ !bdev_iter_is_aligned(bdev, dio->submit.iter))
return -EINVAL;
if (iomap->type == IOMAP_UNWRITTEN) {
@@ -275,7 +276,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
* cache flushes on IO completion.
*/
if (!(iomap->flags & (IOMAP_F_SHARED|IOMAP_F_DIRTY)) &&
- (dio->flags & IOMAP_DIO_WRITE_FUA) && bdev_fua(iomap->bdev))
+ (dio->flags & IOMAP_DIO_WRITE_FUA) && bdev_fua(bdev))
use_fua = true;
}
--
2.30.2
More information about the Linux-nvme
mailing list