Skip to content

Commit 8bad459

Browse files
committed
ext4: Use unsigned int for blocksize in dx_make_map() and dx_pack_dirents()
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent e187c65 commit 8bad459

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/ext4/namei.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ static struct dx_frame *dx_probe(const struct qstr *d_name,
161161
struct dx_frame *frame,
162162
int *err);
163163
static void dx_release(struct dx_frame *frames);
164-
static int dx_make_map(struct ext4_dir_entry_2 *de, int size,
164+
static int dx_make_map(struct ext4_dir_entry_2 *de, unsigned blocksize,
165165
struct dx_hash_info *hinfo, struct dx_map_entry map[]);
166166
static void dx_sort_map(struct dx_map_entry *map, unsigned count);
167167
static struct ext4_dir_entry_2 *dx_move_dirents(char *from, char *to,
168168
struct dx_map_entry *offsets, int count);
169-
static struct ext4_dir_entry_2* dx_pack_dirents(char *base, int size);
169+
static struct ext4_dir_entry_2* dx_pack_dirents(char *base, unsigned blocksize);
170170
static void dx_insert_block(struct dx_frame *frame,
171171
u32 hash, ext4_lblk_t block);
172172
static int ext4_htree_next_block(struct inode *dir, __u32 hash,
@@ -713,15 +713,15 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
713713
* Create map of hash values, offsets, and sizes, stored at end of block.
714714
* Returns number of entries mapped.
715715
*/
716-
static int dx_make_map (struct ext4_dir_entry_2 *de, int size,
717-
struct dx_hash_info *hinfo, struct dx_map_entry *map_tail)
716+
static int dx_make_map(struct ext4_dir_entry_2 *de, unsigned blocksize,
717+
struct dx_hash_info *hinfo,
718+
struct dx_map_entry *map_tail)
718719
{
719720
int count = 0;
720721
char *base = (char *) de;
721722
struct dx_hash_info h = *hinfo;
722723

723-
while ((char *) de < base + size)
724-
{
724+
while ((char *) de < base + blocksize) {
725725
if (de->name_len && de->inode) {
726726
ext4fs_dirhash(de->name, de->name_len, &h);
727727
map_tail--;
@@ -1130,13 +1130,13 @@ dx_move_dirents(char *from, char *to, struct dx_map_entry *map, int count)
11301130
* Compact each dir entry in the range to the minimal rec_len.
11311131
* Returns pointer to last entry in range.
11321132
*/
1133-
static struct ext4_dir_entry_2* dx_pack_dirents(char *base, int size)
1133+
static struct ext4_dir_entry_2* dx_pack_dirents(char *base, unsigned blocksize)
11341134
{
11351135
struct ext4_dir_entry_2 *next, *to, *prev, *de = (struct ext4_dir_entry_2 *) base;
11361136
unsigned rec_len = 0;
11371137

11381138
prev = to = de;
1139-
while ((char*)de < base + size) {
1139+
while ((char*)de < base + blocksize) {
11401140
next = ext4_next_entry(de);
11411141
if (de->inode && de->name_len) {
11421142
rec_len = EXT4_DIR_REC_LEN(de->name_len);

0 commit comments

Comments
 (0)