Skip to contentSkip to conversation

xfs_spaceman: XFS_IOC_FIEMAPFS ioctl replacing previous FS_IOC_FIEMAPFS

PATCH New Dhruvesh Rathore 1 participant 1 message Jan 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 xfs_spaceman: XFS_IOC_FIEMAPFS ioctl replacing previous FS_IOC_FIEMAPFS

The original kernel patch that Dave wrote for xfs_spaceman implemented FS_IOC_FIEMAPFS ioctl, here is the original fiemap extension patch:

http://oss.sgi.com/archives/xfs/2012-10/msg00363.html

These patches were not posted and were just forward ported to a current 3.18-rc7+ for-next XFS tree and were pushed to the fiemapfs branch in Dave's kernel tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git

The original xfs_spaceman tool that Dave wrote to call the fiemap interface and make use of it is here:

http://oss.sgi.com/archives/xfs/2012-10/msg00366.html

Dave just updated it to the 3.2.2 code base and pushed it to the spaceman branch in this tree:

git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git

This patch is concerned with turning FS_IOC_FIEMAPFS, present in the earlier version of xfs_spaceman into an XFS specific ioctl called XFS_IOC_FIEMAPFS that uses the fiemap plumbing. Please do comment.

Signed-off-by:
Dhruvesh Rathore <[email protected]>
Amey Ruikar <[email protected]>
Somdeep Dey <[email protected]>
---
linux-xfs/fs/xfs/xfs_fs.h | 1 +
linux-xfs/fs/xfs/xfs_ioctl.c | 71 ++++-
xfsprogs-3.2.2/include/xfs_fs.h | 1 +
xfsprogs-3.2.2/spaceman/freesp.c | 10 ++++++---

4 files changed, 79 insertions(+), 4 deletions(-) 

---------------------------------------------------------------------------------------

linux-xfs/fs/xfs/xfs_fs.h +1 -0
@@ -505,6 +505,7 @@
 #define XFS_IOC_DIOINFO	_IOR ('X', 30, struct dioattr)
 #define XFS_IOC_FSGETXATTR	_IOR ('X', 31, struct fsxattr)
 #define XFS_IOC_FSSETXATTR	_IOW ('X', 32, struct fsxattr)
+#define XFS_IOC_FIEMAPFS	_IOWR('X', 33, struct fiemap)
 #define XFS_IOC_ALLOCSP64	_IOW ('X', 36, struct xfs_flock64)
 #define XFS_IOC_FREESP64	_IOW ('X', 37, struct xfs_flock64)
 #define XFS_IOC_GETBMAP	_IOWR('X', 38, struct getbmap)

----------------------------------------------------------------------------------------

linux-xfs/fs/xfs/xfs_ioctl.c +70 -1

91 lines not on this page · raw message

--------------------------------------------------------------------------------------------

xfsprogs-3.2.2/include/xfs_fs.h +1 -0
@@ -505,6 +505,7 @@
 #define XFS_IOC_DIOINFO	_IOR ('X', 30, struct dioattr)
 #define XFS_IOC_FSGETXATTR	_IOR ('X', 31, struct fsxattr)
 #define XFS_IOC_FSSETXATTR	_IOW ('X', 32, struct fsxattr)
+#define XFS_IOC_FIEMAPFS	_IOWR('X', 33, struct fiemap)
 #define XFS_IOC_ALLOCSP64	_IOW ('X', 36, struct xfs_flock64)
 #define XFS_IOC_FREESP64	_IOW ('X', 37, struct xfs_flock64)
 #define XFS_IOC_GETBMAP	_IOWR('X', 38, struct getbmap)

--------------------------------------------------------------------------------------------

xfsprogs-3.2.2/spaceman/freesp.c +7 -3
@@ -31,7 +31,7 @@
 #define FIEMAPFS_FLAG_FREESP_SIZE_HINT	0x20000000
 #define	FIEMAPFS_FLAG_FREESP_CONTINUE   0x10000000
 
-#define FS_IOC_FIEMAPFS			_IOWR('f', 12, struct fiemap)
+#define XFS_IOC_FIEMAPFS			_IOWR('X', 33, struct fiemap)
 #endif
 
 typedef struct histent
@@ -201,9 +201,9 @@
 		fiemap->fm_length = length;
 		fiemap->fm_extent_count = NR_EXTENTS;
 
-		ret = ioctl(file->fd, XFS_IOC_FIEMAPFS, (unsigned long)fiemap);
+		ret = xfsctl(file->name,file->fd, XFS_IOC_FIEMAPFS, (unsigned long)fiemap);
 		if (ret < 0) {	
-			fprintf(stderr, "%s: ioctl(FS_IOC_FIEMAPFS) [\"%s\"]: "	
+			fprintf(stderr, "%s: xfsctl(XFS_IOC_FIEMAPFS) [\"%s\"]: "	
 				"%s\n", progname, file->name, strerror(errno));
 			free(fiemap);
 			exitcode = 1;
@@ -338,6 +338,10 @@
 
 	if (!init(argc, argv))
 		return 0;
+
+	if (dumpflag)
+		printf("%8s %8s %8s\n", "agno", "agbno", "len");	
+
 	for (agno = 0; agno < file->geom.agcount; agno++)  {
 		if (inaglist(agno))
 			scan_ag(agno);

----------------------------------------------------------------------------------------------

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs