]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
jbd2: add jinode dirty range accessors
authorLi Chen <me@linux.beauty>
Fri, 6 Mar 2026 08:56:39 +0000 (16:56 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 9 Apr 2026 14:51:05 +0000 (10:51 -0400)
Provide a helper to fetch jinode dirty ranges in bytes. This lets
filesystem callbacks avoid depending on the internal representation,
preparing for a later conversion to page units.

Suggested-by: Andreas Dilger <adilger@dilger.ca>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Li Chen <me@linux.beauty>
Link: https://patch.msgid.link/20260306085643.465275-2-me@linux.beauty
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
include/linux/jbd2.h

index a53a00d36228ce281e31f94fddb50246da62bb32..64392baf5f4b4f0c319bcf816e4be2482bc5d810 100644 (file)
@@ -445,6 +445,20 @@ struct jbd2_inode {
        loff_t i_dirty_end;
 };
 
+static inline bool jbd2_jinode_get_dirty_range(const struct jbd2_inode *jinode,
+                                              loff_t *start, loff_t *end)
+{
+       loff_t start_byte = jinode->i_dirty_start;
+       loff_t end_byte = jinode->i_dirty_end;
+
+       if (!end_byte)
+               return false;
+
+       *start = start_byte;
+       *end = end_byte;
+       return true;
+}
+
 struct jbd2_revoke_table_s;
 
 /**