Skip to content

Commit 0a80e98

Browse files
Eric Sandeentytso
authored andcommitted
ext4: replace MAX_DEFRAG_SIZE with EXT_MAX_BLOCK
There's no reason to redefine the maximum allowable offset in an extent-based file just for defrag; EXT_MAX_BLOCK already does this. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent 5534fb5 commit 0a80e98

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

fs/ext4/ext4.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ struct move_extent {
476476
__u64 len; /* block length to be moved */
477477
__u64 moved_len; /* moved block length */
478478
};
479-
#define MAX_DEFRAG_SIZE ((1UL<<31) - 1)
480479

481480
#define EXT4_EPOCH_BITS 2
482481
#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)

fs/ext4/ext4_extents.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
137137
#define EXT_BREAK 1
138138
#define EXT_REPEAT 2
139139

140+
/* Maximum logical block in a file; ext4_extent's ee_block is __le32 */
140141
#define EXT_MAX_BLOCK 0xffffffff
141142

142143
/*

fs/ext4/move_extent.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,12 +1040,12 @@ mext_check_arguments(struct inode *orig_inode,
10401040
return -EINVAL;
10411041
}
10421042

1043-
if ((orig_start > MAX_DEFRAG_SIZE) ||
1044-
(donor_start > MAX_DEFRAG_SIZE) ||
1045-
(*len > MAX_DEFRAG_SIZE) ||
1046-
(orig_start + *len > MAX_DEFRAG_SIZE)) {
1047-
ext4_debug("ext4 move extent: Can't handle over [%lu] blocks "
1048-
"[ino:orig %lu, donor %lu]\n", MAX_DEFRAG_SIZE,
1043+
if ((orig_start > EXT_MAX_BLOCK) ||
1044+
(donor_start > EXT_MAX_BLOCK) ||
1045+
(*len > EXT_MAX_BLOCK) ||
1046+
(orig_start + *len > EXT_MAX_BLOCK)) {
1047+
ext4_debug("ext4 move extent: Can't handle over [%u] blocks "
1048+
"[ino:orig %lu, donor %lu]\n", EXT_MAX_BLOCK,
10491049
orig_inode->i_ino, donor_inode->i_ino);
10501050
return -EINVAL;
10511051
}

0 commit comments

Comments
 (0)