btrfs: do not increment dirty_metadata_bytes in set_btree_ioerr
authorJosef Bacik <josef@toxicpanda.com>
Thu, 26 Jan 2023 21:00:57 +0000 (16:00 -0500)
committerDavid Sterba <dsterba@suse.com>
Wed, 15 Feb 2023 18:38:53 +0000 (19:38 +0100)
We only add if we set the extent buffer dirty, and we subtract when we
clear the extent buffer dirty.  If we end up in set_btree_ioerr we have
already cleared the buffer dirty, and we aren't resetting dirty on the
extent buffer, so this is simply wrong.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c

index e2816b86311a7f4d2176dbdd101b63ad80802c96..ada88ada49e1d4c620ddaac82f04f1d4c4f703df 100644 (file)
@@ -1911,13 +1911,6 @@ static void set_btree_ioerr(struct page *page, struct extent_buffer *eb)
         */
        mapping_set_error(page->mapping, -EIO);
 
-       /*
-        * If we error out, we should add back the dirty_metadata_bytes
-        * to make it consistent.
-        */
-       percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
-                                eb->len, fs_info->dirty_metadata_batch);
-
        /*
         * If writeback for a btree extent that doesn't belong to a log tree
         * failed, increment the counter transaction->eb_write_errors.