zbd: introduce zbd_offset_to_zone() helper
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Tue, 14 Dec 2021 01:24:12 +0000 (10:24 +0900)
committerJens Axboe <axboe@kernel.dk>
Tue, 14 Dec 2021 13:48:14 +0000 (06:48 -0700)
commit53aa61719b906bdf8e058c94ca93e537b90806b1
treeff6ec0ff90cbc28077b7bc74727aaeb69ae66339
parent39e06ee779cae55cb7d02eb11a5f12ca7f21a337
zbd: introduce zbd_offset_to_zone() helper

Introduce the helper function zbd_offset_to_zone() to get a zone
structure using a file offset. In many functions, this replaces the
two line code pattern:

zone_idx = zbd_offset_to_zone_idx(f, offset);
z = zbd_get_zone(f, zone_idx);

with a single line of code:

z = zbd_offset_to_zone(f, offset);

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20211214012413.464798-12-damien.lemoal@opensource.wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c