Skip to contentSkip to conversation

btrfs: merge btrfs_folio_unlock_writer() into btrfs_folio_end_writer_lock()

PATCH In review Qu Wenruo 2 participants 2 messages Sep 2, 2024 – Sep 4, 2024 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs: merge btrfs_folio_unlock_writer() into btrfs_folio_end_writer_lock()

The function btrfs_folio_unlock_writer() is already calling btrfs_folio_end_writer_lock() to do the heavy lifting work, the only missing 0 writer check.

Thus there is no need to keep two different functions, move the 0 writer check into btrfs_folio_end_writer_lock(), and remove btrfs_folio_unlock_writer().

---
 fs/btrfs/extent_io.c |  2 +-
 fs/btrfs/subpage.c   | 81 +++++++++++++++++++-------------------------
 fs/btrfs/subpage.h   |  2 --
 3 files changed, 35 insertions(+), 50 deletions(-)
fs/btrfs/extent_io.c +1 -1
index 485d88f9947b..70be1150c34e 100644
@@ -2220,7 +2220,7 @@ void extent_write_locked_range(struct inode *inode, const struct folio *locked_f
 						       cur, cur_len, !ret);
 			mapping_set_error(mapping, ret);
 		}
-		btrfs_folio_unlock_writer(fs_info, folio, cur, cur_len);
+		btrfs_folio_end_writer_lock(fs_info, folio, cur, cur_len);
 		if (ret < 0)
 			found_error = true;
 next_page:
fs/btrfs/subpage.c +34 -47

100 lines not on this page · raw message

fs/btrfs/subpage.h +0 -2
index f90e0c4f4cab..f805261e0999 100644
@@ -155,8 +155,6 @@ bool btrfs_subpage_clear_and_test_dirty(const struct btrfs_fs_info *fs_info,
 
 void btrfs_folio_assert_not_dirty(const struct btrfs_fs_info *fs_info,
 				  struct folio *folio, u64 start, u32 len);
-void btrfs_folio_unlock_writer(struct btrfs_fs_info *fs_info,
-			       struct folio *folio, u64 start, u32 len);
 void btrfs_get_subpage_dirty_bitmap(struct btrfs_fs_info *fs_info,
 				    struct folio *folio,
 				    unsigned long *ret_bitmap);
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Qu Wenruo

The function btrfs_folio_unlock_writer() is already calling btrfs_folio_end_writer_lock() to do the heavy lifting work, the only missing 0 writer check.

Thus there is no need to keep two different functions, move the 0 writer check into btrfs_folio_end_writer_lock(), and remove btrfs_folio_unlock_writer().