diff options
author | Ritesh Harjani (IBM) <ritesh.list@gmail.com> | 2025-05-19 21:19:30 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2025-05-20 21:21:00 +0300 |
commit | 7acd1b315cdcc03b11a3aa1f9c9c85d99ddb4f0e (patch) | |
tree | 448d000ac34380808999476540f77b83cbdf35c9 /fs/ext4 | |
parent | 618320daa9673ce2b6adae5ad6fbf16e878ff6c9 (diff) | |
download | linux-7acd1b315cdcc03b11a3aa1f9c9c85d99ddb4f0e.tar.xz |
ext4: Add a WARN_ON_ONCE for querying LAST_IN_LEAF instead
We added the documentation in ext4_map_blocks() for usage of
EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF flag. But It's better to add
a WARN_ON_ONCE in case if anyone tries using this flag with CREATE to
avoid a random issue later. Since depth can change with CREATE and it
needs to be re-calculated before using it in there.
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://patch.msgid.link/ee6e82a224c50b432df9ce1ce3333c50182d8473.1747677758.git.ritesh.list@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/extents.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c1de66c23dd2..b543a46fc809 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4445,9 +4445,11 @@ out: * need to re-calculate the depth as it might have changed due to block * allocation. */ - if (flags & EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF) + if (flags & EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF) { + WARN_ON_ONCE(flags & EXT4_GET_BLOCKS_CREATE); if (!err && ex && (ex == EXT_LAST_EXTENT(path[depth].p_hdr))) map->m_flags |= EXT4_MAP_QUERY_LAST_IN_LEAF; + } ext4_free_ext_path(path); |