btrfs: don't call btrfs_record_physical_zoned for failed append
authorChristoph Hellwig <hch@lst.de>
Wed, 24 May 2023 15:03:05 +0000 (17:03 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:32 +0000 (13:59 +0200)
When a zoned append command fails there is no written address reported,
so don't try to record it.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/bio.c

index 2e2e1ab..ea6c81f 100644 (file)
@@ -348,7 +348,7 @@ static void btrfs_simple_end_io(struct bio *bio)
                INIT_WORK(&bbio->end_io_work, btrfs_end_bio_work);
                queue_work(btrfs_end_io_wq(fs_info, bio), &bbio->end_io_work);
        } else {
-               if (bio_op(bio) == REQ_OP_ZONE_APPEND)
+               if (bio_op(bio) == REQ_OP_ZONE_APPEND && !bio->bi_status)
                        btrfs_record_physical_zoned(bbio);
                btrfs_orig_bbio_end_io(bbio);
        }