public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] xfsprogs: field types in the directory under v4
@ 2013-08-22 18:50 Mark Tinguely
  2013-08-22 18:50 ` [PATCH 1/2] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
  2013-08-22 18:50 ` [PATCH 2/2] xfsprog: add mkfs.xfs " Mark Tinguely
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Tinguely @ 2013-08-22 18:50 UTC (permalink / raw)
  To: xfs

These patches turn on the field types in the directory feature.

Patch one adds the field type feature bit and feature check.
	  this is just like the kernel version.

Patch two adds the feature to mkfs.xfs using a new "-n ftype=1" option.
	  always enable the feature in v5.

These are additions to Dave's Linux 3.12 and field type support patches:
	http://oss.sgi.com/archives/xfs/2013-07/msg00454.html.

01-49-xfsprogs-introduce-xfs_icreate.h.patch
..
47-49-xfs-Add-read-only-support-for-dirent-filetype-field.patch
# patch one below
47-add-dir-filetype-to-inode-v2.patch
48-49-xfs-Add-write-support-for-dirent-filetype-field.patch
49-49-xfsprogs-add-dtype-support-to-mkfs-and-db.patch
# patch two below
49-add-dir-filetype-to-inode-v2.patch

Minor syncing of the 49 patch series is required due to recent commits.

--Mark.

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

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

* [PATCH 1/2] xfsprog: add xfs sb v4 support for dirent filetype field
  2013-08-22 18:50 [PATCH 0/2] xfsprogs: field types in the directory under v4 Mark Tinguely
@ 2013-08-22 18:50 ` Mark Tinguely
  2013-08-22 18:50 ` [PATCH 2/2] xfsprog: add mkfs.xfs " Mark Tinguely
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Tinguely @ 2013-08-22 18:50 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 47-add-dir-filetype-to-inode-v2.patch --]
[-- Type: text/plain, Size: 2169 bytes --]

Add xfsprog superblock v4 support for the file type field in the
directory entry feature.

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>
---
 include/xfs_sb.h |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 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	\
@@ -615,11 +617,6 @@ xfs_sb_has_incompat_log_feature(
 	return (sbp->sb_features_log_incompat & feature) != 0;
 }
 
-static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)
-{
-	return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
-}
-
 /*
  * V5 superblock specific feature checks
  */
@@ -628,10 +625,17 @@ static inline int xfs_sb_version_hascrc(
 	return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
 }
 
+static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)
+{
+	return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
+}
+
 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] 3+ messages in thread

* [PATCH 2/2] xfsprog: add mkfs.xfs sb v4 support for dirent filetype field
  2013-08-22 18:50 [PATCH 0/2] xfsprogs: field types in the directory under v4 Mark Tinguely
  2013-08-22 18:50 ` [PATCH 1/2] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
@ 2013-08-22 18:50 ` Mark Tinguely
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Tinguely @ 2013-08-22 18:50 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: 49-add-dir-filetype-to-inode-v2.patch --]
[-- Type: text/plain, Size: 5625 bytes --]

Add mkfs.xfs entry that enables the filetype field in the directory
feature bit.

In sb v4, "mkfs.xfs -n ftype=1 DEVICE" turns on the feature.
The feature is automatically turned on for sb v5 like it was
in the original patch.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
 man/man8/mkfs.xfs.8 |    7 +++++++
 mkfs/xfs_mkfs.c     |   40 +++++++++++++++++++++++++++-------------
 mkfs/xfs_mkfs.h     |    4 +++-
 3 files changed, 37 insertions(+), 14 deletions(-)

Index: b/man/man8/mkfs.xfs.8
===================================================================
--- a/man/man8/mkfs.xfs.8
+++ b/man/man8/mkfs.xfs.8
@@ -517,6 +517,13 @@ 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
+The inode type is stored in the directory
+.I value
+can be either 0 or 1.
+With 0 meaning not supported (default) and 1 meaning supported.
+.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;
@@ -931,6 +934,7 @@ main(
 	int			nodsflag;
 	int			norsflag;
 	xfs_alloc_rec_t		*nrec;
+	int			niflag;
 	int			nsflag;
 	int			nvflag;
 	int			nci;
@@ -977,8 +981,8 @@ main(
 	loginternal = 1;
 	logversion = 2;
 	logagno = logblocks = rtblocks = rtextblocks = 0;
-	Nflag = nlflag = nsflag = nvflag = nci = 0;
-	dirblocklog = dirblocksize = 0;
+	Nflag = niflag = nlflag = nsflag = nvflag = nci = 0;
+	dirftype = dirblocklog = dirblocksize = 0;
 	dirversion = XFS_DFL_DIR_VERSION;
 	qflag = 0;
 	imaxpct = inodelog = inopblock = isize = 0;
@@ -1534,6 +1538,14 @@ main(
 					}
 					nvflag = 1;
 					break;
+				case N_FTYPE:
+					if (!value || *value == '\0')
+						reqval('n', nopts, N_FTYPE);
+					if (niflag)
+						respec('n', nopts, N_FTYPE);
+					dirftype = atoi(value);
+					niflag = 1;
+					break;
 				default:
 					unknown('n', value);
 				}
@@ -2433,7 +2445,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"),
@@ -2442,7 +2454,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,
@@ -2504,21 +2516,23 @@ _("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);
-	sbp->sb_versionnum = XFS_SB_VERSION_MKFS(crcs_enabled, iaflag,
-					dsunit != 0,
-					logversion == 2, attrversion == 1,
-					(sectorsize != BBSIZE ||
-							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;
+		dirftype = 1;
 	}
 
+	sbp->sb_features2 = XFS_SB_VERSION2_MKFS(crcs_enabled, lazy_sb_counters,
+				   attrversion == 2, !projid16bit, 0, dirftype);
+	sbp->sb_versionnum = XFS_SB_VERSION_MKFS(crcs_enabled, iaflag,
+					dsunit != 0,
+					logversion == 2, attrversion == 1,
+					(sectorsize != BBSIZE ||
+							lsectorsize != BBSIZE),
+					nci, sbp->sb_features2 != 0);
 	/*
 	 * Due to a structure alignment issue, sb_features2 ended up in one
 	 * of two locations, the second "incorrect" location represented by
@@ -3057,7 +3071,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] 3+ messages in thread

end of thread, other threads:[~2013-08-22 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 18:50 [PATCH 0/2] xfsprogs: field types in the directory under v4 Mark Tinguely
2013-08-22 18:50 ` [PATCH 1/2] xfsprog: add xfs sb v4 support for dirent filetype field Mark Tinguely
2013-08-22 18:50 ` [PATCH 2/2] xfsprog: add mkfs.xfs " Mark Tinguely

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