Message ID | b2edd7710f07d94101a6055e398a5e4ed01f09bf.1587555962.git.riteshh@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | ext4/overlayfs: fiemap related fixes | expand |
On Thu 23-04-20 16:17:57, Ritesh Harjani wrote: > Now that fiemap_check_ranges() is available for other filesystems > to use, so get rid of ext4's private version. > > Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com> Nice. You can add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/ext4/ioctl.c | 25 +------------------------ > 1 file changed, 1 insertion(+), 24 deletions(-) > > diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c > index 76a2b5200ba3..6a7d7e9027cd 100644 > --- a/fs/ext4/ioctl.c > +++ b/fs/ext4/ioctl.c > @@ -733,29 +733,6 @@ static void ext4_fill_fsxattr(struct inode *inode, struct fsxattr *fa) > fa->fsx_projid = from_kprojid(&init_user_ns, ei->i_projid); > } > > -/* copied from fs/ioctl.c */ > -static int ext4_fiemap_check_ranges(struct super_block *sb, > - u64 start, u64 len, u64 *new_len) > -{ > - u64 maxbytes = (u64) sb->s_maxbytes; > - > - *new_len = len; > - > - if (len == 0) > - return -EINVAL; > - > - if (start > maxbytes) > - return -EFBIG; > - > - /* > - * Shrink request scope to what the fs can actually handle. > - */ > - if (len > maxbytes || (maxbytes - len) < start) > - *new_len = maxbytes - start; > - > - return 0; > -} > - > /* So that the fiemap access checks can't overflow on 32 bit machines. */ > #define FIEMAP_MAX_EXTENTS (UINT_MAX / sizeof(struct fiemap_extent)) > > @@ -775,7 +752,7 @@ static int ext4_ioctl_get_es_cache(struct file *filp, unsigned long arg) > if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS) > return -EINVAL; > > - error = ext4_fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length, > + error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length, > &len); > if (error) > return error; > -- > 2.21.0 >
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 76a2b5200ba3..6a7d7e9027cd 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -733,29 +733,6 @@ static void ext4_fill_fsxattr(struct inode *inode, struct fsxattr *fa) fa->fsx_projid = from_kprojid(&init_user_ns, ei->i_projid); } -/* copied from fs/ioctl.c */ -static int ext4_fiemap_check_ranges(struct super_block *sb, - u64 start, u64 len, u64 *new_len) -{ - u64 maxbytes = (u64) sb->s_maxbytes; - - *new_len = len; - - if (len == 0) - return -EINVAL; - - if (start > maxbytes) - return -EFBIG; - - /* - * Shrink request scope to what the fs can actually handle. - */ - if (len > maxbytes || (maxbytes - len) < start) - *new_len = maxbytes - start; - - return 0; -} - /* So that the fiemap access checks can't overflow on 32 bit machines. */ #define FIEMAP_MAX_EXTENTS (UINT_MAX / sizeof(struct fiemap_extent)) @@ -775,7 +752,7 @@ static int ext4_ioctl_get_es_cache(struct file *filp, unsigned long arg) if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS) return -EINVAL; - error = ext4_fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length, + error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length, &len); if (error) return error;
Now that fiemap_check_ranges() is available for other filesystems to use, so get rid of ext4's private version. Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com> --- fs/ext4/ioctl.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)