All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] xfsprogs: v4 inode type in directory
@ 2013-10-17 15:28 Mark Tinguely
  2013-10-17 15:28 ` [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-17 15:28 UTC (permalink / raw)
  To: xfs

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

Unchanged
 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
New
 patch 3: add feature to the xfs_db version command.

Fixed
 patch 4: 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] 23+ messages in thread

* [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field
  2013-10-17 15:28 [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
@ 2013-10-17 15:28 ` Mark Tinguely
  2013-10-22 23:23   ` Dave Chinner
  2013-10-23 23:47   ` Rich Johnston
  2013-10-17 15:28 ` [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-17 15:28 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 1-4-xfsprog-add-xfs-sb-v4-support-for-dirent-filetype-field.patch --]
[-- Type: text/plain, Size: 1762 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>
---
v3 no change.

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] 23+ messages in thread

* [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info
  2013-10-17 15:28 [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
  2013-10-17 15:28 ` [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-10-17 15:28 ` Mark Tinguely
  2013-10-22 23:23   ` Dave Chinner
  2013-10-23 23:43   ` Rich Johnston
  2013-10-17 15:28 ` [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version Mark Tinguely
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-17 15:28 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 2-4-xfsprog-add-dirent-filetype-information-for-xfs_info.patch --]
[-- Type: text/plain, Size: 3660 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>
---
v3 no change.

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] 23+ messages in thread

* [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version
  2013-10-17 15:28 [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
  2013-10-17 15:28 ` [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
  2013-10-17 15:28 ` [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
@ 2013-10-17 15:28 ` Mark Tinguely
  2013-10-22 23:24   ` Dave Chinner
  2013-10-23 23:43   ` Rich Johnston
  2013-10-17 15:28 ` [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-17 15:28 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 3-4-xfsprog-add-ftype-to-version-in-xfs_db.patch --]
[-- Type: text/plain, Size: 608 bytes --]

Add directory inode type to the xfs_db version command.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
new to v3

 db/sb.c |    2 ++
 1 file changed, 2 insertions(+)

Index: b/db/sb.c
===================================================================
--- a/db/sb.c
+++ b/db/sb.c
@@ -644,6 +644,8 @@ version_string(
 		strcat(s, ",PROJID32BIT");
 	if (xfs_sb_version_hascrc(sbp))
 		strcat(s, ",CRC");
+	if (xfs_sb_version_hasftype(sbp))
+		strcat(s, ",FTYPE");
 	return s;
 }
 


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

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

* [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-17 15:28 [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
                   ` (2 preceding siblings ...)
  2013-10-17 15:28 ` [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version Mark Tinguely
@ 2013-10-17 15:28 ` Mark Tinguely
  2013-10-22 23:26   ` Dave Chinner
                     ` (2 more replies)
  2013-10-17 22:08 ` [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
  2013-10-23 13:39 ` [patch 5/4] xfsprogs: add field types to v4 xfs_db directory entries Mark Tinguely
  5 siblings, 3 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-17 15:28 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 4-4-xfsprog-add-mkfs.xfs-sb-v4-support-for-dirent-filetype-field.patch --]
[-- Type: text/plain, Size: 7114 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 automatically turned on for "-m crc=1", but reject
the use of the "-n ftype=0|1" with the "-m crc=1" option.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
v3
Manual page changes
 removed the "mkfs.xfs" before "-m crc=1".

 make the "readdir(3)", "getdents(2)" and "-m crc=1" to be bold
 remove quotes from "-m crc=1".

 removed the Linux version that ftype was first supported.

mkfs.xfs.c:
  fixed the comparison variable that keeps "-m crc=1" and "-n ftype=X"
  from being used together.

  fixed the condition check (!crcs_enable && dirftype) that enables the
  feature only for v4 superblocks.

  add message that crcs and ftype cannot be used together before calling
  usage().

man/man8/mkfs.xfs.8 |    7 +++++++
 man/man8/mkfs.xfs.8 |   19 +++++++++++++++++++
 mkfs/xfs_mkfs.c     |   48 +++++++++++++++++++++++++++++++++++++-----------
 mkfs/xfs_mkfs.h     |    4 +++-
 3 files changed, 59 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,25 @@ 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 allows the inode type to be stored in the directory
+structure so that the
+.BR readdir (3)
+and
+.BR 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
+.B \-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,11 @@ main(
 					if (c < 0 || c > 1)
 						illegal(value, "m crc");
 					crcs_enabled = c;
+					if (nftype && crcs_enabled) {
+						fprintf(stderr,
+_("cannot specify both crc and ftype\n"));
+						usage();
+					}
 					break;
 				default:
 					unknown('m', value);
@@ -1533,6 +1543,19 @@ 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) {
+						fprintf(stderr,
+_("cannot specify both crc and ftype\n"));
+						usage();
+					}
+					nftype = 1;
+					break;
 				default:
 					unknown('n', value);
 				}
@@ -2434,6 +2457,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 +2472,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 +2481,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 +2543,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 +2554,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 +3091,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] 23+ messages in thread

* Re: [PATCH v3 0/4] xfsprogs: v4 inode type in directory
  2013-10-17 15:28 [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
                   ` (3 preceding siblings ...)
  2013-10-17 15:28 ` [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-10-17 22:08 ` Mark Tinguely
  2013-10-18  3:19   ` Dave Chinner
  2013-10-23 13:39 ` [patch 5/4] xfsprogs: add field types to v4 xfs_db directory entries Mark Tinguely
  5 siblings, 1 reply; 23+ messages in thread
From: Mark Tinguely @ 2013-10-17 22:08 UTC (permalink / raw)
  To: xfs

On 10/17/13 10:28, Mark Tinguely wrote:
> Here are the patches that enable the inode in the directory
> feature in v4 superblocks.
>
> Unchanged
>   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
> New
>   patch 3: add feature to the xfs_db version command.
>
> Fixed
>   patch 4: add the feature to mkfs.xfs and manual page.
>            note: this new feature is ignored for superblock v5
> 		automatically turns on this feature.

FYI.

I saw the request for adding the filetype entry to block/leaf after posting.

I have it displaying unconditionally, but am trying to figure out how to 
make it display only for filesytems that support the ftype feature. I am 
missing something in the field.count().

--Mark.

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

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

* Re: [PATCH v3 0/4] xfsprogs: v4 inode type in directory
  2013-10-17 22:08 ` [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
@ 2013-10-18  3:19   ` Dave Chinner
  2013-10-18 13:22     ` Mark Tinguely
  0 siblings, 1 reply; 23+ messages in thread
From: Dave Chinner @ 2013-10-18  3:19 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Thu, Oct 17, 2013 at 05:08:56PM -0500, Mark Tinguely wrote:
> On 10/17/13 10:28, Mark Tinguely wrote:
> >Here are the patches that enable the inode in the directory
> >feature in v4 superblocks.
> >
> >Unchanged
> >  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
> >New
> >  patch 3: add feature to the xfs_db version command.
> >
> >Fixed
> >  patch 4: add the feature to mkfs.xfs and manual page.
> >           note: this new feature is ignored for superblock v5
> >		automatically turns on this feature.
> 
> FYI.
> 
> I saw the request for adding the filetype entry to block/leaf after posting.
> 
> I have it displaying unconditionally, but am trying to figure out
> how to make it display only for filesytems that support the ftype
> feature. I am missing something in the field.count().

The count function only tells the code whether a structure is
present or not, but it does not tell you what the format of the
structure is.

if you look at db/dir2.c, you'll see that the difference between the
dir2_flds[] and the dir3_flds[] is mainly in the type, count and offset
fields. For example:

const field_t   dir2_flds[] = {
        { "bhdr", FLDT_DIR2_DATA_HDR, OI(BOFF(magic)), dir2_block_hdr_count,
          FLD_COUNT, TYP_NONE }
...

const field_t   dir3_flds[] = {
        { "bhdr", FLDT_DIR3_DATA_HDR, OI(B3OFF(hdr)), dir3_block_hdr_count,
          FLD_COUNT, TYP_NONE },
...

if you look at dir[23]_block_hdr_count(), you'll see that they
return a boolean value based on a magic number check. Hence when the
code is trying to determine the type of the block that has been read
(i.e. what the field definition is), if the magic number matches we
know exactly what type of contents they contain.

For decoding the dtype, you need too look at how to select the
correct structure for the FLDT_DIR2_DATA_UNION. If you don't have
the feature set, you need to select the FLDT_DIR2_DATA_UNION
structure type, and if it is set you need to select the
FLDT_DIR3_DATA_UNION type. Hence you need both these types defined
in the dir2_flds[] array, and some manner to ensure the correct
values are returned from the count functions.

And just to make it hard, both the dir2 and dir3 data union count
functions use the same function (dir2_data_u_count) so you're going
to have to be careful that you don't break the v5 superblock
directory decoding....

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] 23+ messages in thread

* Re: [PATCH v3 0/4] xfsprogs: v4 inode type in directory
  2013-10-18  3:19   ` Dave Chinner
@ 2013-10-18 13:22     ` Mark Tinguely
  2013-10-18 22:55       ` Dave Chinner
  2013-10-22 23:27       ` Dave Chinner
  0 siblings, 2 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-18 13:22 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 10/17/13 22:19, Dave Chinner wrote:
> On Thu, Oct 17, 2013 at 05:08:56PM -0500, Mark Tinguely wrote:
>> On 10/17/13 10:28, Mark Tinguely wrote:
>>> Here are the patches that enable the inode in the directory
>>> feature in v4 superblocks.
>>>
>>> Unchanged
>>>   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
>>> New
>>>   patch 3: add feature to the xfs_db version command.
>>>
>>> Fixed
>>>   patch 4: add the feature to mkfs.xfs and manual page.
>>>            note: this new feature is ignored for superblock v5
>>> 		automatically turns on this feature.
>>
>> FYI.
>>
>> I saw the request for adding the filetype entry to block/leaf after posting.
>>
>> I have it displaying unconditionally, but am trying to figure out
>> how to make it display only for filesytems that support the ftype
>> feature. I am missing something in the field.count().
>
> The count function only tells the code whether a structure is
> present or not, but it does not tell you what the format of the
> structure is.
>
> if you look at db/dir2.c, you'll see that the difference between the
> dir2_flds[] and the dir3_flds[] is mainly in the type, count and offset
> fields. For example:
>
> const field_t   dir2_flds[] = {
>          { "bhdr", FLDT_DIR2_DATA_HDR, OI(BOFF(magic)), dir2_block_hdr_count,
>            FLD_COUNT, TYP_NONE }
> ...
>
> const field_t   dir3_flds[] = {
>          { "bhdr", FLDT_DIR3_DATA_HDR, OI(B3OFF(hdr)), dir3_block_hdr_count,
>            FLD_COUNT, TYP_NONE },
> ...
>
> if you look at dir[23]_block_hdr_count(), you'll see that they
> return a boolean value based on a magic number check. Hence when the
> code is trying to determine the type of the block that has been read
> (i.e. what the field definition is), if the magic number matches we
> know exactly what type of contents they contain.
>
> For decoding the dtype, you need too look at how to select the
> correct structure for the FLDT_DIR2_DATA_UNION. If you don't have
> the feature set, you need to select the FLDT_DIR2_DATA_UNION
> structure type, and if it is set you need to select the
> FLDT_DIR3_DATA_UNION type. Hence you need both these types defined
> in the dir2_flds[] array, and some manner to ensure the correct
> values are returned from the count functions.
>
> And just to make it hard, both the dir2 and dir3 data union count
> functions use the same function (dir2_data_u_count) so you're going
> to have to be careful that you don't break the v5 superblock
> directory decoding....
>
> Cheers,
>
> Dave.


Thanks Dave. I did some RTFS and found I was having problems with the 
field_t.flag.

Can't we add a filetype to the dir2 dir2_data_union_flds entry and use 
the count to turn it on/off? The problem I was having with this was the 
flag. Something like:

Add the directory field type information to xfs_db directory
displays.

---
  db/dir2.c |   12 ++++++++++++
  1 file changed, 12 insertions(+)

Index: b/db/dir2.c
===================================================================
--- a/db/dir2.c
+++ b/db/dir2.c
@@ -52,6 +52,8 @@ static int	dir2_leaf_tail_count(void *ob
  static int	dir2_leaf_tail_offset(void *obj, int startoff, int idx);
  static int	dir2_node_btree_count(void *obj, int startoff);
  static int	dir2_node_hdr_count(void *obj, int startoff);
+static int	dir3_data_union_ftype_offset(void *obj, int startoff, int idx);
+static int	dir2_data_union_ftype_count(void *obj, int startoff);

  const field_t	dir2_hfld[] = {
  	{ "", FLDT_DIR2, OI(0), C1, 0, TYP_NONE },
@@ -130,6 +132,8 @@ const field_t	dir2_data_union_flds[] = {
  	  dir2_data_union_namelen_count, FLD_COUNT, TYP_NONE },
  	{ "name", FLDT_CHARNS, OI(DEOFF(name)), dir2_data_union_name_count,
  	  FLD_COUNT, TYP_NONE },
+	{ "filetype", FLDT_UINT8D, dir3_data_union_ftype_offset,
+	  dir2_data_union_ftype_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
  	{ "tag", FLDT_DIR2_DATA_OFF, dir2_data_union_tag_offset,
  	  dir2_data_union_tag_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
  	{ NULL }
@@ -454,6 +458,14 @@ dir2_data_union_name_count(
  }

  static int
+dir2_data_union_ftype_count(
+	void			*obj,
+	int			startoff)
+{
+	return xfs_sb_version_hasftype(&mp->m_sb);
+}
+
+static int
  dir2_data_union_namelen_count(
  	void			*obj,
  	int			startoff)


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

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

* Re: [PATCH v3 0/4] xfsprogs: v4 inode type in directory
  2013-10-18 13:22     ` Mark Tinguely
@ 2013-10-18 22:55       ` Dave Chinner
  2013-10-20 18:17         ` Mark Tinguely
  2013-10-22 23:27       ` Dave Chinner
  1 sibling, 1 reply; 23+ messages in thread
From: Dave Chinner @ 2013-10-18 22:55 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Fri, Oct 18, 2013 at 08:22:24AM -0500, Mark Tinguely wrote:
> On 10/17/13 22:19, Dave Chinner wrote:
> >On Thu, Oct 17, 2013 at 05:08:56PM -0500, Mark Tinguely wrote:
> >>On 10/17/13 10:28, Mark Tinguely wrote:
> >>>Here are the patches that enable the inode in the directory
> >>>feature in v4 superblocks.
> >>>
> >>>Unchanged
> >>>  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
> >>>New
> >>>  patch 3: add feature to the xfs_db version command.
> >>>
> >>>Fixed
> >>>  patch 4: add the feature to mkfs.xfs and manual page.
> >>>           note: this new feature is ignored for superblock v5
> >>>		automatically turns on this feature.
> >>
> >>FYI.
> >>
> >>I saw the request for adding the filetype entry to block/leaf after posting.
> >>
> >>I have it displaying unconditionally, but am trying to figure out
> >>how to make it display only for filesytems that support the ftype
> >>feature. I am missing something in the field.count().
> >
> >The count function only tells the code whether a structure is
> >present or not, but it does not tell you what the format of the
> >structure is.
> >
> >if you look at db/dir2.c, you'll see that the difference between the
> >dir2_flds[] and the dir3_flds[] is mainly in the type, count and offset
> >fields. For example:
> >
> >const field_t   dir2_flds[] = {
> >         { "bhdr", FLDT_DIR2_DATA_HDR, OI(BOFF(magic)), dir2_block_hdr_count,
> >           FLD_COUNT, TYP_NONE }
> >...
> >
> >const field_t   dir3_flds[] = {
> >         { "bhdr", FLDT_DIR3_DATA_HDR, OI(B3OFF(hdr)), dir3_block_hdr_count,
> >           FLD_COUNT, TYP_NONE },
> >...
> >
> >if you look at dir[23]_block_hdr_count(), you'll see that they
> >return a boolean value based on a magic number check. Hence when the
> >code is trying to determine the type of the block that has been read
> >(i.e. what the field definition is), if the magic number matches we
> >know exactly what type of contents they contain.
> >
> >For decoding the dtype, you need too look at how to select the
> >correct structure for the FLDT_DIR2_DATA_UNION. If you don't have
> >the feature set, you need to select the FLDT_DIR2_DATA_UNION
> >structure type, and if it is set you need to select the
> >FLDT_DIR3_DATA_UNION type. Hence you need both these types defined
> >in the dir2_flds[] array, and some manner to ensure the correct
> >values are returned from the count functions.
> >
> >And just to make it hard, both the dir2 and dir3 data union count
> >functions use the same function (dir2_data_u_count) so you're going
> >to have to be careful that you don't break the v5 superblock
> >directory decoding....
> >
> >Cheers,
> >
> >Dave.
> 
> 
> Thanks Dave. I did some RTFS and found I was having problems with
> the field_t.flag.
> 
> Can't we add a filetype to the dir2 dir2_data_union_flds entry and
> use the count to turn it on/off? The problem I was having with this
> was the flag.

ISTR trying something like that previously when doing the dir3
changeover - I couldn't get it to work properly because parts of the
structure could not be easily discriminated and so both the v2 and
v3 count functions would return true because they were looking at
different locations in the structure due to the header size
differences.

In this case, because the structure itself doesn't have any child
dependencies and the format will always be considered a v2 directory
structure, I think what you propose should work. Did you test it
to see if it works?

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] 23+ messages in thread

* Re: [PATCH v3 0/4] xfsprogs: v4 inode type in directory
  2013-10-18 22:55       ` Dave Chinner
@ 2013-10-20 18:17         ` Mark Tinguely
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-20 18:17 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 10/18/13 17:55, Dave Chinner wrote:
> On Fri, Oct 18, 2013 at 08:22:24AM -0500, Mark Tinguely wrote:
>> On 10/17/13 22:19, Dave Chinner wrote:
>>> On Thu, Oct 17, 2013 at 05:08:56PM -0500, Mark Tinguely wrote:
>>>> On 10/17/13 10:28, Mark Tinguely wrote:
>>>>> Here are the patches that enable the inode in the directory
>>>>> feature in v4 superblocks.
>>>>>
>>>>> Unchanged
>>>>>   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
>>>>> New
>>>>>   patch 3: add feature to the xfs_db version command.
>>>>>
>>>>> Fixed
>>>>>   patch 4: add the feature to mkfs.xfs and manual page.
>>>>>            note: this new feature is ignored for superblock v5
>>>>> 		automatically turns on this feature.
>>>>
>>>> FYI.
>>>>
>>>> I saw the request for adding the filetype entry to block/leaf after posting.
>>>>
>>>> I have it displaying unconditionally, but am trying to figure out
>>>> how to make it display only for filesytems that support the ftype
>>>> feature. I am missing something in the field.count().
>>>
>>> The count function only tells the code whether a structure is
>>> present or not, but it does not tell you what the format of the
>>> structure is.
>>>
>>> if you look at db/dir2.c, you'll see that the difference between the
>>> dir2_flds[] and the dir3_flds[] is mainly in the type, count and offset
>>> fields. For example:
>>>
>>> const field_t   dir2_flds[] = {
>>>          { "bhdr", FLDT_DIR2_DATA_HDR, OI(BOFF(magic)), dir2_block_hdr_count,
>>>            FLD_COUNT, TYP_NONE }
>>> ...
>>>
>>> const field_t   dir3_flds[] = {
>>>          { "bhdr", FLDT_DIR3_DATA_HDR, OI(B3OFF(hdr)), dir3_block_hdr_count,
>>>            FLD_COUNT, TYP_NONE },
>>> ...
>>>
>>> if you look at dir[23]_block_hdr_count(), you'll see that they
>>> return a boolean value based on a magic number check. Hence when the
>>> code is trying to determine the type of the block that has been read
>>> (i.e. what the field definition is), if the magic number matches we
>>> know exactly what type of contents they contain.
>>>
>>> For decoding the dtype, you need too look at how to select the
>>> correct structure for the FLDT_DIR2_DATA_UNION. If you don't have
>>> the feature set, you need to select the FLDT_DIR2_DATA_UNION
>>> structure type, and if it is set you need to select the
>>> FLDT_DIR3_DATA_UNION type. Hence you need both these types defined
>>> in the dir2_flds[] array, and some manner to ensure the correct
>>> values are returned from the count functions.
>>>
>>> And just to make it hard, both the dir2 and dir3 data union count
>>> functions use the same function (dir2_data_u_count) so you're going
>>> to have to be careful that you don't break the v5 superblock
>>> directory decoding....
>>>
>>> Cheers,
>>>
>>> Dave.
>>
>>
>> Thanks Dave. I did some RTFS and found I was having problems with
>> the field_t.flag.
>>
>> Can't we add a filetype to the dir2 dir2_data_union_flds entry and
>> use the count to turn it on/off? The problem I was having with this
>> was the flag.
>
> ISTR trying something like that previously when doing the dir3
> changeover - I couldn't get it to work properly because parts of the
> structure could not be easily discriminated and so both the v2 and
> v3 count functions would return true because they were looking at
> different locations in the structure due to the header size
> differences.
>
> In this case, because the structure itself doesn't have any child
> dependencies and the format will always be considered a v2 directory
> structure, I think what you propose should work. Did you test it
> to see if it works?
>
> Cheers,
>
> Dave.

Yes, for example:

mkdir directory
mknod device c 100 100
touch file
ln -s file softlink

and on a short form directory:

u.sfdir3.hdr.count = 4
u.sfdir3.hdr.i8count = 0
u.sfdir3.hdr.parent.i4 = 128
u.sfdir3.list[0].namelen = 9
u.sfdir3.list[0].offset = 0x30
u.sfdir3.list[0].name = "directory"
u.sfdir3.list[0].inumber.i4 = 131
u.sfdir3.list[0].filetype = 2
u.sfdir3.list[1].namelen = 6
u.sfdir3.list[1].offset = 0x48
u.sfdir3.list[1].name = "device"
u.sfdir3.list[1].inumber.i4 = 132
u.sfdir3.list[1].filetype = 3
u.sfdir3.list[2].namelen = 4
u.sfdir3.list[2].offset = 0x60
u.sfdir3.list[2].name = "file"
u.sfdir3.list[2].inumber.i4 = 133
u.sfdir3.list[2].filetype = 1
u.sfdir3.list[3].namelen = 8
u.sfdir3.list[3].offset = 0x70
u.sfdir3.list[3].name = "softlink"
u.sfdir3.list[3].inumber.i4 = 134
u.sfdir3.list[3].filetype = 7

then covert it to a block directory:

xfs_db> dblock 0
xfs_db> p
bhdr.magic = 0x58443242
bhdr.bestfree[0].offset = 0x128
bhdr.bestfree[0].length = 0xe50
bhdr.bestfree[1].offset = 0
bhdr.bestfree[1].length = 0
bhdr.bestfree[2].offset = 0
bhdr.bestfree[2].length = 0
bu[0].inumber = 128
bu[0].namelen = 1
bu[0].name = "."
bu[0].filetype = 2
bu[0].tag = 0x10
bu[1].inumber = 128
bu[1].namelen = 2
bu[1].name = ".."
bu[1].filetype = 2
bu[1].tag = 0x20
bu[2].inumber = 131
bu[2].namelen = 9
bu[2].name = "directory"
bu[2].filetype = 2
bu[2].tag = 0x30
bu[3].inumber = 132
bu[3].namelen = 6
bu[3].name = "device"
bu[3].filetype = 3
bu[3].tag = 0x48
bu[4].inumber = 133
bu[4].namelen = 4
bu[4].name = "file"
bu[4].filetype = 1
bu[4].tag = 0x60
bu[5].inumber = 134
bu[5].namelen = 8
bu[5].name = "softlink"
bu[5].filetype = 7


and works without the file type feature turn off. The libxfs code does 
the heavy work.

--Mark

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

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

* Re: [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field
  2013-10-17 15:28 ` [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-10-22 23:23   ` Dave Chinner
  2013-10-23 23:47   ` Rich Johnston
  1 sibling, 0 replies; 23+ messages in thread
From: Dave Chinner @ 2013-10-22 23:23 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Thu, Oct 17, 2013 at 10:28:05AM -0500, Mark Tinguely wrote:
> 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>

Reviewed-by: Dave Chinner <dchinner@redhat.com>
-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info
  2013-10-17 15:28 ` [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
@ 2013-10-22 23:23   ` Dave Chinner
  2013-10-23 23:43   ` Rich Johnston
  1 sibling, 0 replies; 23+ messages in thread
From: Dave Chinner @ 2013-10-22 23:23 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Thu, Oct 17, 2013 at 10:28:06AM -0500, Mark Tinguely wrote:
> 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>

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version
  2013-10-17 15:28 ` [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version Mark Tinguely
@ 2013-10-22 23:24   ` Dave Chinner
  2013-10-23 23:43   ` Rich Johnston
  1 sibling, 0 replies; 23+ messages in thread
From: Dave Chinner @ 2013-10-22 23:24 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Thu, Oct 17, 2013 at 10:28:07AM -0500, Mark Tinguely wrote:
> Add directory inode type to the xfs_db version command.
> 
> Signed-off-by: Mark Tinguely <tinguely@sgi.com>

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-17 15:28 ` [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-10-22 23:26   ` Dave Chinner
  2013-10-23 23:43   ` Rich Johnston
  2013-10-24 16:15   ` Christoph Hellwig
  2 siblings, 0 replies; 23+ messages in thread
From: Dave Chinner @ 2013-10-22 23:26 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Thu, Oct 17, 2013 at 10:28:08AM -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 automatically turned on for "-m crc=1", but reject
> the use of the "-n ftype=0|1" with the "-m crc=1" option.
> 
> Signed-off-by: Mark Tinguely <tinguely@sgi.com>

Looks OK now.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH v3 0/4] xfsprogs: v4 inode type in directory
  2013-10-18 13:22     ` Mark Tinguely
  2013-10-18 22:55       ` Dave Chinner
@ 2013-10-22 23:27       ` Dave Chinner
  1 sibling, 0 replies; 23+ messages in thread
From: Dave Chinner @ 2013-10-22 23:27 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Fri, Oct 18, 2013 at 08:22:24AM -0500, Mark Tinguely wrote:
> On 10/17/13 22:19, Dave Chinner wrote:
> >On Thu, Oct 17, 2013 at 05:08:56PM -0500, Mark Tinguely wrote:
> >>On 10/17/13 10:28, Mark Tinguely wrote:
> >>>Here are the patches that enable the inode in the directory
> >>>feature in v4 superblocks.
> >>>
> >>>Unchanged
> >>>  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
> >>>New
> >>>  patch 3: add feature to the xfs_db version command.
> >>>
> >>>Fixed
> >>>  patch 4: add the feature to mkfs.xfs and manual page.
> >>>           note: this new feature is ignored for superblock v5
> >>>		automatically turns on this feature.
> >>
> >>FYI.
> >>
> >>I saw the request for adding the filetype entry to block/leaf after posting.
> >>
> >>I have it displaying unconditionally, but am trying to figure out
> >>how to make it display only for filesytems that support the ftype
> >>feature. I am missing something in the field.count().
> >
> >The count function only tells the code whether a structure is
> >present or not, but it does not tell you what the format of the
> >structure is.
> >
> >if you look at db/dir2.c, you'll see that the difference between the
> >dir2_flds[] and the dir3_flds[] is mainly in the type, count and offset
> >fields. For example:
> >
> >const field_t   dir2_flds[] = {
> >         { "bhdr", FLDT_DIR2_DATA_HDR, OI(BOFF(magic)), dir2_block_hdr_count,
> >           FLD_COUNT, TYP_NONE }
> >...
> >
> >const field_t   dir3_flds[] = {
> >         { "bhdr", FLDT_DIR3_DATA_HDR, OI(B3OFF(hdr)), dir3_block_hdr_count,
> >           FLD_COUNT, TYP_NONE },
> >...
> >
> >if you look at dir[23]_block_hdr_count(), you'll see that they
> >return a boolean value based on a magic number check. Hence when the
> >code is trying to determine the type of the block that has been read
> >(i.e. what the field definition is), if the magic number matches we
> >know exactly what type of contents they contain.
> >
> >For decoding the dtype, you need too look at how to select the
> >correct structure for the FLDT_DIR2_DATA_UNION. If you don't have
> >the feature set, you need to select the FLDT_DIR2_DATA_UNION
> >structure type, and if it is set you need to select the
> >FLDT_DIR3_DATA_UNION type. Hence you need both these types defined
> >in the dir2_flds[] array, and some manner to ensure the correct
> >values are returned from the count functions.
> >
> >And just to make it hard, both the dir2 and dir3 data union count
> >functions use the same function (dir2_data_u_count) so you're going
> >to have to be careful that you don't break the v5 superblock
> >directory decoding....
> >
> >Cheers,
> >
> >Dave.
> 
> 
> Thanks Dave. I did some RTFS and found I was having problems with
> the field_t.flag.
> 
> Can't we add a filetype to the dir2 dir2_data_union_flds entry and
> use the count to turn it on/off? The problem I was having with this
> was the flag. Something like:
> 
> Add the directory field type information to xfs_db directory
> displays.

Can you send this as a proper patch with SOB, etc?

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] 23+ messages in thread

* [patch 5/4] xfsprogs: add field types to v4 xfs_db directory entries
  2013-10-17 15:28 [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
                   ` (4 preceding siblings ...)
  2013-10-17 22:08 ` [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
@ 2013-10-23 13:39 ` Mark Tinguely
  5 siblings, 0 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-23 13:39 UTC (permalink / raw)
  To: XFS Community List

[-- Attachment #1: 5-4-xfsprog-add-ftype-to-xfs_db-v4-dirs.patch --]
[-- Type: text/plain, Size: 1697 bytes --]

Display the inode type field that follows the name in xfs_db
for dir2 (non-crc filesystems) that enabled the feature
(mkfs -n ftype).

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
 db/dir2.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: b/db/dir2.c
===================================================================
--- a/db/dir2.c
+++ b/db/dir2.c
@@ -52,6 +52,8 @@ static int	dir2_leaf_tail_count(void *ob
 static int	dir2_leaf_tail_offset(void *obj, int startoff, int idx);
 static int	dir2_node_btree_count(void *obj, int startoff);
 static int	dir2_node_hdr_count(void *obj, int startoff);
+static int	dir3_data_union_ftype_offset(void *obj, int startoff, int idx);
+static int	dir2_data_union_ftype_count(void *obj, int startoff);
 
 const field_t	dir2_hfld[] = {
 	{ "", FLDT_DIR2, OI(0), C1, 0, TYP_NONE },
@@ -130,6 +132,8 @@ const field_t	dir2_data_union_flds[] = {
 	  dir2_data_union_namelen_count, FLD_COUNT, TYP_NONE },
 	{ "name", FLDT_CHARNS, OI(DEOFF(name)), dir2_data_union_name_count,
 	  FLD_COUNT, TYP_NONE },
+	{ "filetype", FLDT_UINT8D, dir3_data_union_ftype_offset,
+	  dir2_data_union_ftype_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
 	{ "tag", FLDT_DIR2_DATA_OFF, dir2_data_union_tag_offset,
 	  dir2_data_union_tag_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
 	{ NULL }
@@ -454,6 +458,14 @@ dir2_data_union_name_count(
 }
 
 static int
+dir2_data_union_ftype_count(
+	void			*obj,
+	int			startoff)
+{
+	return xfs_sb_version_hasftype(&mp->m_sb);
+}
+
+static int
 dir2_data_union_namelen_count(
 	void			*obj,
 	int			startoff)


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

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

* Re: [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-17 15:28 ` [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
  2013-10-22 23:26   ` Dave Chinner
@ 2013-10-23 23:43   ` Rich Johnston
  2013-10-24 16:15   ` Christoph Hellwig
  2 siblings, 0 replies; 23+ messages in thread
From: Rich Johnston @ 2013-10-23 23:43 UTC (permalink / raw)
  To: Mark Tinguely, xfs

This has been committed.

Thanks
--Rich

commit 4eb02d95b7e081b510a7015609f01385aab229a9
Author: Mark Tinguely <tinguely@sgi.com>
Date:   Thu Oct 17 15:28:08 2013 +0000

     xfsprog: add mkfs.xfs sb v4 support for dirent filetype field

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

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

* Re: [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version
  2013-10-17 15:28 ` [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version Mark Tinguely
  2013-10-22 23:24   ` Dave Chinner
@ 2013-10-23 23:43   ` Rich Johnston
  1 sibling, 0 replies; 23+ messages in thread
From: Rich Johnston @ 2013-10-23 23:43 UTC (permalink / raw)
  To: Mark Tinguely, xfs

This has been committed.

Thanks
--Rich

commit 42737f1ad16213a3dab1756c9fffb494db8ef27e
Author: Mark Tinguely <tinguely@sgi.com>
Date:   Thu Oct 17 15:28:07 2013 +0000

     xfs_progs: add dirent filetype to xfs_db version

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

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

* Re: [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info
  2013-10-17 15:28 ` [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
  2013-10-22 23:23   ` Dave Chinner
@ 2013-10-23 23:43   ` Rich Johnston
  1 sibling, 0 replies; 23+ messages in thread
From: Rich Johnston @ 2013-10-23 23:43 UTC (permalink / raw)
  To: Mark Tinguely, xfs

This has been committed.

Thanks
--Rich

commit 6f700630b06a2ce15aebe8608b2c5877002299d6
Author: Mark Tinguely <tinguely@sgi.com>
Date:   Thu Oct 17 15:28:06 2013 +0000

     xfsprog: add dirent filetype information for xfs_info

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

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

* Re: [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field
  2013-10-17 15:28 ` [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
  2013-10-22 23:23   ` Dave Chinner
@ 2013-10-23 23:47   ` Rich Johnston
  1 sibling, 0 replies; 23+ messages in thread
From: Rich Johnston @ 2013-10-23 23:47 UTC (permalink / raw)
  To: Mark Tinguely, xfs

This has been committed.

Thanks
--Rich


commit 87e343bd0937e5bb75dd8bc46ba388b6f8c6552b
Author: Mark Tinguely <tinguely@sgi.com>
Date:   Thu Oct 17 15:28:05 2013 +0000

     xfsprog: add xfs sb v4 support for dirent filetype field

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

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

* Re: [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-17 15:28 ` [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
  2013-10-22 23:26   ` Dave Chinner
  2013-10-23 23:43   ` Rich Johnston
@ 2013-10-24 16:15   ` Christoph Hellwig
  2013-10-24 21:17     ` Dave Chinner
  2 siblings, 1 reply; 23+ messages in thread
From: Christoph Hellwig @ 2013-10-24 16:15 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs

On Thu, Oct 17, 2013 at 10:28:08AM -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 automatically turned on for "-m crc=1", but reject
> the use of the "-n ftype=0|1" with the "-m crc=1" option.

Seems like this causes a spurious failure in xfs/206:


--- tests/xfs/206.out	2013-09-09 14:41:08.000000000 +0000
+++ /root/xfstests/results//xfs/206.out.bad	2013-10-24 16:13:54.000000000 +0000
@@ -5,26 +5,26 @@
          =                       sectsz=512   attr=2
 data     =                       bsize=4096   blocks=3905982455, imaxpct=5
          =                       sunit=0      swidth=0 blks
-naming   =version 2              bsize=4096   ascii-ci=0
+naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
 log      =internal log           bsize=4096   blocks=XXXXX, version=2
          =                       sectsz=512   sunit=0 blks, lazy-count=0
 realtime =none                   extsz=4096   blocks=0, rtextents=0
 === xfs_growfs ===
 meta-data=FILE                   isize=256    agcount=52, agsize=76288719 blks
-         =                       sectsz=512   attr=2
+         =                       sectsz=512   attr=2, projid32bit=1
 data     =                       bsize=4096   blocks=3905982455, imaxpct=5
          =                       sunit=0      swidth=0 blks
-naming   =version 2              bsize=4096   ascii-ci=0
+naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
 log      =internal               bsize=4096   blocks=XXXXX, version=2
          =                       sectsz=512   sunit=0 blks, lazy-count=0
 realtime =none                   extsz=4096   blocks=0, rtextents=0
 data blocks changed from 3905982455 to 4882478016
 === xfs_info ===
 meta-data=FILE                   isize=256    agcount=64, agsize=76288719 blks
-         =                       sectsz=512   attr=2
+         =                       sectsz=512   attr=2, projid32bit=1
 data     =                       bsize=4096   blocks=4882478016, imaxpct=5
          =                       sunit=0      swidth=0 blks
-naming   =version 2              bsize=4096   ascii-ci=0
+naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
 log      =internal               bsize=4096   blocks=XXXXX, version=2
          =                       sectsz=512   sunit=0 blks, lazy-count=0
 realtime =none                   extsz=4096   blocks=0, rtextents=0

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

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

* Re: [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-24 16:15   ` Christoph Hellwig
@ 2013-10-24 21:17     ` Dave Chinner
  2013-10-24 21:29       ` Mark Tinguely
  0 siblings, 1 reply; 23+ messages in thread
From: Dave Chinner @ 2013-10-24 21:17 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Mark Tinguely, xfs

On Thu, Oct 24, 2013 at 09:15:14AM -0700, Christoph Hellwig wrote:
> On Thu, Oct 17, 2013 at 10:28:08AM -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 automatically turned on for "-m crc=1", but reject
> > the use of the "-n ftype=0|1" with the "-m crc=1" option.
> 
> Seems like this causes a spurious failure in xfs/206:

Yes, it will. the xfstests repair filter needs to be updated every
time a new option is added to the output.

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] 23+ messages in thread

* Re: [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-10-24 21:17     ` Dave Chinner
@ 2013-10-24 21:29       ` Mark Tinguely
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Tinguely @ 2013-10-24 21:29 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, xfs

On 10/24/13 16:17, Dave Chinner wrote:
> On Thu, Oct 24, 2013 at 09:15:14AM -0700, Christoph Hellwig wrote:
>> On Thu, Oct 17, 2013 at 10:28:08AM -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 automatically turned on for "-m crc=1", but reject
>>> the use of the "-n ftype=0|1" with the "-m crc=1" option.
>>
>> Seems like this causes a spurious failure in xfs/206:
>
> Yes, it will. the xfstests repair filter needs to be updated every
> time a new option is added to the output.
>
> Cheers,
>
> Dave.

Thanks for the heads up.

--Mark.

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

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

end of thread, other threads:[~2013-10-24 21:29 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-17 15:28 [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
2013-10-17 15:28 ` [PATCH v3 1/4] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
2013-10-22 23:23   ` Dave Chinner
2013-10-23 23:47   ` Rich Johnston
2013-10-17 15:28 ` [PATCH v3 2/4] xfsprog: add dirent filetype information for xfs_info Mark Tinguely
2013-10-22 23:23   ` Dave Chinner
2013-10-23 23:43   ` Rich Johnston
2013-10-17 15:28 ` [PATCH v3 3/4] xfs_progs: add dirent filetype to xfs_db version Mark Tinguely
2013-10-22 23:24   ` Dave Chinner
2013-10-23 23:43   ` Rich Johnston
2013-10-17 15:28 ` [PATCH v3 4/4] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field Mark Tinguely
2013-10-22 23:26   ` Dave Chinner
2013-10-23 23:43   ` Rich Johnston
2013-10-24 16:15   ` Christoph Hellwig
2013-10-24 21:17     ` Dave Chinner
2013-10-24 21:29       ` Mark Tinguely
2013-10-17 22:08 ` [PATCH v3 0/4] xfsprogs: v4 inode type in directory Mark Tinguely
2013-10-18  3:19   ` Dave Chinner
2013-10-18 13:22     ` Mark Tinguely
2013-10-18 22:55       ` Dave Chinner
2013-10-20 18:17         ` Mark Tinguely
2013-10-22 23:27       ` Dave Chinner
2013-10-23 13:39 ` [patch 5/4] xfsprogs: add field types to v4 xfs_db directory entries Mark Tinguely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.