lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v10 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes
From
> 
> I think this is way better. But I would still reorganize this like this:
>
> static int dm_po2z_map(struct dm_target *ti, struct bio *bio)
> {
> struct dm_po2z_target *dmh = ti->private;
> int split_io_pos;
>
> bio_set_dev(bio, dmh->dev->bdev);
>
> if (op_is_zone_mgmt(bio_op(bio)))
> return dm_po2z_remap_sector(dmh, bio);
>
> if (!bio_sectors(bio))
> return DM_MAPIO_REMAPPED;
>
> /*
> * Read operation on the emulated zone area (between zone capacity
> * and zone size) will fill the bio with zeroes. Any other operation
> * in the emulated area should return an error.
> */
> if (!bio_in_emulated_zone_area(dmh, bio, &split_io_pos))
> return dm_po2z_remap_sector(dmh, bio);
>
> if (bio_op(bio) == REQ_OP_READ) {
> if (split_io_pos > 0) {
> dm_accept_partial_bio(bio, split_io_pos);
> return dm_po2z_remap_sector(dmh, bio);
> }
> return dm_po2z_read_zeroes(bio);
> }
>
> return DM_MAPIO_KILL;
> }
>
> I find the code easier to follow this way.
>
I agree. It is definitely easier to follow. I will make these changes
and send the next version soon.
>
>

\
 
 \ /
  Last update: 2022-08-16 12:03    [W:0.208 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site