linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH 09/16] btrfs: remove PAGE_SET_ERROR
Date: Wed, 31 May 2023 08:04:58 +0200	[thread overview]
Message-ID: <20230531060505.468704-10-hch@lst.de> (raw)
In-Reply-To: <20230531060505.468704-1-hch@lst.de>

Now that the btrfs writeback code has stopped using PageError, using
PAGE_SET_ERROR to just set the per-address_space error flag is confusing.
Just open code the mapping_set_error calls in the callers and remove
the PAGE_SET_ERROR flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/extent_io.c |  3 ---
 fs/btrfs/extent_io.h |  1 -
 fs/btrfs/inode.c     | 11 ++++++-----
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b7f26a4bb663cd..09a9973c27ccfb 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -268,9 +268,6 @@ static int __process_pages_contig(struct address_space *mapping,
 		ASSERT(processed_end && *processed_end == start);
 	}
 
-	if ((page_ops & PAGE_SET_ERROR) && start_index <= end_index)
-		mapping_set_error(mapping, -EIO);
-
 	folio_batch_init(&fbatch);
 	while (index <= end_index) {
 		int found_folios;
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 2d91ca91dca5c1..6723bf3483d9f9 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -40,7 +40,6 @@ enum {
 	ENUM_BIT(PAGE_START_WRITEBACK),
 	ENUM_BIT(PAGE_END_WRITEBACK),
 	ENUM_BIT(PAGE_SET_ORDERED),
-	ENUM_BIT(PAGE_SET_ERROR),
 	ENUM_BIT(PAGE_LOCK),
 };
 
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2e1e1f18649d90..ea9e880c8cee76 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -835,6 +835,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)
 {
 	struct btrfs_inode *inode = async_chunk->inode;
 	struct btrfs_fs_info *fs_info = inode->root->fs_info;
+	struct address_space *mapping = inode->vfs_inode.i_mapping;
 	u64 blocksize = fs_info->sectorsize;
 	u64 start = async_chunk->start;
 	u64 end = async_chunk->end;
@@ -949,7 +950,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)
 		/* Compression level is applied here and only here */
 		ret = btrfs_compress_pages(
 			compress_type | (fs_info->compress_level << 4),
-					   inode->vfs_inode.i_mapping, start,
+					   mapping, start,
 					   pages,
 					   &nr_pages,
 					   &total_in,
@@ -992,9 +993,9 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)
 			unsigned long clear_flags = EXTENT_DELALLOC |
 				EXTENT_DELALLOC_NEW | EXTENT_DEFRAG |
 				EXTENT_DO_ACCOUNTING;
-			unsigned long page_error_op;
 
-			page_error_op = ret < 0 ? PAGE_SET_ERROR : 0;
+			if (ret < 0)
+				mapping_set_error(mapping, -EIO);
 
 			/*
 			 * inline extent creation worked or returned error,
@@ -1011,7 +1012,6 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)
 						     clear_flags,
 						     PAGE_UNLOCK |
 						     PAGE_START_WRITEBACK |
-						     page_error_op |
 						     PAGE_END_WRITEBACK);
 
 			/*
@@ -1271,12 +1271,13 @@ static int submit_one_async_extent(struct btrfs_inode *inode,
 	btrfs_dec_block_group_reservations(fs_info, ins.objectid);
 	btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1);
 out_free:
+	mapping_set_error(inode->vfs_inode.i_mapping, -EIO);
 	extent_clear_unlock_delalloc(inode, start, end,
 				     NULL, EXTENT_LOCKED | EXTENT_DELALLOC |
 				     EXTENT_DELALLOC_NEW |
 				     EXTENT_DEFRAG | EXTENT_DO_ACCOUNTING,
 				     PAGE_UNLOCK | PAGE_START_WRITEBACK |
-				     PAGE_END_WRITEBACK | PAGE_SET_ERROR);
+				     PAGE_END_WRITEBACK);
 	free_async_extent_pages(async_extent);
 	goto done;
 }
-- 
2.39.2


  parent reply	other threads:[~2023-05-31  6:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  6:04 writeback fixlets and tidyups v2 Christoph Hellwig
2023-05-31  6:04 ` [PATCH 01/16] btrfs: fix range_end calculation in extent_write_locked_range Christoph Hellwig
2023-05-31  6:04 ` [PATCH 02/16] btrfs: factor out a btrfs_verify_page helper Christoph Hellwig
2023-05-31  6:04 ` [PATCH 03/16] btrfs: fix fsverify read error handling in end_page_read Christoph Hellwig
2023-05-31  6:04 ` [PATCH 04/16] btrfs: don't check PageError in btrfs_verify_page Christoph Hellwig
2023-05-31  6:04 ` [PATCH 05/16] btrfs: don't fail writeback when allocating the compression context fails Christoph Hellwig
2023-05-31  6:04 ` [PATCH 06/16] btrfs: rename cow_file_range_async to run_delalloc_compressed Christoph Hellwig
2023-05-31  6:04 ` [PATCH 07/16] btrfs: don't check PageError in __extent_writepage Christoph Hellwig
2023-05-31  6:04 ` [PATCH 08/16] btrfs: stop setting PageError in the data I/O path Christoph Hellwig
2023-05-31  6:04 ` Christoph Hellwig [this message]
2023-05-31  6:04 ` [PATCH 10/16] btrfs: remove non-standard extent handling in __extent_writepage_io Christoph Hellwig
2024-02-10  9:39   ` Qu Wenruo
2024-02-12 15:52     ` Christoph Hellwig
2024-02-12 23:06       ` Qu Wenruo
2023-05-31  6:05 ` [PATCH 11/16] btrfs: move nr_to_write to __extent_writepage Christoph Hellwig
2023-05-31  6:05 ` [PATCH 12/16] btrfs: only call __extent_writepage_io from extent_write_locked_range Christoph Hellwig
2023-05-31  6:05 ` [PATCH 13/16] btrfs: don't treat zoned writeback as being from an async helper thread Christoph Hellwig
2023-05-31  6:05 ` [PATCH 14/16] btrfs: don't redirty the locked page for extent_write_locked_range Christoph Hellwig
2023-06-05 21:00   ` David Sterba
2023-05-31  6:05 ` [PATCH 15/16] btrfs: refactor the zoned device handling in cow_file_range Christoph Hellwig
2023-06-06 14:20   ` Naohiro Aota
2023-06-07  7:27     ` Christoph Hellwig
2023-05-31  6:05 ` [PATCH 16/16] btrfs: split page locking out of __process_pages_contig Christoph Hellwig
2023-05-31 16:39 ` writeback fixlets and tidyups v2 Josef Bacik
2023-06-05 21:01 ` David Sterba
2023-06-06  6:24   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2023-05-23  8:13 writeback fixlets and tidyups Christoph Hellwig
2023-05-23  8:13 ` [PATCH 09/16] btrfs: remove PAGE_SET_ERROR Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531060505.468704-10-hch@lst.de \
    --to=hch@lst.de \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).