On Fri, Oct 02, 2020 at 03:36:32AM +0900, Naohiro Aota wrote: > This commit enables zone append writing for zoned btrfs. Three parts are > necessary to enable it. First, it modifies bio to use REQ_OP_ZONE_APPEND in > btrfs_submit_bio_hook() and adjust the bi_sector to point the beginning of > the zone. > > Second, it records returned physical address (and disk/partno) to > the ordered extent in end_bio_extent_writepage(). That sounds fishy ... > Finally, it rewrites logical addresses of the extent mapping and checksum > data according to the physical address (using __btrfs_rmap_block). If the > returned address match to the originaly allocated address, we can skip the > rewriting process. > > [Johannes] fixed bvec handling > Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx> > --- a/fs/btrfs/ordered-data.h > +++ b/fs/btrfs/ordered-data.h > @@ -127,6 +127,10 @@ struct btrfs_ordered_extent { > struct completion completion; > struct btrfs_work flush_work; > struct list_head work_list; > + > + u64 physical; > + struct gendisk *disk; > + u8 partno; btrfs_ordered_extent is on the logical layer, disk/partno is physical. This needs proper explanation why it has to be done that way and that there's not really anything better than layering violation. Why __btrfs_rmap_block takes bdev is unexplained.