[PATCH v10 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes

Pankaj Raghav p.raghav at samsung.com
Tue Aug 16 01:02:29 PDT 2022


> 
> 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.
> 
> 



More information about the Linux-nvme mailing list