Skip to contentSkip to conversation

ext4: rework reserved cluster accounting when invalidating pages

PATCH Applied Eric Whitney 2 participants 2 messages Aug 17, 2019 – Aug 24, 2019 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: rework reserved cluster accounting when invalidating pages

The goal of this patch is to remove two references to the buffer delay bit in ext4_da_page_release_reservation() as part of a larger effort to remove all such references from ext4. These two references are principally used to reduce the reserved block/cluster count when pages are invalidated as a result of truncating, punching holes, or collapsing a block range in a file. The entire function is removed and replaced with code in ext4_es_remove_extent() that reduces the reserved count as a side effect of removing a block range from delayed and not unwritten extents in the extent status tree as is done when truncating, punching holes, or collapsing ranges.

The code is written to minimize the number of searches descending from rb tree roots for scalability.

---
 fs/ext4/ext4.h           |   3 +
 fs/ext4/extents_status.c | 446 ++++++++++++++++++++++++++++++++++++-----------
 fs/ext4/extents_status.h |   2 -
 fs/ext4/inode.c          |  63 +------
 4 files changed, 353 insertions(+), 161 deletions(-)
fs/ext4/ext4.h +3 -0
index bf660aa7a9e0..74cfd28d8561 100644
@@ -284,6 +284,9 @@ struct ext4_io_submit {
 				  ~((ext4_fsblk_t) (s)->s_cluster_ratio - 1))
 #define EXT4_LBLK_CMASK(s, lblk) ((lblk) &				\
 				  ~((ext4_lblk_t) (s)->s_cluster_ratio - 1))
+/* Fill in the low bits to get the last block of the cluster */
+#define EXT4_LBLK_CFILL(sbi, lblk) ((lblk) |				\
+				    ((ext4_lblk_t) (sbi)->s_cluster_ratio - 1))
 /* Get the cluster offset */
 #define EXT4_PBLK_COFF(s, pblk) ((pblk) &				\
 				 ((ext4_fsblk_t) (s)->s_cluster_ratio - 1))
fs/ext4/extents_status.c +349 -97

543 lines not on this page · raw message

fs/ext4/extents_status.h +0 -2
index 131a8b7df265..93a7abfff4af 100644
@@ -246,7 +246,5 @@ extern int ext4_es_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk,
 					bool allocated);
 extern unsigned int ext4_es_delayed_clu(struct inode *inode, ext4_lblk_t lblk,
 					ext4_lblk_t len);
-extern void ext4_es_remove_blks(struct inode *inode, ext4_lblk_t lblk,
-				ext4_lblk_t len);
 
 #endif /* _EXT4_EXTENTS_STATUS_H */
fs/ext4/inode.c +1 -62

81 lines not on this page · raw message

Signature · 1 line
2.11.0
maintainer Applied
#1 lore raw
Quoted 11 lines · Eric Whitney

The goal of this patch is to remove two references to the buffer delay bit in ext4_da_page_release_reservation() as part of a larger effort to remove all such references from ext4. These two references are principally used to reduce the reserved block/cluster count when pages are invalidated as a result of truncating, punching holes, or collapsing a block range in a file. The entire function is removed and replaced with code in ext4_es_remove_extent() that reduces the reserved count as a side effect of removing a block range from delayed and not unwritten extents in the extent status tree as is done when truncating, punching holes, or collapsing ranges.

Quoted 4 lines

The code is written to minimize the number of searches descending from rb tree roots for scalability.

Thanks, applied.

- Ted