xfs: Add shrink data ioctl(2)
PATCH 14/15 xfs: Add shrink data ioctl(2)
So the real FS data section shrink function via ioctl(2) is here.
Signed-off-by Jie Liu <[email protected]>
--- fs/xfs/xfs_fs.h | 8 ++ fs/xfs/xfs_fsops.c | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_fsops.h | 1 + fs/xfs/xfs_ioctl.c | 15 ++++ 4 files changed, 234 insertions(+), 2 deletions(-)
fs/xfs/xfs_fs.h +8 -0
@@ -272,6 +272,13 @@ typedef struct xfs_growfs_rt {__u32 extsize;/* new realtime extent size, fsblocks */ } xfs_growfs_rt_t; +/* +* Structure for XFS_IOC_SHRINKFS_DATA. +*/ +typedef struct xfs_shrinkfs_data { +__u64 newblocks;/* new data subvol size, fsblocks */ +__u32 imaxpct;/* new inode space percentage limit */ +}xfs_shrinkfs_data_t ;/* * Structures returned from ioctl XFS_IOC_FSBULKSTAT & XFS_IOC_FSBULKSTAT_SINGLE
@@ -489,6 +496,7 @@ typedef struct xfs_handle {#define XFS_IOC_SET_AGSTATE _IOW('X', 126, struct xfs_ioc_agstate)#define XFS_IOC_GET_AGSTATE _IOR('X', 127, struct xfs_ioc_agstate)#define XFS_IOC_SWAPINO _IOWR('X', 128, struct xfs_swapino) +#define XFS_IOC_FSSHRINKFS_DATA _IOW('X', 129, struct xfs_shrinkfs_data)/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
fs/xfs/xfs_fsops.c +210 -2
224 lines not on this page · raw message
fs/xfs/xfs_fsops.h +1 -0
@@ -26,5 +26,6 @@ extern int xfs_reserve_blocks(xfs_mount_t *mp, __uint64_t *inval, xfs_fsop_resblks_t *outval);extern int xfs_fs_goingdown (xfs_mount_t *mp,__uint32_t inflags);extern int xfs_fs_log_dummy (struct xfs_mount *mp); +extern int xfs_shrinkfs_data (xfs_mount_t *mp,xfs_shrinkfs_data_t *in);#endif /* __XFS_FSOPS_H__ */
fs/xfs/xfs_ioctl.c +15 -0
@@ -1649,6 +1649,21 @@ xfs_file_ioctl(return -error; } +case XFS_IOC_FSSHRINKFS_DATA : { +xfs_shrinkfs_data_t in; + +if (copy_from_user (&in, arg,sizeof (in))) +return -XFS_ERROR (EFAULT ); + + error =mnt_want_write_file (filp); +if (error) +return error; + + error =xfs_shrinkfs_data (mp, &in); +mnt_drop_write_file (filp); +return -error; + } +default :return -ENOTTY ; }
Signature · 6 lines
1.7.4.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs