public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] xfsprogs: v4 inode type in directory
@ 2013-09-19 21:05 Mark Tinguely
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Tinguely @ 2013-09-19 21:05 UTC (permalink / raw)
  To: xfs

Here are the patches that enable the inode in the directory
feature in v4 superblocks.

 patch 1: add the entries to xfs_sb.h (sync with kernel)
 patch 2: add the XFS_FSOP_GEOM_FLAGS_FTYPE to xfs_fs.h (sync with kernel)
	  add the entry to repair so that xfs_info reports the feature
 patch 3: add the feature to mkfs.xfs and manual page.
          note: this new feature is ignored for superblock v5
		automatically turns on this feature.

--Mark.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/3] xfsprogs: v4 inode type in directory
@ 2013-10-16 22:36 Mark Tinguely
  2013-10-16 22:36 ` [PATCH 1/3] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Mark Tinguely @ 2013-10-16 22:36 UTC (permalink / raw)
  To: xfs

Here are the patches that enable the inode in the directory
feature in v4 superblocks.

 patch 1: add the entries to xfs_sb.h (sync with kernel)
 patch 2: add the XFS_FSOP_GEOM_FLAGS_FTYPE to xfs_fs.h (sync with kernel)
	  add the entry to repair so that xfs_info reports the feature
 patch 3: add the feature to mkfs.xfs and manual page.
          note: this new feature is ignored for superblock v5
		automatically turns on this feature.

--Mark.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] xfsprog: add xfs sb v4 support for dirent filetype field
  2013-10-16 22:36 [PATCH 0/3] xfsprogs: v4 inode type in directory Mark Tinguely
@ 2013-10-16 22:36 ` Mark Tinguely
  2013-10-16 22:36 ` [PATCH 2/3] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Tinguely @ 2013-10-16 22:36 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 1-3-xfsprog-add-xfs-sb-v4-support-for-dirent-filetype-field.patch --]
[-- Type: text/plain, Size: 2101 bytes --]

Add xfsprog superblock v4 support for the inode type information
in the xfs directory feature in xfs_sb.h.

This support adds a feature bit for version 4 superblocks and
leaves the original superblock 5 incompatibility bit.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
Same as the previous version. I did not change to:

	return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
	       (xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE) ||
		((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
		 (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE)));

because xfs_sb_has_incompat_feature is not valid in superblock v4

include/xfs_sb.h |   20 ++++++++++++--------
 include/xfs_sb.h |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Index: b/include/xfs_sb.h
===================================================================
--- a/include/xfs_sb.h
+++ b/include/xfs_sb.h
@@ -84,11 +84,13 @@ struct xfs_trans;
 #define XFS_SB_VERSION2_PARENTBIT	0x00000010	/* parent pointers */
 #define XFS_SB_VERSION2_PROJID32BIT	0x00000080	/* 32 bit project id */
 #define XFS_SB_VERSION2_CRCBIT		0x00000100	/* metadata CRCs */
+#define XFS_SB_VERSION2_FTYPE		0x00000200	/* inode type in dir */
 
 #define	XFS_SB_VERSION2_OKREALFBITS	\
 	(XFS_SB_VERSION2_LAZYSBCOUNTBIT	| \
 	 XFS_SB_VERSION2_ATTR2BIT	| \
-	 XFS_SB_VERSION2_PROJID32BIT)
+	 XFS_SB_VERSION2_PROJID32BIT	| \
+	 XFS_SB_VERSION2_FTYPE)
 #define	XFS_SB_VERSION2_OKSASHFBITS	\
 	(0)
 #define XFS_SB_VERSION2_OKREALBITS	\
@@ -631,8 +633,10 @@ static inline int xfs_sb_version_has_pqu
 
 static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp)
 {
-	return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
-		xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE);
+	return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
+		xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE)) ||
+	       (xfs_sb_version_hasmorebits(sbp) &&
+		 (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE));
 }
 
 /*


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] xfsprog: add dirent filetype information for xfs_info
  2013-10-16 22:36 [PATCH 0/3] xfsprogs: v4 inode type in directory Mark Tinguely
  2013-10-16 22:36 ` [PATCH 1/3] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-10-16 22:36 ` Mark Tinguely
  2013-10-16 22:36 ` [PATCH 3/3] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
  2013-10-16 23:54 ` [PATCH 0/3] xfsprogs: v4 inode type in directory Dave Chinner
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Tinguely @ 2013-10-16 22:36 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 2-3-xfsprog-add-dirent-filetype-information-for-xfs_info.patch --]
[-- Type: text/plain, Size: 3725 bytes --]

Make xfs_info aware of the directory inode type by using the
XFS_FSOP_GEOM_FLAGS_FTYPE set in the kernel.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
changed the display field to "ftype", same as the mkfs.xfs entry
that made it.

growfs/xfs_growfs.c |   14 +++++++++-----
 growfs/xfs_growfs.c |   14 +++++++++-----
 include/xfs_fs.h    |    3 ++-
 2 files changed, 11 insertions(+), 6 deletions(-)

Index: b/growfs/xfs_growfs.c
===================================================================
--- a/growfs/xfs_growfs.c
+++ b/growfs/xfs_growfs.c
@@ -55,7 +55,8 @@ report_info(
 	int		attrversion,
 	int		projid32bit,
 	int		crcs_enabled,
-	int		cimode)
+	int		cimode,
+	int		ftype_enabled)
 {
 	printf(_(
 	    "meta-data=%-22s isize=%-6u agcount=%u, agsize=%u blks\n"
@@ -63,7 +64,7 @@ report_info(
 	    "         =%-22s crc=%u\n"
 	    "data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
 	    "         =%-22s sunit=%-6u swidth=%u blks\n"
-	    "naming   =version %-14u bsize=%-6u ascii-ci=%d\n"
+	    "naming   =version %-14u bsize=%-6u ascii-ci=%d ftype=%d\n"
 	    "log      =%-22s bsize=%-6u blocks=%u, version=%u\n"
 	    "         =%-22s sectsz=%-5u sunit=%u blks, lazy-count=%u\n"
 	    "realtime =%-22s extsz=%-6u blocks=%llu, rtextents=%llu\n"),
@@ -74,7 +75,7 @@ report_info(
 		"", geo.blocksize, (unsigned long long)geo.datablocks,
 			geo.imaxpct,
 		"", geo.sunit, geo.swidth,
-  		dirversion, geo.dirblocksize, cimode,
+  		dirversion, geo.dirblocksize, cimode, ftype_enabled,
 		isint ? _("internal") : logname ? logname : _("external"),
 			geo.blocksize, geo.logblocks, logversion,
 		"", geo.logsectsize, geo.logsunit / geo.blocksize, lazycount,
@@ -121,6 +122,7 @@ main(int argc, char **argv)
 	libxfs_init_t		xi;	/* libxfs structure */
 	int			projid32bit;
 	int			crcs_enabled;
+	int			ftype_enabled = 0;
 
 	progname = basename(argv[0]);
 	setlocale(LC_ALL, "");
@@ -242,10 +244,12 @@ main(int argc, char **argv)
 	ci = geo.flags & XFS_FSOP_GEOM_FLAGS_DIRV2CI ? 1 : 0;
 	projid32bit = geo.flags & XFS_FSOP_GEOM_FLAGS_PROJID32 ? 1 : 0;
 	crcs_enabled = geo.flags & XFS_FSOP_GEOM_FLAGS_V5SB ? 1 : 0;
+	ftype_enabled = geo.flags & XFS_FSOP_GEOM_FLAGS_FTYPE ? 1 : 0;
 	if (nflag) {
 		report_info(geo, datadev, isint, logdev, rtdev,
 				lazycount, dirversion, logversion,
-				attrversion, projid32bit, crcs_enabled, ci);
+				attrversion, projid32bit, crcs_enabled, ci,
+				ftype_enabled);
 		exit(0);
 	}
 
@@ -282,7 +286,7 @@ main(int argc, char **argv)
 
 	report_info(geo, datadev, isint, logdev, rtdev,
 			lazycount, dirversion, logversion,
-			attrversion, projid32bit, crcs_enabled, ci);
+			attrversion, projid32bit, crcs_enabled, ci, ftype_enabled);
 
 	ddsize = xi.dsize;
 	dlsize = ( xi.logBBsize? xi.logBBsize :
Index: b/include/xfs_fs.h
===================================================================
--- a/include/xfs_fs.h
+++ b/include/xfs_fs.h
@@ -233,10 +233,11 @@ typedef struct xfs_fsop_resblks {
 #define XFS_FSOP_GEOM_FLAGS_LOGV2	0x0100	/* log format version 2	*/
 #define XFS_FSOP_GEOM_FLAGS_SECTOR	0x0200	/* sector sizes >1BB	*/
 #define XFS_FSOP_GEOM_FLAGS_ATTR2	0x0400	/* inline attributes rework */
-#define XFS_FSOP_GEOM_FLAGS_PROJID32	0x0800  /* 32-bit project IDs	*/
+#define XFS_FSOP_GEOM_FLAGS_PROJID32	0x0800	/* 32-bit project IDs	*/
 #define XFS_FSOP_GEOM_FLAGS_DIRV2CI	0x1000	/* ASCII only CI names	*/
 #define XFS_FSOP_GEOM_FLAGS_LAZYSB	0x4000	/* lazy superblock counters */
 #define XFS_FSOP_GEOM_FLAGS_V5SB	0x8000	/* version 5 superblock */
+#define XFS_FSOP_GEOM_FLAGS_FTYPE	0x10000	/* inode directory types */
 
 
 /*


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-16 22:36 [PATCH 0/3] xfsprogs: v4 inode type in directory Mark Tinguely
  2013-10-16 22:36 ` [PATCH 1/3] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
  2013-10-16 22:36 ` [PATCH 2/3] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
@ 2013-10-16 22:36 ` Mark Tinguely
  2013-10-16 23:50   ` Dave Chinner
  2013-10-16 23:54 ` [PATCH 0/3] xfsprogs: v4 inode type in directory Dave Chinner
  3 siblings, 1 reply; 8+ messages in thread
From: Mark Tinguely @ 2013-10-16 22:36 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 3-3-xfsprog-add-mkfs.xfs-sb-v4-support-for-dirent-filetype-field.patch --]
[-- Type: text/plain, Size: 6616 bytes --]

Add directory inode type feature to mkfs.xfs and its manual page.

In sb v4, "mkfs.xfs -n ftype=1" turns on the feature. The feature is
still automatically turned on for sb v5. Reject the "ftype=1" request
if used with the "crc=1" setting.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
updated the manual entry.
changed the variables in xfs_mkfs.c
call usage() if the crc and ftype are used together.
update the sb_features_incompat entry for sb v5 and feature bit for v4

man/man8/mkfs.xfs.8 |    7 +++++++
 man/man8/mkfs.xfs.8 |   15 +++++++++++++++
 mkfs/xfs_mkfs.c     |   42 +++++++++++++++++++++++++++++++-----------
 mkfs/xfs_mkfs.h     |    4 +++-
 3 files changed, 49 insertions(+), 12 deletions(-)

Index: b/man/man8/mkfs.xfs.8
===================================================================
--- a/man/man8/mkfs.xfs.8
+++ b/man/man8/mkfs.xfs.8
@@ -517,6 +517,21 @@ option enables ASCII only case-insensiti
 are stored in directories using the case they were created with.
 .IP
 Note: Version 1 directories are not supported.
+.TP
+.BI ftype= value
+This feature introduced in Linux 3.12 allows the inode type to
+be stored in the directory structure so that readdir(3) and getdents(2)
+do not need to look up the inode to determine the inode type.
+
+The
+.I value
+is either 0 or 1, with 1 signifiying that filetype information
+will be stored in the directory structure. The default value is 0.
+
+When CRCs are enabled via "mkfs.xfs -m crc=1", the ftype functionality is
+always enabled. This feature can not be turned off for such filesystem
+configurations.
+.IP
 .RE
 .TP
 .BI \-p " protofile"
Index: b/mkfs/xfs_mkfs.c
===================================================================
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -147,6 +147,8 @@ char	*nopts[] = {
 	"size",
 #define	N_VERSION	2
 	"version",
+#define	N_FTYPE		3
+	"ftype",
 	NULL,
 };
 
@@ -885,6 +887,7 @@ main(
 	char			*dfile;
 	int			dirblocklog;
 	int			dirblocksize;
+	int			dirftype;
 	int			dirversion;
 	char			*dsize;
 	int			dsu;
@@ -930,6 +933,7 @@ main(
 	int			nodsflag;
 	int			norsflag;
 	xfs_alloc_rec_t		*nrec;
+	int			nftype;
 	int			nsflag;
 	int			nvflag;
 	int			nci;
@@ -977,6 +981,7 @@ main(
 	logversion = 2;
 	logagno = logblocks = rtblocks = rtextblocks = 0;
 	Nflag = nlflag = nsflag = nvflag = nci = 0;
+	nftype = dirftype = 0;		/* inode type information in the dir */
 	dirblocklog = dirblocksize = 0;
 	dirversion = XFS_DFL_DIR_VERSION;
 	qflag = 0;
@@ -1475,6 +1480,8 @@ main(
 					if (c < 0 || c > 1)
 						illegal(value, "m crc");
 					crcs_enabled = c;
+					if (dirftype && crcs_enabled)
+						usage();
 					break;
 				default:
 					unknown('m', value);
@@ -1533,6 +1540,16 @@ main(
 					}
 					nvflag = 1;
 					break;
+				case N_FTYPE:
+					if (!value || *value == '\0')
+						reqval('n', nopts, N_FTYPE);
+					if (nftype)
+						respec('n', nopts, N_FTYPE);
+					dirftype = atoi(value);
+					if (crcs_enabled)
+						usage();
+					nftype = 1;
+					break;
 				default:
 					unknown('n', value);
 				}
@@ -2434,6 +2451,14 @@ _("size %s specified for log subvolume i
 	}
 	validate_log_size(logblocks, blocklog, min_logblocks);
 
+	/*
+	 * dirent filetype field always enabled on v5 superblocks
+	 */
+	if (crcs_enabled) {
+		sbp->sb_features_incompat = XFS_SB_FEAT_INCOMPAT_FTYPE;
+		dirftype = 1;
+	}
+
 	if (!qflag || Nflag) {
 		printf(_(
 		   "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
@@ -2441,7 +2466,7 @@ _("size %s specified for log subvolume i
 		   "         =%-22s crc=%u\n"
 		   "data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
 		   "         =%-22s sunit=%-6u swidth=%u blks\n"
-		   "naming   =version %-14u bsize=%-6u ascii-ci=%d\n"
+		   "naming   =version %-14u bsize=%-6u ascii-ci=%d ftype=%d\n"
 		   "log      =%-22s bsize=%-6d blocks=%lld, version=%d\n"
 		   "         =%-22s sectsz=%-5u sunit=%d blks, lazy-count=%d\n"
 		   "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"),
@@ -2450,7 +2475,7 @@ _("size %s specified for log subvolume i
 			"", crcs_enabled,
 			"", blocksize, (long long)dblocks, imaxpct,
 			"", dsunit, dswidth,
-			dirversion, dirblocksize, nci,
+			dirversion, dirblocksize, nci, dirftype,
 			logfile, 1 << blocklog, (long long)logblocks,
 			logversion, "", lsectorsize, lsunit, lazy_sb_counters,
 			rtfile, rtextblocks << blocklog,
@@ -2512,8 +2537,10 @@ _("size %s specified for log subvolume i
 		sbp->sb_logsectlog = 0;
 		sbp->sb_logsectsize = 0;
 	}
+
 	sbp->sb_features2 = XFS_SB_VERSION2_MKFS(crcs_enabled, lazy_sb_counters,
-					attrversion == 2, !projid16bit, 0);
+				   attrversion == 2, !projid16bit, 0,
+				   (crcs_enabled && dirftype));
 	sbp->sb_versionnum = XFS_SB_VERSION_MKFS(crcs_enabled, iaflag,
 					dsunit != 0,
 					logversion == 2, attrversion == 1,
@@ -2521,13 +2548,6 @@ _("size %s specified for log subvolume i
 							lsectorsize != BBSIZE),
 					nci, sbp->sb_features2 != 0);
 	/*
-	 * dirent filetype field always enabled on v5 superblocks
-	 */
-	if (crcs_enabled) {
-		sbp->sb_features_incompat = XFS_SB_FEAT_INCOMPAT_FTYPE;
-	}
-
-	/*
 	 * Due to a structure alignment issue, sb_features2 ended up in one
 	 * of two locations, the second "incorrect" location represented by
 	 * the sb_bad_features2 field. To avoid older kernels mounting
@@ -3065,7 +3085,7 @@ usage( void )
 			    sunit=value|su=num,sectlog=n|sectsize=num,\n\
 			    lazy-count=0|1]\n\
 /* label */		[-L label (maximum 12 characters)]\n\
-/* naming */		[-n log=n|size=num,version=2|ci]\n\
+/* naming */		[-n log=n|size=num,version=2|ci,ftype=0|1]\n\
 /* no-op info only */	[-N]\n\
 /* prototype file */	[-p fname]\n\
 /* quiet */		[-q]\n\
Index: b/mkfs/xfs_mkfs.h
===================================================================
--- a/mkfs/xfs_mkfs.h
+++ b/mkfs/xfs_mkfs.h
@@ -36,12 +36,14 @@
 	        XFS_DFL_SB_VERSION_BITS |                               \
 	0 ) : XFS_SB_VERSION_1 )
 
-#define XFS_SB_VERSION2_MKFS(crc, lazycount, attr2, projid32bit, parent) (\
+#define XFS_SB_VERSION2_MKFS(crc, lazycount, attr2, projid32bit, parent, \
+			     ftype) (\
 	((lazycount) ? XFS_SB_VERSION2_LAZYSBCOUNTBIT : 0) |		\
 	((attr2) ? XFS_SB_VERSION2_ATTR2BIT : 0) |			\
 	((projid32bit) ? XFS_SB_VERSION2_PROJID32BIT : 0) |		\
 	((parent) ? XFS_SB_VERSION2_PARENTBIT : 0) |			\
 	((crc) ? XFS_SB_VERSION2_CRCBIT : 0) |				\
+	((ftype) ? XFS_SB_VERSION2_FTYPE : 0) |				\
 	0 )
 
 #define	XFS_DFL_BLOCKSIZE_LOG	12		/* 4096 byte blocks */


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-16 22:36 ` [PATCH 3/3] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-10-16 23:50   ` Dave Chinner
  2013-10-17 13:26     ` Mark Tinguely
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Chinner @ 2013-10-16 23:50 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Wed, Oct 16, 2013 at 05:36:57PM -0500, Mark Tinguely wrote:
> Add directory inode type feature to mkfs.xfs and its manual page.
> 
> In sb v4, "mkfs.xfs -n ftype=1" turns on the feature. The feature is
> still automatically turned on for sb v5. Reject the "ftype=1" request
> if used with the "crc=1" setting.
> 
> Signed-off-by: Mark Tinguely <tinguely@sgi.com>
> ---
> updated the manual entry.
> changed the variables in xfs_mkfs.c
> call usage() if the crc and ftype are used together.
> update the sb_features_incompat entry for sb v5 and feature bit for v4
> 
> man/man8/mkfs.xfs.8 |    7 +++++++
>  man/man8/mkfs.xfs.8 |   15 +++++++++++++++
>  mkfs/xfs_mkfs.c     |   42 +++++++++++++++++++++++++++++++-----------
>  mkfs/xfs_mkfs.h     |    4 +++-
>  3 files changed, 49 insertions(+), 12 deletions(-)
> 
> Index: b/man/man8/mkfs.xfs.8
> ===================================================================
> --- a/man/man8/mkfs.xfs.8
> +++ b/man/man8/mkfs.xfs.8
> @@ -517,6 +517,21 @@ option enables ASCII only case-insensiti
>  are stored in directories using the case they were created with.
>  .IP
>  Note: Version 1 directories are not supported.
> +.TP
> +.BI ftype= value
> +This feature introduced in Linux 3.12 allows the inode type to
> +be stored in the directory structure so that readdir(3) and getdents(2)
> +do not need to look up the inode to determine the inode type.
> +
> +The
> +.I value
> +is either 0 or 1, with 1 signifiying that filetype information
> +will be stored in the directory structure. The default value is 0.
> +
> +When CRCs are enabled via "mkfs.xfs -m crc=1", the ftype functionality is
> +always enabled. This feature can not be turned off for such filesystem
> +configurations.

I don't think you need the "mkfs.xfs -m crc=1" in that paragraph. If
you want to put the "-m crc=1" option in there, the way it is done
in the rest of the man page is just as "-m crc=1" in bold type, not
in quotes, and it doesn't need the mkfs.xfs prefix.

> @@ -1475,6 +1480,8 @@ main(
>  					if (c < 0 || c > 1)
>  						illegal(value, "m crc");
>  					crcs_enabled = c;
> +					if (dirftype && crcs_enabled)
> +						usage();

That doesn't work. dirftype will only be set if ftype is enabled.
You should be checking nftype here. Also, consider this inconsistent
parsing of teh same options:

$ sudo ~/packages/mkfs.xfs -f -n ftype=0 -m crc=1 /dev/vda
meta-data=/dev/vda               isize=512    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$ sudo ~/packages/mkfs.xfs -f -m crc=1 -n ftype=0 /dev/vda
Usage: mkfs.xfs
/* blocksize */         [-b log=n|size=num]
/* metadata */          [-m crc=[0|1]
/* data subvol */       [-d agcount=n,agsize=n,file,name=xxx,size=num,
                            (sunit=value,swidth=value|su=num,sw=num),
                            sectlog=n|sectsize=num
/* force overwrite */   [-f]
/* inode size */        [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,
                            projid32bit=0|1]
/* no discard */        [-K]
/* log subvol */        [-l agnum=n,internal,size=num,logdev=xxx,version=n
                            sunit=value|su=num,sectlog=n|sectsize=num,
                            lazy-count=0|1]
/* label */             [-L label (maximum 12 characters)]
/* naming */            [-n log=n|size=num,version=2|ci,ftype=0|1]
/* no-op info only */   [-N]
/* prototype file */    [-p fname]
/* quiet */             [-q]
/* realtime subvol */   [-r extsize=num,size=num,rtdev=xxx]
/* sectorsize */        [-s log=n|size=num]
/* version */           [-V]
                        devicename
<devicename> is required unless -d name=xxx is given.
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
<value> is xxx (512 byte blocks).
$


Further, just calling usage here doesn't tell the user what they did
wrong that caused mkfs to abort. It should output what the error in
the parameters is, especially as there is no indication in the usage
message that ftype is not valid with crcs.  Same for the usage call
in the -m crc parsing.

>  	}
>  	validate_log_size(logblocks, blocklog, min_logblocks);
>  
> +	/*
> +	 * dirent filetype field always enabled on v5 superblocks
> +	 */
> +	if (crcs_enabled) {
> +		sbp->sb_features_incompat = XFS_SB_FEAT_INCOMPAT_FTYPE;
> +		dirftype = 1;
> +	}
> +
>  	if (!qflag || Nflag) {
>  		printf(_(
>  		   "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
> @@ -2441,7 +2466,7 @@ _("size %s specified for log subvolume i
>  		   "         =%-22s crc=%u\n"
>  		   "data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
>  		   "         =%-22s sunit=%-6u swidth=%u blks\n"
> -		   "naming   =version %-14u bsize=%-6u ascii-ci=%d\n"
> +		   "naming   =version %-14u bsize=%-6u ascii-ci=%d ftype=%d\n"
>  		   "log      =%-22s bsize=%-6d blocks=%lld, version=%d\n"
>  		   "         =%-22s sectsz=%-5u sunit=%d blks, lazy-count=%d\n"
>  		   "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"),
> @@ -2450,7 +2475,7 @@ _("size %s specified for log subvolume i
>  			"", crcs_enabled,
>  			"", blocksize, (long long)dblocks, imaxpct,
>  			"", dsunit, dswidth,
> -			dirversion, dirblocksize, nci,
> +			dirversion, dirblocksize, nci, dirftype,
>  			logfile, 1 << blocklog, (long long)logblocks,
>  			logversion, "", lsectorsize, lsunit, lazy_sb_counters,
>  			rtfile, rtextblocks << blocklog,
> @@ -2512,8 +2537,10 @@ _("size %s specified for log subvolume i
>  		sbp->sb_logsectlog = 0;
>  		sbp->sb_logsectsize = 0;
>  	}
> +
>  	sbp->sb_features2 = XFS_SB_VERSION2_MKFS(crcs_enabled, lazy_sb_counters,
> -					attrversion == 2, !projid16bit, 0);
> +				   attrversion == 2, !projid16bit, 0,
> +				   (crcs_enabled && dirftype));

That will never set the ftype bit on v4 superblocks - it will only
ever get set on v5 superblocks:

$ sudo ~/packages/mkfs.xfs -f -n ftype=1 /dev/vda
meta-data=/dev/vda               isize=256    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
                                                         ^^^^^^^
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$ sudo xfs_db -r -c version /dev/vda
versionnum [0xb4a4+0x8a] = V4,NLINK,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT
$

The sb_features2 field has the value of 0x8a, which is:

#define XFS_SB_VERSION2_LAZYSBCOUNTBIT  0x00000002      /* Superblk counters */  
#define XFS_SB_VERSION2_ATTR2BIT        0x00000008      /* Inline attr rework */ 
#define XFS_SB_VERSION2_PROJID32BIT     0x00000080      /* 32 bit project id */  

Clearly the ftype feature bit is not set:

#define XFS_SB_VERSION2_FTYPE           0x00000200      /* inode type in dir */  

So any testing you've done with this mkfs patch hasn't tested dtype
enabled dirents on v4 filesystems at all....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] xfsprogs: v4 inode type in directory
  2013-10-16 22:36 [PATCH 0/3] xfsprogs: v4 inode type in directory Mark Tinguely
                   ` (2 preceding siblings ...)
  2013-10-16 22:36 ` [PATCH 3/3] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-10-16 23:54 ` Dave Chinner
  3 siblings, 0 replies; 8+ messages in thread
From: Dave Chinner @ 2013-10-16 23:54 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Wed, Oct 16, 2013 at 05:36:54PM -0500, Mark Tinguely wrote:
> Here are the patches that enable the inode in the directory
> feature in v4 superblocks.
> 
>  patch 1: add the entries to xfs_sb.h (sync with kernel)
>  patch 2: add the XFS_FSOP_GEOM_FLAGS_FTYPE to xfs_fs.h (sync with kernel)
> 	  add the entry to repair so that xfs_info reports the feature
>  patch 3: add the feature to mkfs.xfs and manual page.
>           note: this new feature is ignored for superblock v5
> 		automatically turns on this feature.

xfs_db needs to have the version string output updated, it also
needs support for dirent dtype dumping for block, leaf and node form
directories.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-16 23:50   ` Dave Chinner
@ 2013-10-17 13:26     ` Mark Tinguely
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Tinguely @ 2013-10-17 13:26 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 10/16/13 18:50, Dave Chinner wrote:
> On Wed, Oct 16, 2013 at 05:36:57PM -0500, Mark Tinguely wrote:
>> Add directory inode type feature to mkfs.xfs and its manual page.
>>
>> In sb v4, "mkfs.xfs -n ftype=1" turns on the feature. The feature is
>> still automatically turned on for sb v5. Reject the "ftype=1" request
>> if used with the "crc=1" setting.
>>
>> Signed-off-by: Mark Tinguely <tinguely@sgi.com>
>> ---

>> +
>>   	sbp->sb_features2 = XFS_SB_VERSION2_MKFS(crcs_enabled, lazy_sb_counters,
>> -					attrversion == 2, !projid16bit, 0);
>> +				   attrversion == 2, !projid16bit, 0,
>> +				   (crcs_enabled && dirftype));

Eek that change was made yesterday and should be:
  (!crcs_enabled && dirftype)
so the feature bit is only turned on for v4 sb.

--Mark.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-10-17 13:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16 22:36 [PATCH 0/3] xfsprogs: v4 inode type in directory Mark Tinguely
2013-10-16 22:36 ` [PATCH 1/3] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
2013-10-16 22:36 ` [PATCH 2/3] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
2013-10-16 22:36 ` [PATCH 3/3] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
2013-10-16 23:50   ` Dave Chinner
2013-10-17 13:26     ` Mark Tinguely
2013-10-16 23:54 ` [PATCH 0/3] xfsprogs: v4 inode type in directory Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2013-09-19 21:05 Mark Tinguely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox