Skip to content

Commit 263663c

Browse files
Ming Leiaxboe
authored andcommitted
block: convert to bio_first_bvec_all & bio_first_page_all
This patch converts to bio_first_bvec_all() & bio_first_page_all() for retrieving the 1st bvec/page, and prepares for supporting multipage bvec. Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 86292ab commit 263663c

8 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎drivers/block/drbd/drbd_bitmap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ static void drbd_bm_endio(struct bio *bio)
953953
struct drbd_bm_aio_ctx *ctx = bio->bi_private;
954954
struct drbd_device *device = ctx->device;
955955
struct drbd_bitmap *b = device->bitmap;
956-
unsigned int idx = bm_page_to_idx(bio->bi_io_vec[0].bv_page);
956+
unsigned int idx = bm_page_to_idx(bio_first_page_all(bio));
957957

958958
if ((ctx->flags & BM_AIO_COPY_PAGES) == 0 &&
959959
!bm_test_page_unchanged(b->bm_pages[idx]))

‎drivers/block/zram/zram_drv.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static void put_entry_bdev(struct zram *zram, unsigned long entry)
430430

431431
static void zram_page_end_io(struct bio *bio)
432432
{
433-
struct page *page = bio->bi_io_vec[0].bv_page;
433+
struct page *page = bio_first_page_all(bio);
434434

435435
page_endio(page, op_is_write(bio_op(bio)),
436436
blk_status_to_errno(bio->bi_status));

‎drivers/md/bcache/super.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static void write_bdev_super_endio(struct bio *bio)
211211

212212
static void __write_super(struct cache_sb *sb, struct bio *bio)
213213
{
214-
struct cache_sb *out = page_address(bio->bi_io_vec[0].bv_page);
214+
struct cache_sb *out = page_address(bio_first_page_all(bio));
215215
unsigned i;
216216

217217
bio->bi_iter.bi_sector = SB_SECTOR;
@@ -1166,7 +1166,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
11661166
dc->bdev->bd_holder = dc;
11671167

11681168
bio_init(&dc->sb_bio, dc->sb_bio.bi_inline_vecs, 1);
1169-
dc->sb_bio.bi_io_vec[0].bv_page = sb_page;
1169+
bio_first_bvec_all(&dc->sb_bio)->bv_page = sb_page;
11701170
get_page(sb_page);
11711171

11721172
if (cached_dev_init(dc, sb->block_size << 9))
@@ -1810,7 +1810,7 @@ void bch_cache_release(struct kobject *kobj)
18101810
free_fifo(&ca->free[i]);
18111811

18121812
if (ca->sb_bio.bi_inline_vecs[0].bv_page)
1813-
put_page(ca->sb_bio.bi_io_vec[0].bv_page);
1813+
put_page(bio_first_page_all(&ca->sb_bio));
18141814

18151815
if (!IS_ERR_OR_NULL(ca->bdev))
18161816
blkdev_put(ca->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
@@ -1864,7 +1864,7 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page,
18641864
ca->bdev->bd_holder = ca;
18651865

18661866
bio_init(&ca->sb_bio, ca->sb_bio.bi_inline_vecs, 1);
1867-
ca->sb_bio.bi_io_vec[0].bv_page = sb_page;
1867+
bio_first_bvec_all(&ca->sb_bio)->bv_page = sb_page;
18681868
get_page(sb_page);
18691869

18701870
if (blk_queue_discard(bdev_get_queue(ca->bdev)))

‎fs/btrfs/compression.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
563563
/* we need the actual starting offset of this extent in the file */
564564
read_lock(&em_tree->lock);
565565
em = lookup_extent_mapping(em_tree,
566-
page_offset(bio->bi_io_vec->bv_page),
566+
page_offset(bio_first_page_all(bio)),
567567
PAGE_SIZE);
568568
read_unlock(&em_tree->lock);
569569
if (!em)

‎fs/btrfs/inode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8074,7 +8074,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
80748074
ASSERT(bio->bi_vcnt == 1);
80758075
io_tree = &BTRFS_I(inode)->io_tree;
80768076
failure_tree = &BTRFS_I(inode)->io_failure_tree;
8077-
ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(inode));
8077+
ASSERT(bio_first_bvec_all(bio)->bv_len == btrfs_inode_sectorsize(inode));
80788078

80798079
done->uptodate = 1;
80808080
ASSERT(!bio_flagged(bio, BIO_CLONED));
@@ -8164,7 +8164,7 @@ static void btrfs_retry_endio(struct bio *bio)
81648164
uptodate = 1;
81658165

81668166
ASSERT(bio->bi_vcnt == 1);
8167-
ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(done->inode));
8167+
ASSERT(bio_first_bvec_all(bio)->bv_len == btrfs_inode_sectorsize(done->inode));
81688168

81698169
io_tree = &BTRFS_I(inode)->io_tree;
81708170
failure_tree = &BTRFS_I(inode)->io_failure_tree;

‎fs/f2fs/data.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void f2fs_read_end_io(struct bio *bio)
5656
int i;
5757

5858
#ifdef CONFIG_F2FS_FAULT_INJECTION
59-
if (time_to_inject(F2FS_P_SB(bio->bi_io_vec->bv_page), FAULT_IO)) {
59+
if (time_to_inject(F2FS_P_SB(bio_first_page_all(bio)), FAULT_IO)) {
6060
f2fs_show_injection_info(FAULT_IO);
6161
bio->bi_status = BLK_STS_IOERR;
6262
}

‎kernel/power/swap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static void hib_init_batch(struct hib_bio_batch *hb)
240240
static void hib_end_io(struct bio *bio)
241241
{
242242
struct hib_bio_batch *hb = bio->bi_private;
243-
struct page *page = bio->bi_io_vec[0].bv_page;
243+
struct page *page = bio_first_page_all(bio);
244244

245245
if (bio->bi_status) {
246246
pr_alert("Read-error on swap-device (%u:%u:%Lu)\n",

‎mm/page_io.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static struct bio *get_swap_bio(gfp_t gfp_flags,
5050

5151
void end_swap_bio_write(struct bio *bio)
5252
{
53-
struct page *page = bio->bi_io_vec[0].bv_page;
53+
struct page *page = bio_first_page_all(bio);
5454

5555
if (bio->bi_status) {
5656
SetPageError(page);
@@ -122,7 +122,7 @@ static void swap_slot_free_notify(struct page *page)
122122

123123
static void end_swap_bio_read(struct bio *bio)
124124
{
125-
struct page *page = bio->bi_io_vec[0].bv_page;
125+
struct page *page = bio_first_page_all(bio);
126126
struct task_struct *waiter = bio->bi_private;
127127

128128
if (bio->bi_status) {

0 commit comments

Comments
 (0)