Skip to content

Commit bdb3475

Browse files
author
Mike Snitzer
committed
dm: use bio_sectors in dm_aceept_partial_bio
Rename 'bi_size' to 'bio_sectors' given bi_size is being stored in sectors. Also, use bio_sectors() rather than open-coding it. Signed-off-by: Mike Snitzer <[email protected]>
1 parent e86f2b0 commit bdb3475

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/md/dm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ static int dm_dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff,
11941194
* +--------------------+---------------+-------+
11951195
*
11961196
* <-------------- *tio->len_ptr --------------->
1197-
* <------- bi_size ------->
1197+
* <----- bio_sectors ----->
11981198
* <-- n_sectors -->
11991199
*
12001200
* Region 1 was already iterated over with bio_advance or similar function.
@@ -1211,15 +1211,15 @@ static int dm_dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff,
12111211
void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors)
12121212
{
12131213
struct dm_target_io *tio = clone_to_tio(bio);
1214-
unsigned bi_size = bio->bi_iter.bi_size >> SECTOR_SHIFT;
1214+
unsigned bio_sectors = bio_sectors(bio);
12151215

12161216
BUG_ON(dm_tio_flagged(tio, DM_TIO_IS_DUPLICATE_BIO));
12171217
BUG_ON(op_is_zone_mgmt(bio_op(bio)));
12181218
BUG_ON(bio_op(bio) == REQ_OP_ZONE_APPEND);
1219-
BUG_ON(bi_size > *tio->len_ptr);
1220-
BUG_ON(n_sectors > bi_size);
1219+
BUG_ON(bio_sectors > *tio->len_ptr);
1220+
BUG_ON(n_sectors > bio_sectors);
12211221

1222-
*tio->len_ptr -= bi_size - n_sectors;
1222+
*tio->len_ptr -= bio_sectors - n_sectors;
12231223
bio->bi_iter.bi_size = n_sectors << SECTOR_SHIFT;
12241224
}
12251225
EXPORT_SYMBOL_GPL(dm_accept_partial_bio);

0 commit comments

Comments
 (0)