[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241219110027.1440876-7-shikemeng@huaweicloud.com>
Date: Thu, 19 Dec 2024 19:00:27 +0800
From: Kemeng Shi <shikemeng@...weicloud.com>
To: tytso@....edu,
adilger.kernel@...ger.ca
Cc: linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 6/6] ext4: calculate rec_len of ".." with correct name length 2
The rec_len of directory ".." should be ext4_dir_rec_len(2, NULL) instead
of ext4_dir_rec_len(1, NULL). Although ext4_dir_rec_len return the same
number either with name_len 1 or name_len 2, it's better use the right
name_len to make code more intuitive.
Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
---
fs/ext4/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index aee1858e6482..24cdeb2aa0d5 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2925,7 +2925,7 @@ struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode,
de->name_len = 2;
if (!dotdot_real_len)
de->rec_len = ext4_rec_len_to_disk(blocksize -
- (csum_size + ext4_dir_rec_len(1, NULL)),
+ (csum_size + ext4_dir_rec_len(2, NULL)),
blocksize);
else
de->rec_len = ext4_rec_len_to_disk(
--
2.30.0
Powered by blists - more mailing lists