diff mbox series

[RFC,09/31] btrfs: Don't process pages if locked_page is NULL

Message ID 4d69749390822e1241158412dd5c94d70dfab7a0.1623567940.git.rgoldwyn@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs buffered iomap support | expand

Commit Message

Goldwyn Rodrigues June 13, 2021, 1:39 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

This is an ugly hack so we don't process pages since all page processing
is performed in iomap.

Ideally, we would want to change this to remove locked_page argument
from the run_delalloc_range()->cow_file_range() calls.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/btrfs/extent_io.c | 3 +++
 fs/btrfs/inode.c     | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 75ad809e8c86..71a59fbeffe1 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2101,6 +2101,9 @@  void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
 {
 	clear_extent_bit(&inode->io_tree, start, end, clear_bits, 1, 0, NULL);
 
+	if (!locked_page)
+		return;
+
 	__process_pages_contig(inode->vfs_inode.i_mapping, locked_page,
 			       start, end, page_ops, NULL);
 }
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7761a60788d0..5491d0e5600f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1112,7 +1112,8 @@  static noinline int cow_file_range(struct btrfs_inode *inode,
 			 * can't use page_started to determine if it's an
 			 * inline extent or a compressed extent.
 			 */
-			unlock_page(locked_page);
+			if (locked_page)
+				unlock_page(locked_page);
 			goto out;
 		} else if (ret < 0) {
 			goto out_unlock;