xfsprogs: xfs_shrinkfs(8)
PATCH 2/2 xfsprogs: xfs_shrinkfs(8)
xfs_shrinkfs(8) for xfsprogs.
This version does not really works for data moving, it only would be used for reflect my current thoughts for implementing this utility.
Signed-off-by Jie Liu <[email protected]>
--- Makefile | 3 +- include/xfs_dfrag.h | 20 + include/xfs_fs.h | 6 + shrinkfs/Makefile | 30 ++ shrinkfs/xfs_shrink.c | 1184 ++++++++++++++++++++++++++++++++++++++++++++++ shrinkfs/xfs_shrinkfs.sh | 99 ++++ 6 files changed, 1341 insertions(+), 1 deletion(-) create mode 100644 shrinkfs/Makefile create mode 100644 shrinkfs/xfs_shrink.c create mode 100755 shrinkfs/xfs_shrinkfs.sh
Makefile +2 -1
@@ -41,7 +41,7 @@ endif LIB_SUBDIRS = libxfs libxlog libxcmd libhandle libdisk TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \ - mdrestore repair rtcp m4 man doc po debian + mdrestore repair rtcp m4 man doc po debian shrinkfs SUBDIRS = include $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
@@ -62,6 +62,7 @@ io: libxcmd libhandle mkfs: libxfs quota: libxcmd repair: libxfs libxlog +shrinkfs: libxfs libxcmd ifneq ($(ENABLE_BLKID), yes) mkfs: libdisk
include/xfs_dfrag.h +20 -0
@@ -38,6 +38,21 @@ typedef struct xfs_swapext*/ #define XFS_SX_VERSION 0 +/* +* Structure passed to xfs_swapino. +*/ +typedef struct xfs_swapino { +__int64_t si_version;/* version */ +__int64_t si_fdtarget;/* fd of target file */ +__int64_t si_fdtmp;/* fd of temp file */ +char si_pad[16 ];/* pad space, unused */ +}xfs_swapino_t ; + +/* +* Version flag. +*/ +#define XFS_SI_VERSION 0 +#ifdef __KERNEL__/* * Prototypes for visible xfs_dfrag.c routines.
@@ -48,6 +63,11 @@ typedef struct xfs_swapext*/ int xfs_swapext (struct xfs_swapext *sx); +/* +* Syscall interface for xfs_swapino +*/ +int xfs_swapino (struct xfs_swapino *si); +#endif /* __KERNEL__ */ #endif /* __XFS_DFRAG_H__ */
include/xfs_fs.h +6 -0
@@ -267,6 +267,10 @@ typedef struct xfs_growfs_rt {__u32 extsize;/* new realtime extent size, fsblocks */ } xfs_growfs_rt_t; +typedef struct xfs_shrinkfs_data { +__u64 newblocks; +__u32 imaxpct; +}xfs_shrinkfs_data_t ;/* * Structures returned from ioctl XFS_IOC_FSBULKSTAT & XFS_IOC_FSBULKSTAT_SINGLE
@@ -485,6 +489,8 @@ typedef struct xfs_handle {#define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t)#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 */
shrinkfs/Makefile new file +30 -0
@@ -0,0 +1,30 @@ +TOPDIR = .. +include $(TOPDIR)/include/builddefs + +LTCOMMAND = xfs_shrink + +CFILES = xfs_shrink.c + +LLDLIBS = $(LIBXFS) $(LIBXCMD) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) +ifeq ($(ENABLE_READLINE),yes) +LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP) +endif + +ifeq ($(ENABLE_EDITLINE),yes) +LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP) +endif + +LTDEPENDENCIES = $(LIBXFS) $(LIBXCMD) +LLDFLAGS = -static + +default: depend $(LTCOMMAND) + +include $(BUILDRULES) + +install: default + $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) + $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR) + $(INSTALL) -m 755 xfs_shrinkfs.sh $(PKG_SBIN_DIR)/xfs_shrinkfs +install-dev: + +-include .dep
shrinkfs/xfs_shrink.c new file +1184 -0
1,184 lines not on this page · raw message
shrinkfs/xfs_shrinkfs.sh new file +99 -0
99 lines not on this page · raw message
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs