diff options
author | Johannes Thumshirn <johannes.thumshirn@wdc.com> | 2023-11-23 07:47:16 -0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-12-15 20:27:02 +0100 |
commit | aa6313e6ff2bfbf736a2739047bba355d8241584 (patch) | |
tree | 4e07f80e35cecf3a8b9e0c0a1bd36c784cf250e9 /fs/btrfs/extent_io.c | |
parent | cbf44cd93db3a470ead92a938210f41095cea562 (diff) | |
download | lwn-aa6313e6ff2bfbf736a2739047bba355d8241584.tar.gz lwn-aa6313e6ff2bfbf736a2739047bba355d8241584.zip |
btrfs: zoned: don't clear dirty flag of extent buffer
One a zoned filesystem, never clear the dirty flag of an extent buffer,
but instead mark it as zeroout.
On writeout, when encountering a marked extent_buffer, zero it out.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 85cee54200ce..671010de7964 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3761,6 +3761,20 @@ void btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans, if (trans && btrfs_header_generation(eb) != trans->transid) return; + /* + * Instead of clearing the dirty flag off of the buffer, mark it as + * EXTENT_BUFFER_ZONED_ZEROOUT. This allows us to preserve + * write-ordering in zoned mode, without the need to later re-dirty + * the extent_buffer. + * + * The actual zeroout of the buffer will happen later in + * btree_csum_one_bio. + */ + if (btrfs_is_zoned(fs_info)) { + set_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &eb->bflags); + return; + } + if (!test_and_clear_bit(EXTENT_BUFFER_DIRTY, &eb->bflags)) return; @@ -4152,8 +4166,6 @@ static void __write_extent_buffer(const struct extent_buffer *eb, /* For unmapped (dummy) ebs, no need to check their uptodate status. */ const bool check_uptodate = !test_bit(EXTENT_BUFFER_UNMAPPED, &eb->bflags); - WARN_ON(test_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &eb->bflags)); - if (check_eb_range(eb, start, len)) return; |