Skip to content

Commit afa6d5a

Browse files
LiBaokun96tytso
authored andcommitted
ext4: remove PAGE_SIZE checks for rec_len conversion
Previously, ext4_rec_len_(to|from)_disk only performed complex rec_len conversions when PAGE_SIZE >= 65536 to reduce complexity. However, we are soon to support file system block sizes greater than page size, which makes these conditional checks unnecessary. Thus, these checks are now removed. Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Message-ID: <20251121090654.631996-4-libaokun@huaweicloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent b73f45a commit afa6d5a

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

fs/ext4/ext4.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,28 +2484,19 @@ static inline unsigned int ext4_dir_rec_len(__u8 name_len,
24842484
return (rec_len & ~EXT4_DIR_ROUND);
24852485
}
24862486

2487-
/*
2488-
* If we ever get support for fs block sizes > page_size, we'll need
2489-
* to remove the #if statements in the next two functions...
2490-
*/
24912487
static inline unsigned int
24922488
ext4_rec_len_from_disk(__le16 dlen, unsigned blocksize)
24932489
{
24942490
unsigned len = le16_to_cpu(dlen);
24952491

2496-
#if (PAGE_SIZE >= 65536)
24972492
if (len == EXT4_MAX_REC_LEN || len == 0)
24982493
return blocksize;
24992494
return (len & 65532) | ((len & 3) << 16);
2500-
#else
2501-
return len;
2502-
#endif
25032495
}
25042496

25052497
static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
25062498
{
25072499
BUG_ON((len > blocksize) || (blocksize > (1 << 18)) || (len & 3));
2508-
#if (PAGE_SIZE >= 65536)
25092500
if (len < 65536)
25102501
return cpu_to_le16(len);
25112502
if (len == blocksize) {
@@ -2515,9 +2506,6 @@ static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
25152506
return cpu_to_le16(0);
25162507
}
25172508
return cpu_to_le16((len & 65532) | ((len >> 16) & 3));
2518-
#else
2519-
return cpu_to_le16(len);
2520-
#endif
25212509
}
25222510

25232511
/*

0 commit comments

Comments
 (0)