Skip to contentSkip to conversation

***** SUSPECTED SPAM ***** [PATCH 00/50] xfs: patches for 3.12

DISCUSSION Applied Dave Chinner 7 participants 86 messages Aug 12, 2013 – Aug 26, 2013 XFS filesystem

lore
Share & tools
lore
#0 lore raw

Hi folks,

This is a rebase of the reviewed series of kernel patches I recently posted here:

http://oss.sgi.com/pipermail/xfs/2013-July/028207.html

It addresses all the review comments except for one from Christoph about the IOP_SIZE removal - I'll send a followup patch in a couple of days to remove all the rest of IOP_ macros...

The log space problems from the optimisations have been fixed - the fix went into patch 44 of this series, and cascaded through 45 and 46 as well. Those patches will need reviewing. The problematic workload has been running for 16 hours here without failure on a small (10MB) log, so AFAICT the problem is fixed.

There is one new patch - the fix to the use-after-free of clean buffer items when a transaction is cancelled - and that is at the end of the series.

Cheers,

Dave.

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

#1 lore raw

***** SUSPECTED SPAM ***** [PATCH 03/50] xfs: split out buf log item format definitions

From: Dave Chinner <[email protected]>

---
 fs/xfs/xfs_buf_item.h   | 100 ++----------------------------------------------
 fs/xfs/xfs_log_format.h |  97 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+), 97 deletions(-)
fs/xfs/xfs_buf_item.h +3 -97
index 0f1c247..db63710 100644
@@ -18,101 +18,9 @@
 #ifndef	__XFS_BUF_ITEM_H__
 #define	__XFS_BUF_ITEM_H__
 
-extern kmem_zone_t	*xfs_buf_item_zone;
-
-/*
- * This flag indicates that the buffer contains on disk inodes
- * and requires special recovery handling.
- */
-#define	XFS_BLF_INODE_BUF	(1<<0)
-/*
- * This flag indicates that the buffer should not be replayed
- * during recovery because its blocks are being freed.
- */
-#define	XFS_BLF_CANCEL		(1<<1)
-
-/*
- * This flag indicates that the buffer contains on disk
- * user or group dquots and may require special recovery handling.
- */
-#define	XFS_BLF_UDQUOT_BUF	(1<<2)
-#define XFS_BLF_PDQUOT_BUF	(1<<3)
-#define	XFS_BLF_GDQUOT_BUF	(1<<4)
-
-#define	XFS_BLF_CHUNK		128
-#define	XFS_BLF_SHIFT		7
-#define	BIT_TO_WORD_SHIFT	5
-#define	NBWORD			(NBBY * sizeof(unsigned int))
-
-/*
- * This is the structure used to lay out a buf log item in the
- * log.  The data map describes which 128 byte chunks of the buffer
- * have been logged.
- */
-#define XFS_BLF_DATAMAP_SIZE	((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD)
+/* kernel only definitions */
 
-typedef struct xfs_buf_log_format {
-	unsigned short	blf_type;	/* buf log item type indicator */
-	unsigned short	blf_size;	/* size of this item */
-	ushort		blf_flags;	/* misc state */
-	ushort		blf_len;	/* number of blocks in this buf */
-	__int64_t	blf_blkno;	/* starting blkno of this buf */
-	unsigned int	blf_map_size;	/* used size of data bitmap in words */
-	unsigned int	blf_data_map[XFS_BLF_DATAMAP_SIZE]; /* dirty bitmap */
-} xfs_buf_log_format_t;
-
-/*
- * All buffers now need to tell recovery where the magic number
- * is so that it can verify and calculate the CRCs on the buffer correctly
- * once the changes have been replayed into the buffer.
- *
- * The type value is held in the upper 5 bits of the blf_flags field, which is
- * an unsigned 16 bit field. Hence we need to shift it 11 bits up and down.
- */
-#define XFS_BLFT_BITS	5
-#define XFS_BLFT_SHIFT	11
-#define XFS_BLFT_MASK	(((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT)
-
-enum xfs_blft {
-	XFS_BLFT_UNKNOWN_BUF = 0,
-	XFS_BLFT_UDQUOT_BUF,
-	XFS_BLFT_PDQUOT_BUF,
-	XFS_BLFT_GDQUOT_BUF,
-	XFS_BLFT_BTREE_BUF,
-	XFS_BLFT_AGF_BUF,
-	XFS_BLFT_AGFL_BUF,
-	XFS_BLFT_AGI_BUF,
-	XFS_BLFT_DINO_BUF,
-	XFS_BLFT_SYMLINK_BUF,
-	XFS_BLFT_DIR_BLOCK_BUF,
-	XFS_BLFT_DIR_DATA_BUF,
-	XFS_BLFT_DIR_FREE_BUF,
-	XFS_BLFT_DIR_LEAF1_BUF,
-	XFS_BLFT_DIR_LEAFN_BUF,
-	XFS_BLFT_DA_NODE_BUF,
-	XFS_BLFT_ATTR_LEAF_BUF,
-	XFS_BLFT_ATTR_RMT_BUF,
-	XFS_BLFT_SB_BUF,
-	XFS_BLFT_MAX_BUF = (1 << XFS_BLFT_BITS),
-};
-
-static inline void
-xfs_blft_to_flags(struct xfs_buf_log_format *blf, enum xfs_blft type)
-{
-	ASSERT(type > XFS_BLFT_UNKNOWN_BUF && type < XFS_BLFT_MAX_BUF);
-	blf->blf_flags &= ~XFS_BLFT_MASK;
-	blf->blf_flags |= ((type << XFS_BLFT_SHIFT) & XFS_BLFT_MASK);
-}
-
-static inline __uint16_t
-xfs_blft_from_flags(struct xfs_buf_log_format *blf)
-{
-	return (blf->blf_flags & XFS_BLFT_MASK) >> XFS_BLFT_SHIFT;
-}
-
-/*
- * buf log item flags
- */
+/* buf log item flags */
 #define	XFS_BLI_HOLD		0x01
 #define	XFS_BLI_DIRTY		0x02
 #define	XFS_BLI_STALE		0x04
@@ -133,8 +41,6 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf)
 	{ XFS_BLI_ORDERED,	"ORDERED" }
 
 
-#ifdef __KERNEL__
-
 struct xfs_buf;
 struct xfs_mount;
 struct xfs_buf_log_item;
@@ -169,6 +75,6 @@ void	xfs_trans_buf_set_type(struct xfs_trans *, struct xfs_buf *,
 			       enum xfs_blft);
 void	xfs_trans_buf_copy_type(struct xfs_buf *dst_bp, struct xfs_buf *src_bp);
 
-#endif	/* __KERNEL__ */
+extern kmem_zone_t	*xfs_buf_item_zone;
 
 #endif	/* __XFS_BUF_ITEM_H__ */
fs/xfs/xfs_log_format.h +97 -0

101 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 02/50] xfs: split out inode log item format definition

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The log item format definitions are shared with userspace. Split them out of header files that contain kernel only defintions to make it simple to shared them.

---
 fs/xfs/xfs_acl.c        |   1 +
 fs/xfs/xfs_filestream.c |   2 +-
 fs/xfs/xfs_inode.h      |  69 ------------------
 fs/xfs/xfs_inode_item.h | 115 +----------------------------
 fs/xfs/xfs_log_format.h | 189 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_types.h      |   6 ++
 fs/xfs/xfs_xattr.c      |   1 +
 7 files changed, 200 insertions(+), 183 deletions(-)
fs/xfs/xfs_acl.c +1 -0
index 306d883..695606a 100644
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
+#include "xfs_log_format.h"
 #include "xfs_acl.h"
 #include "xfs_attr.h"
 #include "xfs_bmap_btree.h"
fs/xfs/xfs_filestream.c +1 -1
index 5170306..9eae097 100644
@@ -16,12 +16,12 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
+#include "xfs_log.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_inum.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_ag.h"
-#include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_mount.h"
fs/xfs/xfs_inode.h +0 -69

87 lines not on this page · raw message

fs/xfs/xfs_inode_item.h +2 -113

138 lines not on this page · raw message

fs/xfs/xfs_log_format.h +189 -0

199 lines not on this page · raw message

fs/xfs/xfs_types.h +6 -0
index 61ba1cf..39c48ca 100644
@@ -146,6 +146,12 @@ typedef __uint64_t	xfs_filblks_t;	/* number of blocks in a file */
 #define XFS_MAX_SECTORSIZE	(1 << XFS_MAX_SECTORSIZE_LOG)
 
 /*
+ * Inode fork identifiers.
+ */
+#define	XFS_DATA_FORK	0
+#define	XFS_ATTR_FORK	1
+
+/*
  * Min numbers of data/attr fork btree root pointers.
  */
 #define MINDBTPTRS	3
fs/xfs/xfs_xattr.c +1 -0
index 87d3e03..b7311aa 100644
@@ -17,6 +17,7 @@
  */
 
 #include "xfs.h"
+#include "xfs_log_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_inode.h"
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 49/50] xfs: Add write support for dirent filetype field

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Add support to propagate and add filetype values into the on-disk directs. This involves passing the filetype into the xfs_da_args structure along with the name and namelength for direct operations, and encoding it into the dirent at the same time we write the inode number into the dirent.

With write support, add the feature flag to the XFS_SB_FEAT_INCOMPAT_ALL mask so we can now mount filesystems with this feature set.

Performance of directory recursion is now much improved. Parallel walk of ~50 million directory entries across hundreds of directories improves significantly. Unpatched, no CRCs:

Walking via ls -R

real    3m19.886s
user    6m36.960s
sys     28m19.087s

THis is doing roughly 500 getdents() calls per second, and 250,000 inode lookups per second to determine the inode type at roughly 17,000 read IOPS. CPU usage is 90% kernel space.

With dtype support patched in and the fileset recreated with CRCs enabled:

Walking via ls -R

real    0m31.316s
user    6m32.975s
sys     0m21.111s

This is doing roughly 3500 getdents() calls per second at 16,000 IOPS. There are no inode lookups at all. CPU usages is almost 100% userspace.

This is a big win for recursive directory walks that only need to find file names and file types.

---
 fs/xfs/xfs_dir2.c       |  3 +++
 fs/xfs/xfs_dir2_block.c |  7 +++++++
 fs/xfs/xfs_dir2_data.c  |  2 ++
 fs/xfs/xfs_dir2_leaf.c  |  3 +++
 fs/xfs/xfs_dir2_node.c  |  3 +++
 fs/xfs/xfs_dir2_sf.c    | 35 +++++++++++++++++++++++++++--------
 fs/xfs/xfs_sb.h         |  3 ++-
 7 files changed, 47 insertions(+), 9 deletions(-)
fs/xfs/xfs_dir2.c +3 -0
index f9825b1..d3ff96c 100644
@@ -209,6 +209,7 @@ xfs_dir_createname(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.inumber = inum;
 	args.dp = dp;
@@ -283,6 +284,7 @@ xfs_dir_lookup(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.dp = dp;
 	args.whichfork = XFS_DATA_FORK;
@@ -338,6 +340,7 @@ xfs_dir_removename(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.inumber = ino;
 	args.dp = dp;
fs/xfs/xfs_dir2_block.c +7 -0
index 1cd2f56..0957aa9 100644
@@ -549,6 +549,7 @@ xfs_dir2_block_addname(
 	dep->inumber = cpu_to_be64(args->inumber);
 	dep->namelen = args->namelen;
 	memcpy(dep->name, args->name, args->namelen);
+	xfs_dir3_dirent_put_ftype(mp, dep, args->filetype);
 	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	/*
@@ -641,6 +642,7 @@ xfs_dir2_block_lookup(
 	 * Fill in inode number, CI name if appropriate, release the block.
 	 */
 	args->inumber = be64_to_cpu(dep->inumber);
+	args->filetype = xfs_dir3_dirent_get_ftype(mp, dep);
 	error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
 	xfs_trans_brelse(args->trans, bp);
 	return XFS_ERROR(error);
@@ -873,6 +875,7 @@ xfs_dir2_block_replace(
 	 * Change the inode number to the new value.
 	 */
 	dep->inumber = cpu_to_be64(args->inumber);
+	xfs_dir3_dirent_put_ftype(mp, dep, args->filetype);
 	xfs_dir2_data_log_entry(args->trans, bp, dep);
 	xfs_dir3_data_check(dp, bp);
 	return 0;
@@ -1159,6 +1162,7 @@ xfs_dir2_sf_to_block(
 	dep->inumber = cpu_to_be64(dp->i_ino);
 	dep->namelen = 1;
 	dep->name[0] = '.';
+	xfs_dir3_dirent_put_ftype(mp, dep, XFS_DIR3_FT_DIR);
 	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	xfs_dir2_data_log_entry(tp, bp, dep);
@@ -1172,6 +1176,7 @@ xfs_dir2_sf_to_block(
 	dep->inumber = cpu_to_be64(xfs_dir2_sf_get_parent_ino(sfp));
 	dep->namelen = 2;
 	dep->name[0] = dep->name[1] = '.';
+	xfs_dir3_dirent_put_ftype(mp, dep, XFS_DIR3_FT_DIR);
 	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	xfs_dir2_data_log_entry(tp, bp, dep);
@@ -1219,6 +1224,8 @@ xfs_dir2_sf_to_block(
 		dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset);
 		dep->inumber = cpu_to_be64(xfs_dir3_sfe_get_ino(mp, sfp, sfep));
 		dep->namelen = sfep->namelen;
+		xfs_dir3_dirent_put_ftype(mp, dep,
+					xfs_dir3_sfe_get_ftype(mp, sfp, sfep));
 		memcpy(dep->name, sfep->name, dep->namelen);
 		tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 		*tagp = cpu_to_be16((char *)dep - (char *)hdr);
fs/xfs/xfs_dir2_data.c +2 -0
index 1b59e43..47e1326 100644
@@ -149,6 +149,8 @@ __xfs_dir3_data_check(
 		XFS_WANT_CORRUPTED_RETURN(
 			be16_to_cpu(*xfs_dir3_data_entry_tag_p(mp, dep)) ==
 					       (char *)dep - (char *)hdr);
+		XFS_WANT_CORRUPTED_RETURN(
+			xfs_dir3_dirent_get_ftype(mp, dep) < XFS_DIR3_FT_MAX);
 		count++;
 		lastfree = 0;
 		if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
fs/xfs/xfs_dir2_leaf.c +3 -0
index 887b1bd..08984ee 100644
@@ -897,6 +897,7 @@ xfs_dir2_leaf_addname(
 	dep->inumber = cpu_to_be64(args->inumber);
 	dep->namelen = args->namelen;
 	memcpy(dep->name, args->name, dep->namelen);
+	xfs_dir3_dirent_put_ftype(mp, dep, args->filetype);
 	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	/*
@@ -1225,6 +1226,7 @@ xfs_dir2_leaf_lookup(
 	 * Return the found inode number & CI name if appropriate
 	 */
 	args->inumber = be64_to_cpu(dep->inumber);
+	args->filetype = xfs_dir3_dirent_get_ftype(dp->i_mount, dep);
 	error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
 	xfs_trans_brelse(tp, dbp);
 	xfs_trans_brelse(tp, lbp);
@@ -1555,6 +1557,7 @@ xfs_dir2_leaf_replace(
 	 * Put the new inode number in, log it.
 	 */
 	dep->inumber = cpu_to_be64(args->inumber);
+	xfs_dir3_dirent_put_ftype(dp->i_mount, dep, args->filetype);
 	tp = args->trans;
 	xfs_dir2_data_log_entry(tp, dbp, dep);
 	xfs_dir3_leaf_check(dp->i_mount, lbp);
fs/xfs/xfs_dir2_node.c +3 -0
index 49f1e9e..4c3dba7 100644
@@ -816,6 +816,7 @@ xfs_dir2_leafn_lookup_for_entry(
 				xfs_trans_brelse(tp, state->extrablk.bp);
 			args->cmpresult = cmp;
 			args->inumber = be64_to_cpu(dep->inumber);
+			args->filetype = xfs_dir3_dirent_get_ftype(mp, dep);
 			*indexp = index;
 			state->extravalid = 1;
 			state->extrablk.bp = curbp;
@@ -2007,6 +2008,7 @@ xfs_dir2_node_addname_int(
 	dep->inumber = cpu_to_be64(args->inumber);
 	dep->namelen = args->namelen;
 	memcpy(dep->name, args->name, dep->namelen);
+	xfs_dir3_dirent_put_ftype(mp, dep, args->filetype);
 	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	xfs_dir2_data_log_entry(tp, dbp, dep);
@@ -2227,6 +2229,7 @@ xfs_dir2_node_replace(
 		 * Fill in the new inode number and log the entry.
 		 */
 		dep->inumber = cpu_to_be64(inum);
+		xfs_dir3_dirent_put_ftype(state->mp, dep, args->filetype);
 		xfs_dir2_data_log_entry(args->trans, state->extrablk.bp, dep);
 		rval = 0;
 	}
fs/xfs/xfs_dir2_sf.c +27 -8
index bd14e1a..bb6e284 100644
@@ -333,6 +333,8 @@ xfs_dir2_block_to_sf(
 			memcpy(sfep->name, dep->name, dep->namelen);
 			xfs_dir3_sfe_put_ino(mp, sfp, sfep,
 					     be64_to_cpu(dep->inumber));
+			xfs_dir3_sfe_put_ftype(mp, sfp, sfep,
+					xfs_dir3_dirent_get_ftype(mp, dep));
 
 			sfep = xfs_dir3_sf_nextentry(mp, sfp, sfep);
 		}
@@ -496,6 +498,8 @@ xfs_dir2_sf_addname_easy(
 	xfs_dir2_sf_put_offset(sfep, offset);
 	memcpy(sfep->name, args->name, sfep->namelen);
 	xfs_dir3_sfe_put_ino(dp->i_mount, sfp, sfep, args->inumber);
+	xfs_dir3_sfe_put_ftype(dp->i_mount, sfp, sfep, args->filetype);
+
 	/*
 	 * Update the header and inode.
 	 */
@@ -589,6 +593,7 @@ xfs_dir2_sf_addname_hard(
 	xfs_dir2_sf_put_offset(sfep, offset);
 	memcpy(sfep->name, args->name, sfep->namelen);
 	xfs_dir3_sfe_put_ino(mp, sfp, sfep, args->inumber);
+	xfs_dir3_sfe_put_ftype(mp, sfp, sfep, args->filetype);
 	sfp->count++;
 #if XFS_BIG_INUMS
 	if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange)
@@ -825,6 +830,7 @@ xfs_dir2_sf_lookup(
 	if (args->namelen == 1 && args->name[0] == '.') {
 		args->inumber = dp->i_ino;
 		args->cmpresult = XFS_CMP_EXACT;
+		args->filetype = XFS_DIR3_FT_DIR;
 		return XFS_ERROR(EEXIST);
 	}
 	/*
@@ -834,6 +840,7 @@ xfs_dir2_sf_lookup(
 	    args->name[0] == '.' && args->name[1] == '.') {
 		args->inumber = xfs_dir2_sf_get_parent_ino(sfp);
 		args->cmpresult = XFS_CMP_EXACT;
+		args->filetype = XFS_DIR3_FT_DIR;
 		return XFS_ERROR(EEXIST);
 	}
 	/*
@@ -853,6 +860,8 @@ xfs_dir2_sf_lookup(
 			args->cmpresult = cmp;
 			args->inumber = xfs_dir3_sfe_get_ino(dp->i_mount,
 							     sfp, sfep);
+			args->filetype = xfs_dir3_sfe_get_ftype(dp->i_mount,
+								sfp, sfep);
 			if (cmp == XFS_CMP_EXACT)
 				return XFS_ERROR(EEXIST);
 			ci_sfep = sfep;
@@ -1052,6 +1061,8 @@ xfs_dir2_sf_replace(
 #endif
 				xfs_dir3_sfe_put_ino(dp->i_mount, sfp, sfep,
 						     args->inumber);
+				xfs_dir3_sfe_put_ftype(dp->i_mount, sfp, sfep,
+						       args->filetype);
 				break;
 			}
 		}
@@ -1118,10 +1129,12 @@ xfs_dir2_sf_toino4(
 	int			oldsize;	/* old inode size */
 	xfs_dir2_sf_entry_t	*sfep;		/* new sf entry */
 	xfs_dir2_sf_hdr_t	*sfp;		/* new sf directory */
+	struct xfs_mount	*mp;
 
 	trace_xfs_dir2_sf_toino4(args);
 
 	dp = args->dp;
+	mp = dp->i_mount;
 
 	/*
 	 * Copy the old directory to the buffer.
@@ -1159,13 +1172,15 @@ xfs_dir2_sf_toino4(
 	for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp),
 		    oldsfep = xfs_dir2_sf_firstentry(oldsfp);
 	     i < sfp->count;
-	     i++, sfep = xfs_dir3_sf_nextentry(dp->i_mount, sfp, sfep),
-		  oldsfep = xfs_dir3_sf_nextentry(dp->i_mount, oldsfp, oldsfep)) {
+	     i++, sfep = xfs_dir3_sf_nextentry(mp, sfp, sfep),
+		  oldsfep = xfs_dir3_sf_nextentry(mp, oldsfp, oldsfep)) {
 		sfep->namelen = oldsfep->namelen;
 		sfep->offset = oldsfep->offset;
 		memcpy(sfep->name, oldsfep->name, sfep->namelen);
-		xfs_dir3_sfe_put_ino(dp->i_mount, sfp, sfep,
-			xfs_dir3_sfe_get_ino(dp->i_mount, oldsfp, oldsfep));
+		xfs_dir3_sfe_put_ino(mp, sfp, sfep,
+			xfs_dir3_sfe_get_ino(mp, oldsfp, oldsfep));
+		xfs_dir3_sfe_put_ftype(mp, sfp, sfep,
+			xfs_dir3_sfe_get_ftype(mp, oldsfp, oldsfep));
 	}
 	/*
 	 * Clean up the inode.
@@ -1193,10 +1208,12 @@ xfs_dir2_sf_toino8(
 	int			oldsize;	/* old inode size */
 	xfs_dir2_sf_entry_t	*sfep;		/* new sf entry */
 	xfs_dir2_sf_hdr_t	*sfp;		/* new sf directory */
+	struct xfs_mount	*mp;
 
 	trace_xfs_dir2_sf_toino8(args);
 
 	dp = args->dp;
+	mp = dp->i_mount;
 
 	/*
 	 * Copy the old directory to the buffer.
@@ -1234,13 +1251,15 @@ xfs_dir2_sf_toino8(
 	for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp),
 		    oldsfep = xfs_dir2_sf_firstentry(oldsfp);
 	     i < sfp->count;
-	     i++, sfep = xfs_dir3_sf_nextentry(dp->i_mount, sfp, sfep),
-		  oldsfep = xfs_dir3_sf_nextentry(dp->i_mount, oldsfp, oldsfep)) {
+	     i++, sfep = xfs_dir3_sf_nextentry(mp, sfp, sfep),
+		  oldsfep = xfs_dir3_sf_nextentry(mp, oldsfp, oldsfep)) {
 		sfep->namelen = oldsfep->namelen;
 		sfep->offset = oldsfep->offset;
 		memcpy(sfep->name, oldsfep->name, sfep->namelen);
-		xfs_dir3_sfe_put_ino(dp->i_mount, sfp, sfep,
-			xfs_dir3_sfe_get_ino(dp->i_mount, oldsfp, oldsfep));
+		xfs_dir3_sfe_put_ino(mp, sfp, sfep,
+			xfs_dir3_sfe_get_ino(mp, oldsfp, oldsfep));
+		xfs_dir3_sfe_put_ftype(mp, sfp, sfep,
+			xfs_dir3_sfe_get_ftype(mp, oldsfp, oldsfep));
 	}
 	/*
 	 * Clean up the inode.
fs/xfs/xfs_sb.h +2 -1
index 3c297a4..c8d8898 100644
@@ -594,7 +594,8 @@ xfs_sb_has_ro_compat_feature(
 }
 
 #define XFS_SB_FEAT_INCOMPAT_FTYPE	(1 << 0)	/* filetype in dirent */
-#define XFS_SB_FEAT_INCOMPAT_ALL 0
+#define XFS_SB_FEAT_INCOMPAT_ALL \
+		(XFS_SB_FEAT_INCOMPAT_FTYPE)
 
 #define XFS_SB_FEAT_INCOMPAT_UNKNOWN	~XFS_SB_FEAT_INCOMPAT_ALL
 static inline bool
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 42/50] xfs: Validate log space at mount time

In reply to Dave Chinner

From: Jie Liu <[email protected]>

Validate log space during log mount stage, the underlying function will drop a warning message via syslog in critical level if the log space is too small or too large.

[ dchinner: For CRC enable filesystems, abort the mounting of the filesystem as mkfs should never make a log too small for the given filesystem configuration. ]

[ dchinner: make a note of the fact that the log size limits in block counts are in units of filesystem blocks, not basic blocks. ]

---
 fs/xfs/xfs_fs.h  |  4 +++-
 fs/xfs/xfs_log.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 2 deletions(-)
fs/xfs/xfs_fs.h +3 -1
index 74b24b2..53e33c2 100644
@@ -240,7 +240,9 @@ typedef struct xfs_fsop_resblks {
 
 
 /*
- * Minimum and maximum sizes need for growth checks
+ * Minimum and maximum sizes need for growth checks.
+ *
+ * Block counts are in units of filesystem blocks, not basic blocks.
  */
 #define XFS_MIN_AG_BLOCKS	64
 #define XFS_MIN_LOG_BLOCKS	512ULL
fs/xfs/xfs_log.c +46 -1

59 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by
#5 lore raw

Re: ***** SUSPECTED SPAM ***** [PATCH 42/50] xfs: Validate log space at mount time

Quoted 41 lines · Dave Chinner

From: Jie Liu<[email protected]>

Validate log space during log mount stage, the underlying function will drop a warning message via syslog in critical level if the log space is too small or too large.

[ dchinner: For CRC enable filesystems, abort the mounting of the filesystem as mkfs should never make a log too small for the given filesystem configuration. ]

[ dchinner: make a note of the fact that the log size limits in block counts are in units of filesystem blocks, not basic blocks. ]

---
  fs/xfs/xfs_fs.h  |  4 +++-
  fs/xfs/xfs_log.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
  2 files changed, 49 insertions(+), 2 deletions(-)
fs/xfs/xfs_fs.h +3 -1
index 74b24b2..53e33c2 100644
@@ -240,7 +240,9 @@ typedef struct xfs_fsop_resblks {
 
 
  /*
- * Minimum and maximum sizes need for growth checks
+ * Minimum and maximum sizes need for growth checks.
+ *
+ * Block counts are in units of filesystem blocks, not basic blocks.
   */
  #define XFS_MIN_AG_BLOCKS	64
  #define XFS_MIN_LOG_BLOCKS	512ULL
fs/xfs/xfs_log.c +0 -0
index 704f095..b5703cc 100644
@@ -631,6 +632,50 @@ xfs_log_mount(

...

fs/xfs/xfs_log.c

Quoted 1 line
fs/xfs/xfs_log.c +1 -0
+	} else if (mp->m_sb.sb_logblocks>  XFS_MAX_LOG_BLOCKS) {

oops - missed that.

fs/xfs/xfs_log.c xfs_log_mount( · line 659

Quoted 4 lines
fs/xfs/xfs_log.c +4 -0
+		xfs_warn(mp,
+		"Log size %d blocks too large, maximum size is %lld blocks",
+			 mp->m_sb.sb_logblocks, XFS_MAX_LOG_BLOCKS);
+		error = EINVAL;

Also, the code to this point in the series has been compared (patches and individual files). The items that I mentioned in the previous review have been dealt this.

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

#6 lore raw

***** SUSPECTED SPAM ***** [PATCH 01/50] xfs: separate out log format definitions

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that xfs_log.h and xfs_log_priv.h no longer need to be shared with userspace.

---
 fs/xfs/xfs_log.h         |  89 ++++++------------------
 fs/xfs/xfs_log_format.h  | 178 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_log_priv.h    | 146 ++------------------------------------
 fs/xfs/xfs_log_recover.c |   2 +
 4 files changed, 207 insertions(+), 208 deletions(-)
 create mode 100644 fs/xfs/xfs_log_format.h
fs/xfs/xfs_log.h +21 -68
index fb630e4..e63d9e1 100644
@@ -18,14 +18,29 @@
 #ifndef	__XFS_LOG_H__
 #define __XFS_LOG_H__
 
-/* get lsn fields */
-#define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
-#define BLOCK_LSN(lsn) ((uint)(lsn))
+#include "xfs_log_format.h"
 
-/* this is used in a spot where we might otherwise double-endian-flip */
-#define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0])
+struct xfs_log_vec {
+	struct xfs_log_vec	*lv_next;	/* next lv in build list */
+	int			lv_niovecs;	/* number of iovecs in lv */
+	struct xfs_log_iovec	*lv_iovecp;	/* iovec array */
+	struct xfs_log_item	*lv_item;	/* owner */
+	char			*lv_buf;	/* formatted buffer */
+	int			lv_buf_len;	/* size of formatted buffer */
+};
+
+#define XFS_LOG_VEC_ORDERED	(-1)
+
+/*
+ * Structure used to pass callback function and the function's argument
+ * to the log manager.
+ */
+typedef struct xfs_log_callback {
+	struct xfs_log_callback	*cb_next;
+	void			(*cb_func)(void *, int);
+	void			*cb_arg;
+} xfs_log_callback_t;
 
-#ifdef __KERNEL__
 /*
  * By comparing each component, we don't have to worry about extra
  * endian issues in treating two 32 bit numbers as one 64 bit number
@@ -59,67 +74,6 @@ static inline xfs_lsn_t	_lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
  */
 #define XFS_LOG_SYNC		0x1
 
-#endif	/* __KERNEL__ */
-
-
-/* Log Clients */
-#define XFS_TRANSACTION		0x69
-#define XFS_VOLUME		0x2
-#define XFS_LOG			0xaa
-
-
-/* Region types for iovec's i_type */
-#define XLOG_REG_TYPE_BFORMAT		1
-#define XLOG_REG_TYPE_BCHUNK		2
-#define XLOG_REG_TYPE_EFI_FORMAT	3
-#define XLOG_REG_TYPE_EFD_FORMAT	4
-#define XLOG_REG_TYPE_IFORMAT		5
-#define XLOG_REG_TYPE_ICORE		6
-#define XLOG_REG_TYPE_IEXT		7
-#define XLOG_REG_TYPE_IBROOT		8
-#define XLOG_REG_TYPE_ILOCAL		9
-#define XLOG_REG_TYPE_IATTR_EXT		10
-#define XLOG_REG_TYPE_IATTR_BROOT	11
-#define XLOG_REG_TYPE_IATTR_LOCAL	12
-#define XLOG_REG_TYPE_QFORMAT		13
-#define XLOG_REG_TYPE_DQUOT		14
-#define XLOG_REG_TYPE_QUOTAOFF		15
-#define XLOG_REG_TYPE_LRHEADER		16
-#define XLOG_REG_TYPE_UNMOUNT		17
-#define XLOG_REG_TYPE_COMMIT		18
-#define XLOG_REG_TYPE_TRANSHDR		19
-#define XLOG_REG_TYPE_ICREATE		20
-#define XLOG_REG_TYPE_MAX		20
-
-typedef struct xfs_log_iovec {
-	void		*i_addr;	/* beginning address of region */
-	int		i_len;		/* length in bytes of region */
-	uint		i_type;		/* type of region */
-} xfs_log_iovec_t;
-
-struct xfs_log_vec {
-	struct xfs_log_vec	*lv_next;	/* next lv in build list */
-	int			lv_niovecs;	/* number of iovecs in lv */
-	struct xfs_log_iovec	*lv_iovecp;	/* iovec array */
-	struct xfs_log_item	*lv_item;	/* owner */
-	char			*lv_buf;	/* formatted buffer */
-	int			lv_buf_len;	/* size of formatted buffer */
-};
-
-#define XFS_LOG_VEC_ORDERED	(-1)
-
-/*
- * Structure used to pass callback function and the function's argument
- * to the log manager.
- */
-typedef struct xfs_log_callback {
-	struct xfs_log_callback	*cb_next;
-	void			(*cb_func)(void *, int);
-	void			*cb_arg;
-} xfs_log_callback_t;
-
-
-#ifdef __KERNEL__
 /* Log manager interfaces */
 struct xfs_mount;
 struct xlog_in_core;
@@ -188,5 +142,4 @@ void	xfs_log_work_queue(struct xfs_mount *mp);
 void	xfs_log_worker(struct work_struct *work);
 void	xfs_log_quiesce(struct xfs_mount *mp);
 
-#endif
 #endif	/* __XFS_LOG_H__ */
fs/xfs/xfs_log_format.h new file +178 -0

178 lines not on this page · raw message

fs/xfs/xfs_log_priv.h +6 -140

184 lines not on this page · raw message

fs/xfs/xfs_log_recover.c +2 -0
index 7681b19..7d3fc9e 100644
@@ -55,6 +55,8 @@
 #include "xfs_attr_leaf.h"
 #include "xfs_attr_remote.h"
 
+#define BLK_AVG(blk1, blk2)	((blk1+blk2) >> 1)
+
 STATIC int
 xlog_find_zeroed(
 	struct xlog	*,
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 30/50] xfs: remove __KERNEL__ from debug code

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the __KERNEL__ part of the defines, and let userspace handle the debug code appropriately.

---
 fs/xfs/xfs_bmap.h      | 2 +-
 fs/xfs/xfs_dir2_data.c | 4 ++--
 fs/xfs/xfs_rtalloc.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
fs/xfs/xfs_bmap.h +1 -1
index 8b2fe97..33b41f3 100644
@@ -127,7 +127,7 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp)
 	{ BMAP_RIGHT_FILLING,	"RF" }, \
 	{ BMAP_ATTRFORK,	"ATTR" }
 
-#if defined(__KERNEL) && defined(DEBUG)
+#ifdef DEBUG
 void	xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,
 		int whichfork, unsigned long caller_ip);
 #define	XFS_BMAP_TRACE_EXLIST(ip,c,w)	\
fs/xfs/xfs_dir2_data.c +2 -2
index 4e1917d..98c23fa 100644
@@ -331,7 +331,7 @@ xfs_dir2_data_freefind(
 	xfs_dir2_data_free_t	*dfp;		/* bestfree entry */
 	xfs_dir2_data_aoff_t	off;		/* offset value needed */
 	struct xfs_dir2_data_free *bf;
-#if defined(DEBUG) && defined(__KERNEL__)
+#ifdef DEBUG
 	int			matched;	/* matched the value */
 	int			seenzero;	/* saw a 0 bestfree entry */
 #endif
@@ -339,7 +339,7 @@ xfs_dir2_data_freefind(
 	off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr);
 	bf = xfs_dir3_data_bestfree_p(hdr);
 
-#if defined(DEBUG) && defined(__KERNEL__)
+#ifdef DEBUG
 	/*
 	 * Validate some consistency in the bestfree table.
 	 * Check order, non-overlapping entries, and if we find the
fs/xfs/xfs_rtalloc.c +1 -1
index 4822806..6dbcb5e 100644
@@ -2147,7 +2147,7 @@ xfs_rtfree_extent(
 	ASSERT(mp->m_rbmip->i_itemp != NULL);
 	ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));
 
-#if defined(__KERNEL__) && defined(DEBUG)
+#ifdef DEBUG
 	/*
 	 * Check to see that this whole range is currently allocated.
 	 */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 39/50] xfs: Get rid of all XFS_XXX_LOG_RES() macro

In reply to Dave Chinner

From: Jie Liu <[email protected]>

Get rid of all XFS_XXX_LOG_RES() macros since they are obsoleted now.

---
 fs/xfs/xfs_trans_resv.h | 36 ------------------------------------
 1 file changed, 36 deletions(-)
fs/xfs/xfs_trans_resv.h +0 -36
index 140d3f3..de7de9a 100644
@@ -92,42 +92,6 @@ struct xfs_trans_resv {
 	(XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \
 	 XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)
 
-
-#define XFS_WRITE_LOG_RES(mp)	((mp)->m_resv.tr_write.tr_logres)
-#define XFS_RENAME_LOG_RES(mp)	((mp)->m_resv.tr_rename.tr_logres)
-#define XFS_LINK_LOG_RES(mp)	((mp)->m_resv.tr_link.tr_logres)
-#define XFS_REMOVE_LOG_RES(mp)	((mp)->m_resv.tr_remove.tr_logres)
-#define XFS_SYMLINK_LOG_RES(mp)	((mp)->m_resv.tr_symlink.tr_logres)
-#define XFS_CREATE_LOG_RES(mp)	((mp)->m_resv.tr_create.tr_logres)
-#define XFS_MKDIR_LOG_RES(mp)	((mp)->m_resv.tr_mkdir.tr_logres)
-#define XFS_IFREE_LOG_RES(mp)	((mp)->m_resv.tr_ifree.tr_logres)
-#define XFS_SWRITE_LOG_RES(mp)	((mp)->m_resv.tr_swrite.tr_logres)
-#define XFS_ICHANGE_LOG_RES(mp)	((mp)->m_resv.tr_ichange.tr_logres)
-#define XFS_GROWDATA_LOG_RES(mp)  ((mp)->m_resv.tr_growdata.tr_logres)
-#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_resv.tr_itruncate.tr_logres)
-#define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_resv.tr_growrtzero.tr_logres)
-#define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_resv.tr_growrtfree.tr_logres)
-#define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_resv.tr_growrtalloc.tr_logres)
-
-/*
- * Logging the inode timestamps on an fsync -- same as SWRITE
- * as long as SWRITE logs the entire inode core
- */
-#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_resv.tr_fsyncts.tr_logres)
-#define XFS_WRITEID_LOG_RES(mp)	 ((mp)->m_resv.tr_writeid.tr_logres)
-#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_resv.tr_addafork.tr_logres)
-#define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_resv.tr_attrsetm.tr_logres)
-#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_resv.tr_attrinval.tr_logres)
-#define XFS_ATTRSETRT_LOG_RES(mp) ((mp)->m_resv.tr_attrsetrt.tr_logres)
-#define XFS_ATTRRM_LOG_RES(mp)	  ((mp)->m_resv.tr_attrrm.tr_logres)
-#define XFS_SB_LOG_RES(mp)	  ((mp)->m_resv.tr_sb.tr_logres)
-#define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_resv.tr_qm_setqlim.tr_logres)
-#define XFS_QM_DQALLOC_LOG_RES(mp) ((mp)->m_resv.tr_qm_dqalloc.tr_logres)
-#define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_resv.tr_qm_sbchange.tr_logres)
-#define XFS_QM_QUOTAOFF_LOG_RES(mp) ((mp)->m_resv.tr_qm_quotaoff.tr_logres)
-#define XFS_QM_QUOTAOFF_END_LOG_RES(mp) ((mp)->m_resv.tr_qm_equotaoff.tr_logres)
-#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_resv.tr_clearagi.tr_logres)
-
 /*
  * Various log count values.
  */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 06/50] xfs: separate icreate log format definitions from xfs_icreate_item.h

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.

---
 fs/xfs/xfs_icreate_item.h | 18 ------------------
 fs/xfs/xfs_log_format.h   | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 18 deletions(-)
fs/xfs/xfs_icreate_item.h +0 -18
index 88ba8aa..59e89f8 100644
@@ -18,24 +18,6 @@
 #ifndef XFS_ICREATE_ITEM_H
 #define XFS_ICREATE_ITEM_H	1
 
-/*
- * on disk log item structure
- *
- * Log recovery assumes the first two entries are the type and size and they fit
- * in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so
- * decoding can be done correctly.
- */
-struct xfs_icreate_log {
-	__uint16_t	icl_type;	/* type of log format structure */
-	__uint16_t	icl_size;	/* size of log format structure */
-	__be32		icl_ag;		/* ag being allocated in */
-	__be32		icl_agbno;	/* start block of inode range */
-	__be32		icl_count;	/* number of inodes to initialise */
-	__be32		icl_isize;	/* size of inodes */
-	__be32		icl_length;	/* length of extent to initialise */
-	__be32		icl_gen;	/* inode generation number to use */
-};
-
 /* in memory log item structure */
 struct xfs_icreate_item {
 	struct xfs_log_item	ic_item;
fs/xfs/xfs_log_format.h +18 -0
index 5963ec7..02639c7 100644
@@ -602,4 +602,22 @@ typedef struct xfs_qoff_logformat {
 #define XFS_ALL_QUOTA_CHKD	\
 		(XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD)
 
+/*
+ * Inode create log item structure
+ *
+ * Log recovery assumes the first two entries are the type and size and they fit
+ * in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so
+ * decoding can be done correctly.
+ */
+struct xfs_icreate_log {
+	__uint16_t	icl_type;	/* type of log format structure */
+	__uint16_t	icl_size;	/* size of log format structure */
+	__be32		icl_ag;		/* ag being allocated in */
+	__be32		icl_agbno;	/* start block of inode range */
+	__be32		icl_count;	/* number of inodes to initialise */
+	__be32		icl_isize;	/* size of inodes */
+	__be32		icl_length;	/* length of extent to initialise */
+	__be32		icl_gen;	/* inode generation number to use */
+};
+
 #endif /* __XFS_LOG_FORMAT_H__ */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 43/50] xfs: return log item size in IOP_SIZE

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

To begin optimising the CIL commit process, we need to have IOP_SIZE return both the number of vectors and the size of the data pointed to by the vectors. This enables us to calculate the size ofthe memory allocation needed before the formatting step and reduces the number of memory allocations per item by one.

While there, kill the IOP_SIZE macro.

---
 fs/xfs/xfs_buf_item.c     | 52 ++++++++++++++++++++++++++++------------------
 fs/xfs/xfs_dquot_item.c   | 22 ++++++++++++--------
 fs/xfs/xfs_extfree_item.c | 50 ++++++++++++++++++++++++++++----------------
 fs/xfs/xfs_icreate_item.c |  9 +++++---
 fs/xfs/xfs_inode_item.c   | 53 +++++++++++++++++++++++++++++++----------------
 fs/xfs/xfs_log_cil.c      | 10 ++++++---
 fs/xfs/xfs_trans.h        |  3 +--
 7 files changed, 126 insertions(+), 73 deletions(-)
fs/xfs/xfs_buf_item.c +32 -20
index bfc4e0c..9358504 100644
@@ -39,6 +39,14 @@ static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip)
 
 STATIC void	xfs_buf_do_callbacks(struct xfs_buf *bp);
 
+static inline int
+xfs_buf_log_format_size(
+	struct xfs_buf_log_format *blfp)
+{
+	return offsetof(struct xfs_buf_log_format, blf_data_map) +
+			(blfp->blf_map_size * sizeof(blfp->blf_data_map[0]));
+}
+
 /*
  * This returns the number of log iovecs needed to log the
  * given buf log item.
@@ -49,25 +57,27 @@ STATIC void	xfs_buf_do_callbacks(struct xfs_buf *bp);
  *
  * If the XFS_BLI_STALE flag has been set, then log nothing.
  */
-STATIC uint
+STATIC void
 xfs_buf_item_size_segment(
 	struct xfs_buf_log_item	*bip,
-	struct xfs_buf_log_format *blfp)
+	struct xfs_buf_log_format *blfp,
+	int			*nvecs,
+	int			*nbytes)
 {
 	struct xfs_buf		*bp = bip->bli_buf;
-	uint			nvecs;
 	int			next_bit;
 	int			last_bit;
 
 	last_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0);
 	if (last_bit == -1)
-		return 0;
+		return;
 
 	/*
 	 * initial count for a dirty buffer is 2 vectors - the format structure
 	 * and the first dirty region.
 	 */
-	nvecs = 2;
+	*nvecs += 2;
+	*nbytes += xfs_buf_log_format_size(blfp) + XFS_BLF_CHUNK;
 
 	while (last_bit != -1) {
 		/*
@@ -87,18 +97,17 @@ xfs_buf_item_size_segment(
 			break;
 		} else if (next_bit != last_bit + 1) {
 			last_bit = next_bit;
-			nvecs++;
+			(*nvecs)++;
 		} else if (xfs_buf_offset(bp, next_bit * XFS_BLF_CHUNK) !=
 			   (xfs_buf_offset(bp, last_bit * XFS_BLF_CHUNK) +
 			    XFS_BLF_CHUNK)) {
 			last_bit = next_bit;
-			nvecs++;
+			(*nvecs)++;
 		} else {
 			last_bit++;
 		}
+		*nbytes += XFS_BLF_CHUNK;
 	}
-
-	return nvecs;
 }
 
 /*
@@ -118,12 +127,13 @@ xfs_buf_item_size_segment(
  * If the XFS_BLI_STALE flag has been set, then log nothing but the buf log
  * format structures.
  */
-STATIC uint
+STATIC void
 xfs_buf_item_size(
-	struct xfs_log_item	*lip)
+	struct xfs_log_item	*lip,
+	int			*nvecs,
+	int			*nbytes)
 {
 	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);
-	uint			nvecs;
 	int			i;
 
 	ASSERT(atomic_read(&bip->bli_refcount) > 0);
@@ -135,7 +145,11 @@ xfs_buf_item_size(
 		 */
 		trace_xfs_buf_item_size_stale(bip);
 		ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
-		return bip->bli_format_count;
+		*nvecs += bip->bli_format_count;
+		for (i = 0; i < bip->bli_format_count; i++) {
+			*nbytes += xfs_buf_log_format_size(&bip->bli_formats[i]);
+		}
+		return;
 	}
 
 	ASSERT(bip->bli_flags & XFS_BLI_LOGGED);
@@ -147,7 +161,8 @@ xfs_buf_item_size(
 		 * commit, so no vectors are used at all.
 		 */
 		trace_xfs_buf_item_size_ordered(bip);
-		return XFS_LOG_VEC_ORDERED;
+		*nvecs = XFS_LOG_VEC_ORDERED;
+		return;
 	}
 
 	/*
@@ -159,13 +174,11 @@ xfs_buf_item_size(
 	 * count for the extra buf log format structure that will need to be
 	 * written.
 	 */
-	nvecs = 0;
 	for (i = 0; i < bip->bli_format_count; i++) {
-		nvecs += xfs_buf_item_size_segment(bip, &bip->bli_formats[i]);
+		xfs_buf_item_size_segment(bip, &bip->bli_formats[i],
+					  nvecs, nbytes);
 	}
-
 	trace_xfs_buf_item_size(bip);
-	return nvecs;
 }
 
 static struct xfs_log_iovec *
@@ -192,8 +205,7 @@ xfs_buf_item_format_segment(
 	 * the actual size of the dirty bitmap rather than the size of the in
 	 * memory structure.
 	 */
-	base_size = offsetof(struct xfs_buf_log_format, blf_data_map) +
-			(blfp->blf_map_size * sizeof(blfp->blf_data_map[0]));
+	base_size = xfs_buf_log_format_size(blfp);
 
 	nvecs = 0;
 	first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0);
fs/xfs/xfs_dquot_item.c +13 -9
index f07a436..60c6e1f 100644
@@ -44,14 +44,15 @@ static inline struct xfs_dq_logitem *DQUOT_ITEM(struct xfs_log_item *lip)
 /*
  * returns the number of iovecs needed to log the given dquot item.
  */
-STATIC uint
+STATIC void
 xfs_qm_dquot_logitem_size(
-	struct xfs_log_item	*lip)
+	struct xfs_log_item	*lip,
+	int			*nvecs,
+	int			*nbytes)
 {
-	/*
-	 * we need only two iovecs, one for the format, one for the real thing
-	 */
-	return 2;
+	*nvecs += 2;
+	*nbytes += sizeof(struct xfs_dq_logformat) +
+		   sizeof(struct xfs_disk_dquot);
 }
 
 /*
@@ -286,11 +287,14 @@ static inline struct xfs_qoff_logitem *QOFF_ITEM(struct xfs_log_item *lip)
  * We only need 1 iovec for an quotaoff item.  It just logs the
  * quotaoff_log_format structure.
  */
-STATIC uint
+STATIC void
 xfs_qm_qoff_logitem_size(
-	struct xfs_log_item	*lip)
+	struct xfs_log_item	*lip,
+	int			*nvecs,
+	int			*nbytes)
 {
-	return 1;
+	*nvecs += 1;
+	*nbytes += sizeof(struct xfs_qoff_logitem);
 }
 
 /*
fs/xfs/xfs_extfree_item.c +32 -18

95 lines not on this page · raw message

fs/xfs/xfs_icreate_item.c +6 -3
index 441a78a..5a5a593 100644
@@ -40,11 +40,14 @@ static inline struct xfs_icreate_item *ICR_ITEM(struct xfs_log_item *lip)
  *
  * We only need one iovec for the icreate log structure.
  */
-STATIC uint
+STATIC void
 xfs_icreate_item_size(
-	struct xfs_log_item	*lip)
+	struct xfs_log_item	*lip,
+	int			*nvecs,
+	int			*nbytes)
 {
-	return 1;
+	*nvecs += 1;
+	*nbytes += sizeof(struct xfs_icreate_log);
 }
 
 /*
fs/xfs/xfs_inode_item.c +35 -18

102 lines not on this page · raw message

fs/xfs/xfs_log_cil.c +7 -3
index 02b9cf3..4e10872 100644
@@ -122,19 +122,23 @@ xlog_cil_prepare_log_vecs(
 	}
 
 	list_for_each_entry(lidp, &tp->t_items, lid_trans) {
+		struct xfs_log_item *lip = lidp->lid_item;
 		struct xfs_log_vec *new_lv;
 		void	*ptr;
 		int	index;
 		int	len = 0;
-		uint	niovecs;
+		uint	niovecs = 0;
+		uint	nbytes = 0;
 		bool	ordered = false;
 
 		/* Skip items which aren't dirty in this transaction. */
 		if (!(lidp->lid_flags & XFS_LID_DIRTY))
 			continue;
 
+		/* get number of vecs and size of data to be stored */
+		lip->li_ops->iop_size(lip, &niovecs, &nbytes);
+
 		/* Skip items that do not have any vectors for writing */
-		niovecs = IOP_SIZE(lidp->lid_item);
 		if (!niovecs)
 			continue;
 
@@ -152,7 +156,7 @@ xlog_cil_prepare_log_vecs(
 				niovecs * sizeof(struct xfs_log_iovec),
 				KM_SLEEP|KM_NOFS);
 
-		new_lv->lv_item = lidp->lid_item;
+		new_lv->lv_item = lip;
 		new_lv->lv_niovecs = niovecs;
 		if (ordered) {
 			/* track as an ordered logvec */
fs/xfs/xfs_trans.h +1 -2
index 7eb81cc..97144ec 100644
@@ -67,7 +67,7 @@ typedef struct xfs_log_item {
 	{ XFS_LI_ABORTED,	"ABORTED" }
 
 struct xfs_item_ops {
-	uint (*iop_size)(xfs_log_item_t *);
+	void (*iop_size)(xfs_log_item_t *, int *, int *);
 	void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *);
 	void (*iop_pin)(xfs_log_item_t *);
 	void (*iop_unpin)(xfs_log_item_t *, int remove);
@@ -77,7 +77,6 @@ struct xfs_item_ops {
 	void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
 };
 
-#define IOP_SIZE(ip)		(*(ip)->li_ops->iop_size)(ip)
 #define IOP_FORMAT(ip,vp)	(*(ip)->li_ops->iop_format)(ip, vp)
 #define IOP_PIN(ip)		(*(ip)->li_ops->iop_pin)(ip)
 #define IOP_UNPIN(ip, remove)	(*(ip)->li_ops->iop_unpin)(ip, remove)
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 46/50] xfs: Combine CIL insert and prepare passes

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Now that all the log item preparation and formatting is done under the CIL lock, we can get rid of the intermediate log vector chain used to track items to be inserted into the CIL.

We can already find all the items to be committed from the transaction handle, so as long as we attach the log vectors to the item before we insert the items into the CIL, we don't need to create a log vector chain to pass around.

This means we can move all the item insertion code into and optimise it into a pair of simple passes across all the items in the transaction. The first pass does the formatting and accounting, the second inserts them all into the CIL.

We keep this two pass split so that we can separate the CIL insertion - which must be done under the CIL spinlock - from the formatting. We could insert each item into the CIL with a single pass, but that massively increases the number of times we have to grab the CIL spinlock. It is much more efficient (and hence scalable) to do a batch operation and insert all objects in a single lock grab.

---
 fs/xfs/xfs_log_cil.c | 227 +++++++++++++++++++++++----------------------------
 1 file changed, 100 insertions(+), 127 deletions(-)
fs/xfs/xfs_log_cil.c +100 -127
index b20b157..c1a3384 100644
@@ -111,6 +111,53 @@ xlog_cil_lv_item_format(
 }
 
 /*
+ * Prepare the log item for insertion into the CIL. Calculate the difference in
+ * log space and vectors it will consume, and if it is a new item pin it as
+ * well.
+ */
+STATIC void
+xfs_cil_prepare_item(
+	struct xlog		*log,
+	struct xfs_log_vec	*lv,
+	struct xfs_log_vec	*old_lv,
+	int			*diff_len,
+	int			*diff_iovecs)
+{
+	/* Account for the new LV being passed in */
+	if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED) {
+		*diff_len += lv->lv_buf_len;
+		*diff_iovecs += lv->lv_niovecs;
+	}
+
+	/*
+	 * If there is no old LV, this is the first time we've seen the item in
+	 * this CIL context and so we need to pin it. If we are replacing the
+	 * old_lv, then remove the space it accounts for and free it.
+	 */
+	if (!old_lv)
+		lv->lv_item->li_ops->iop_pin(lv->lv_item);
+	else if (old_lv != lv) {
+		ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);
+
+		*diff_len -= old_lv->lv_buf_len;
+		*diff_iovecs -= old_lv->lv_niovecs;
+		kmem_free(old_lv);
+	}
+
+	/* attach new log vector to log item */
+	lv->lv_item->li_lv = lv;
+
+	/*
+	 * If this is the first time the item is being committed to the
+	 * CIL, store the sequence number on the log item so we can
+	 * tell in future commits whether this is the first checkpoint
+	 * the item is being committed into.
+	 */
+	if (!lv->lv_item->li_seq)
+		lv->lv_item->li_seq = log->l_cilp->xc_ctx->sequence;
+}
+
+/*
  * Format log item into a flat buffers
  *
  * For delayed logging, we need to hold a formatted buffer containing all the
@@ -136,24 +183,26 @@ xlog_cil_lv_item_format(
  * format the regions into the iclog as though they are being formatted
  * directly out of the objects themselves.
  */
-static struct xfs_log_vec *
-xlog_cil_prepare_log_vecs(
-	struct xfs_trans	*tp)
+static void
+xlog_cil_insert_format_items(
+	struct xlog		*log,
+	struct xfs_trans	*tp,
+	int			*diff_len,
+	int			*diff_iovecs)
 {
 	struct xfs_log_item_desc *lidp;
-	struct xfs_log_vec	*prev_lv = NULL;
-	struct xfs_log_vec	*ret_lv = NULL;
 
 
 	/* Bail out if we didn't find a log item.  */
 	if (list_empty(&tp->t_items)) {
 		ASSERT(0);
-		return NULL;
+		return;
 	}
 
 	list_for_each_entry(lidp, &tp->t_items, lid_trans) {
 		struct xfs_log_item *lip = lidp->lid_item;
 		struct xfs_log_vec *lv;
+		struct xfs_log_vec *old_lv;
 		int	niovecs = 0;
 		int	nbytes = 0;
 		int	buf_size;
@@ -181,6 +230,9 @@ xlog_cil_prepare_log_vecs(
 			nbytes = 0;
 		}
 
+		/* grab the old item if it exists for reservation accounting */
+		old_lv = lip->li_lv;
+
 		/* calc buffer size */
 		buf_size = sizeof(struct xfs_log_vec) + nbytes +
 				niovecs * sizeof(struct xfs_log_iovec);
@@ -194,9 +246,17 @@ xlog_cil_prepare_log_vecs(
 			if (ordered)
 				goto insert;
 
+			/*
+			 * set the item up as though it is a new insertion so
+			 * that the space reservation accounting is correct.
+			 */
+			*diff_iovecs -= lv->lv_niovecs;
+			*diff_len -= lv->lv_buf_len;
+
 			/* Ensure the lv is set up according to ->iop_size */
 			lv->lv_niovecs = niovecs;
 			lv->lv_buf = (char *)lv + buf_size - nbytes;
+
 			lv->lv_buf_len = xlog_cil_lv_item_format(lip, lv);
 			goto insert;
 		}
@@ -222,74 +282,8 @@ xlog_cil_prepare_log_vecs(
 		lv->lv_buf_len = xlog_cil_lv_item_format(lip, lv);
 insert:
 		ASSERT(lv->lv_buf_len <= nbytes);
-		if (!ret_lv)
-			ret_lv = lv;
-		else
-			prev_lv->lv_next = lv;
-		prev_lv = lv;
-	}
-
-	return ret_lv;
-}
-
-/*
- * Prepare the log item for insertion into the CIL. Calculate the difference in
- * log space and vectors it will consume, and if it is a new item pin it as
- * well.
- */
-STATIC void
-xfs_cil_prepare_item(
-	struct xlog		*log,
-	struct xfs_log_vec	*lv,
-	int			*len,
-	int			*diff_iovecs)
-{
-	struct xfs_log_vec	*old = lv->lv_item->li_lv;
-
-	if (!old) {
-		/* new lv, must pin the log item */
-		ASSERT(!lv->lv_item->li_lv);
-
-		if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED) {
-			*len += lv->lv_buf_len;
-			*diff_iovecs += lv->lv_niovecs;
-		}
-		lv->lv_item->li_ops->iop_pin(lv->lv_item);
-
-	} else if (old != lv) {
-		/* existing lv on log item, space used is a delta */
-		ASSERT((old->lv_buf && old->lv_buf_len && old->lv_niovecs) ||
-			old->lv_buf_len == XFS_LOG_VEC_ORDERED);
-
-		/*
-		 * If the new item is ordered, keep the old one that is already
-		 * tracking dirty or ordered regions
-		 */
-		if (lv->lv_buf_len == XFS_LOG_VEC_ORDERED) {
-			ASSERT(!lv->lv_buf);
-			kmem_free(lv);
-			return;
-		}
-
-		*len += lv->lv_buf_len - old->lv_buf_len;
-		*diff_iovecs += lv->lv_niovecs - old->lv_niovecs;
-		kmem_free(old);
-	} else {
-		/* re-used lv */
-		/* XXX: can't account for len/diff_iovecs yet */
+		xfs_cil_prepare_item(log, lv, old_lv, diff_len, diff_iovecs);
 	}
-
-	/* attach new log vector to log item */
-	lv->lv_item->li_lv = lv;
-
-	/*
-	 * If this is the first time the item is being committed to the
-	 * CIL, store the sequence number on the log item so we can
-	 * tell in future commits whether this is the first checkpoint
-	 * the item is being committed into.
-	 */
-	if (!lv->lv_item->li_seq)
-		lv->lv_item->li_seq = log->l_cilp->xc_ctx->sequence;
 }
 
 /*
@@ -302,53 +296,47 @@ xfs_cil_prepare_item(
 static void
 xlog_cil_insert_items(
 	struct xlog		*log,
-	struct xfs_log_vec	*log_vector,
-	struct xlog_ticket	*ticket)
+	struct xfs_trans	*tp)
 {
 	struct xfs_cil		*cil = log->l_cilp;
 	struct xfs_cil_ctx	*ctx = cil->xc_ctx;
-	struct xfs_log_vec	*lv;
+	struct xfs_log_item_desc *lidp;
 	int			len = 0;
 	int			diff_iovecs = 0;
 	int			iclog_space;
 
-	ASSERT(log_vector);
+	ASSERT(tp);
 
 	/*
-	 * Do all the accounting aggregation and switching of log vectors
-	 * around in a separate loop to the insertion of items into the CIL.
-	 * Then we can do a separate loop to update the CIL within a single
-	 * lock/unlock pair. This reduces the number of round trips on the CIL
-	 * lock from O(nr_logvectors) to O(1) and greatly reduces the overall
-	 * hold time for the transaction commit.
-	 *
-	 * If this is the first time the item is being placed into the CIL in
-	 * this context, pin it so it can't be written to disk until the CIL is
-	 * flushed to the iclog and the iclog written to disk.
-	 *
 	 * We can do this safely because the context can't checkpoint until we
 	 * are done so it doesn't matter exactly how we update the CIL.
 	 */
+	xlog_cil_insert_format_items(log, tp, &len, &diff_iovecs);
+
+	/*
+	 * Now (re-)position everything modified at the tail of the CIL.
+	 * We do this here so we only need to take the CIL lock once during
+	 * the transaction commit.
+	 */
 	spin_lock(&cil->xc_cil_lock);
-	for (lv = log_vector; lv; ) {
-		struct xfs_log_vec *next = lv->lv_next;
+	list_for_each_entry(lidp, &tp->t_items, lid_trans) {
+		struct xfs_log_item	*lip = lidp->lid_item;
 
-		ASSERT(lv->lv_item->li_lv || list_empty(&lv->lv_item->li_cil));
-		lv->lv_next = NULL;
+		/* Skip items which aren't dirty in this transaction. */
+		if (!(lidp->lid_flags & XFS_LID_DIRTY))
+			continue;
 
-		/*
-		 * xfs_cil_prepare_item() may free the lv, so move the item on
-		 * the CIL first.
-		 */
-		list_move_tail(&lv->lv_item->li_cil, &cil->xc_cil);
-		xfs_cil_prepare_item(log, lv, &len, &diff_iovecs);
-		lv = next;
+		list_move_tail(&lip->li_cil, &cil->xc_cil);
 	}
 
 	/* account for space used by new iovec headers  */
 	len += diff_iovecs * sizeof(xlog_op_header_t);
 	ctx->nvecs += diff_iovecs;
 
+	/* attach the transaction to the CIL if it has any busy extents */
+	if (!list_empty(&tp->t_busy))
+		list_splice_init(&tp->t_busy, &ctx->busy_extents);
+
 	/*
 	 * Now transfer enough transaction reservation to the context ticket
 	 * for the checkpoint. The context ticket is special - the unit
@@ -357,10 +345,8 @@ xlog_cil_insert_items(
 	 * during the transaction commit.
 	 */
 	if (ctx->ticket->t_curr_res == 0) {
-		/* first commit in checkpoint, steal the header reservation */
-		ASSERT(ticket->t_curr_res >= ctx->ticket->t_unit_res + len);
 		ctx->ticket->t_curr_res = ctx->ticket->t_unit_res;
-		ticket->t_curr_res -= ctx->ticket->t_unit_res;
+		tp->t_ticket->t_curr_res -= ctx->ticket->t_unit_res;
 	}
 
 	/* do we need space for more log record headers? */
@@ -374,10 +360,10 @@ xlog_cil_insert_items(
 		hdrs *= log->l_iclog_hsize + sizeof(struct xlog_op_header);
 		ctx->ticket->t_unit_res += hdrs;
 		ctx->ticket->t_curr_res += hdrs;
-		ticket->t_curr_res -= hdrs;
-		ASSERT(ticket->t_curr_res >= len);
+		tp->t_ticket->t_curr_res -= hdrs;
+		ASSERT(tp->t_ticket->t_curr_res >= len);
 	}
-	ticket->t_curr_res -= len;
+	tp->t_ticket->t_curr_res -= len;
 	ctx->space_used += len;
 
 	spin_unlock(&cil->xc_cil_lock);
@@ -746,38 +732,25 @@ xfs_log_commit_cil(
 	int			flags)
 {
 	struct xlog		*log = mp->m_log;
+	struct xfs_cil		*cil = log->l_cilp;
 	int			log_flags = 0;
-	struct xfs_log_vec	*log_vector;
 
 	if (flags & XFS_TRANS_RELEASE_LOG_RES)
 		log_flags = XFS_LOG_REL_PERM_RESERV;
 
 	/* lock out background commit */
-	down_read(&log->l_cilp->xc_ctx_lock);
+	down_read(&cil->xc_ctx_lock);
 
-	log_vector = xlog_cil_prepare_log_vecs(tp);
-	if (!log_vector)
-		return ENOMEM;
-
-	if (commit_lsn)
-		*commit_lsn = log->l_cilp->xc_ctx->sequence;
-
-	/* xlog_cil_insert_items() destroys log_vector list */
-	xlog_cil_insert_items(log, log_vector, tp->t_ticket);
+	xlog_cil_insert_items(log, tp);
 
 	/* check we didn't blow the reservation */
 	if (tp->t_ticket->t_curr_res < 0)
-		xlog_print_tic_res(log->l_mp, tp->t_ticket);
+		xlog_print_tic_res(mp, tp->t_ticket);
 
-	/* attach the transaction to the CIL if it has any busy extents */
-	if (!list_empty(&tp->t_busy)) {
-		spin_lock(&log->l_cilp->xc_cil_lock);
-		list_splice_init(&tp->t_busy,
-					&log->l_cilp->xc_ctx->busy_extents);
-		spin_unlock(&log->l_cilp->xc_cil_lock);
-	}
+	tp->t_commit_lsn = cil->xc_ctx->sequence;
+	if (commit_lsn)
+		*commit_lsn = tp->t_commit_lsn;
 
-	tp->t_commit_lsn = *commit_lsn;
 	xfs_log_done(mp, tp->t_ticket, NULL, log_flags);
 	xfs_trans_unreserve_and_mod_sb(tp);
 
@@ -792,11 +765,11 @@ xfs_log_commit_cil(
 	 * the log items. This affects (at least) processing of stale buffers,
 	 * inodes and EFIs.
 	 */
-	xfs_trans_free_items(tp, *commit_lsn, 0);
+	xfs_trans_free_items(tp, tp->t_commit_lsn, 0);
 
 	xlog_cil_push_background(log);
 
-	up_read(&log->l_cilp->xc_ctx_lock);
+	up_read(&cil->xc_ctx_lock);
 	return 0;
 }
 
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by
#12 lore raw

Re: [PATCH 46/50] xfs: Combine CIL insert and prepare passes

Quoted 54 lines · Dave Chinner

From: Dave Chinner<[email protected]>

Now that all the log item preparation and formatting is done under the CIL lock, we can get rid of the intermediate log vector chain used to track items to be inserted into the CIL.

We can already find all the items to be committed from the transaction handle, so as long as we attach the log vectors to the item before we insert the items into the CIL, we don't need to create a log vector chain to pass around.

This means we can move all the item insertion code into and optimise it into a pair of simple passes across all the items in the transaction. The first pass does the formatting and accounting, the second inserts them all into the CIL.

We keep this two pass split so that we can separate the CIL insertion - which must be done under the CIL spinlock - from the formatting. We could insert each item into the CIL with a single pass, but that massively increases the number of times we have to grab the CIL spinlock. It is much more efficient (and hence scalable) to do a batch operation and insert all objects in a single lock grab.

---
  fs/xfs/xfs_log_cil.c | 227 +++++++++++++++++++++++----------------------------
  1 file changed, 100 insertions(+), 127 deletions(-)
fs/xfs/xfs_log_cil.c +17 -0
index b20b157..c1a3384 100644
@@ -111,6 +111,53 @@ xlog_cil_lv_item_format(
  }
 
  /*
+ * Prepare the log item for insertion into the CIL. Calculate the difference in
+ * log space and vectors it will consume, and if it is a new item pin it as
+ * well.
+ */
+STATIC void
+xfs_cil_prepare_item(
+	struct xlog		*log,
+	struct xfs_log_vec	*lv,
+	struct xfs_log_vec	*old_lv,
+	int			*diff_len,
+	int			*diff_iovecs)
+{
+	/* Account for the new LV being passed in */
+	if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED) {
+		*diff_len += lv->lv_buf_len;
+		*diff_iovecs += lv->lv_niovecs;
+	}

fs/xfs/xfs_log_cil.c xlog_cil_lv_item_format( · line 140

Quoted 10 lines
fs/xfs/xfs_log_cil.c +10 -0
+
+	/*
+	 * If there is no old LV, this is the first time we've seen the item in
+	 * this CIL context and so we need to pin it. If we are replacing the
+	 * old_lv, then remove the space it accounts for and free it.
+	 */
+	if (!old_lv)
+		lv->lv_item->li_ops->iop_pin(lv->lv_item);
+	else if (old_lv != lv) {
+		ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);

This should never happen, but I liked the original if .. then here as well as the assert...

fs/xfs/xfs_log_cil.c xlog_cil_lv_item_format( · line 145

Quoted 5 lines
fs/xfs/xfs_log_cil.c +5 -0
+
+		*diff_len -= old_lv->lv_buf_len;
+		*diff_iovecs -= old_lv->lv_niovecs;
+		kmem_free(old_lv);
+	}

... but not enough to make you repost.

Unless someone else has strong opinions, the CIL lock series (patches 43-47) have been reviewed and tested.

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

#13 lore raw

***** SUSPECTED SPAM ***** [PATCH 08/50] xfs: introduce xfs_rtalloc_defs.h

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

There are quite a few realtime device definitions shared with userspace. Move them from xfs_rtalloc.h to xfs_rt_alloc_defs.h so we don't need to share xfs_rtalloc.h with userspace anymore.

---
 fs/xfs/xfs_format.h  | 41 ++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_rtalloc.c |  2 +-
 fs/xfs/xfs_rtalloc.h | 53 ++--------------------------------------------------
 fs/xfs/xfs_types.h   | 10 ++++++++++
 4 files changed, 54 insertions(+), 52 deletions(-)
fs/xfs/xfs_format.h +41 -0
index 2b4f166..6205374 100644
@@ -28,6 +28,47 @@
  */
 
 /*
+ * RealTime Device format definitions
+ */
+
+/* Min and max rt extent sizes, specified in bytes */
+#define	XFS_MAX_RTEXTSIZE	(1024 * 1024 * 1024)	/* 1GB */
+#define	XFS_DFL_RTEXTSIZE	(64 * 1024)	        /* 64kB */
+#define	XFS_MIN_RTEXTSIZE	(4 * 1024)		/* 4kB */
+
+#define	XFS_BLOCKSIZE(mp)	((mp)->m_sb.sb_blocksize)
+#define	XFS_BLOCKMASK(mp)	((mp)->m_blockmask)
+#define	XFS_BLOCKWSIZE(mp)	((mp)->m_blockwsize)
+#define	XFS_BLOCKWMASK(mp)	((mp)->m_blockwmask)
+
+/*
+ * RT Summary and bit manipulation macros.
+ */
+#define	XFS_SUMOFFS(mp,ls,bb)	((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb)))
+#define	XFS_SUMOFFSTOBLOCK(mp,s)	\
+	(((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog)
+#define	XFS_SUMPTR(mp,bp,so)	\
+	((xfs_suminfo_t *)((bp)->b_addr + \
+		(((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp))))
+
+#define	XFS_BITTOBLOCK(mp,bi)	((bi) >> (mp)->m_blkbit_log)
+#define	XFS_BLOCKTOBIT(mp,bb)	((bb) << (mp)->m_blkbit_log)
+#define	XFS_BITTOWORD(mp,bi)	\
+	((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp)))
+
+#define	XFS_RTMIN(a,b)	((a) < (b) ? (a) : (b))
+#define	XFS_RTMAX(a,b)	((a) > (b) ? (a) : (b))
+
+#define	XFS_RTLOBIT(w)	xfs_lowbit32(w)
+#define	XFS_RTHIBIT(w)	xfs_highbit32(w)
+
+#if XFS_BIG_BLKNOS
+#define	XFS_RTBLOCKLOG(b)	xfs_highbit64(b)
+#else
+#define	XFS_RTBLOCKLOG(b)	xfs_highbit32(b)
+#endif
+
+/*
  * Dquot and dquot block format definitions
  */
 #define XFS_DQUOT_MAGIC		0x4451		/* 'DQ' */
fs/xfs/xfs_rtalloc.c +1 -1
index 98dc670..5d900ec 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_rtalloc.h +2 -51

66 lines not on this page · raw message

fs/xfs/xfs_types.h +10 -0
index 69074ac..781772c 100644
@@ -183,4 +183,14 @@ struct xfs_name {
  */
 typedef __uint32_t	xfs_dqid_t;
 
+/*
+ * Constants for bit manipulations.
+ */
+#define	XFS_NBBYLOG	3		/* log2(NBBY) */
+#define	XFS_WORDLOG	2		/* log2(sizeof(xfs_rtword_t)) */
+#define	XFS_NBWORDLOG	(XFS_NBBYLOG + XFS_WORDLOG)
+#define	XFS_NBWORD	(1 << XFS_NBWORDLOG)
+#define	XFS_WORDMASK	((1 << XFS_WORDLOG) - 1)
+
+
 #endif	/* __XFS_TYPES_H__ */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 15/50] xfs: move getdents code into it's own file

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The directory readdir code is not used by userspace, but it is intermingled with files that are shared with userspace. This makes it difficult to compare the differences between the userspac eand kernel files are the userspace files don't have the getdents code in them. Move all the kernel getdents code to a separate file to bring the shared content between userspace and kernel files closer together.

---
 fs/xfs/Makefile           |   1 +
 fs/xfs/xfs_dir2.c         |  31 ---
 fs/xfs/xfs_dir2_block.c   |  97 +------
 fs/xfs/xfs_dir2_leaf.c    | 390 ----------------------------
 fs/xfs/xfs_dir2_priv.h    |   7 +-
 fs/xfs/xfs_dir2_readdir.c | 645 ++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_dir2_sf.c      |  94 -------
 7 files changed, 649 insertions(+), 616 deletions(-)
 create mode 100644 fs/xfs/xfs_dir2_readdir.c
fs/xfs/Makefile +1 -0
index 7f2319d..b6158af 100644
@@ -30,6 +30,7 @@ xfs-y				+= xfs_aops.o \
 				   xfs_bit.o \
 				   xfs_buf.o \
 				   xfs_dfrag.o \
+				   xfs_dir2_readdir.o \
 				   xfs_discard.o \
 				   xfs_error.o \
 				   xfs_export.o \
fs/xfs/xfs_dir2.c +0 -31
index 8f023de..431be44 100644
@@ -363,37 +363,6 @@ xfs_dir_removename(
 }
 
 /*
- * Read a directory.
- */
-int
-xfs_readdir(
-	xfs_inode_t	*dp,
-	struct dir_context *ctx,
-	size_t		bufsize)
-{
-	int		rval;		/* return value */
-	int		v;		/* type-checking value */
-
-	trace_xfs_readdir(dp);
-
-	if (XFS_FORCED_SHUTDOWN(dp->i_mount))
-		return XFS_ERROR(EIO);
-
-	ASSERT(S_ISDIR(dp->i_d.di_mode));
-	XFS_STATS_INC(xs_dir_getdents);
-
-	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
-		rval = xfs_dir2_sf_getdents(dp, ctx);
-	else if ((rval = xfs_dir2_isblock(NULL, dp, &v)))
-		;
-	else if (v)
-		rval = xfs_dir2_block_getdents(dp, ctx);
-	else
-		rval = xfs_dir2_leaf_getdents(dp, ctx, bufsize);
-	return rval;
-}
-
-/*
  * Replace the inode number of a directory entry.
  */
 int
fs/xfs/xfs_dir2_block.c +1 -96

109 lines not on this page · raw message

fs/xfs/xfs_dir2_leaf.c +0 -390

396 lines not on this page · raw message

fs/xfs/xfs_dir2_priv.h +2 -5
index 0511cda..72ff8d7 100644
@@ -32,9 +32,9 @@ extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
 /* xfs_dir2_block.c */
 extern const struct xfs_buf_ops xfs_dir3_block_buf_ops;
 
+extern int xfs_dir3_block_read(struct xfs_trans *tp, struct xfs_inode *dp,
+			       struct xfs_buf **bpp);
 extern int xfs_dir2_block_addname(struct xfs_da_args *args);
-extern int xfs_dir2_block_getdents(struct xfs_inode *dp,
-		struct dir_context *ctx);
 extern int xfs_dir2_block_lookup(struct xfs_da_args *args);
 extern int xfs_dir2_block_removename(struct xfs_da_args *args);
 extern int xfs_dir2_block_replace(struct xfs_da_args *args);
@@ -91,8 +91,6 @@ extern void xfs_dir3_leaf_compact(struct xfs_da_args *args,
 extern void xfs_dir3_leaf_compact_x1(struct xfs_dir3_icleaf_hdr *leafhdr,
 		struct xfs_dir2_leaf_entry *ents, int *indexp,
 		int *lowstalep, int *highstalep, int *lowlogp, int *highlogp);
-extern int xfs_dir2_leaf_getdents(struct xfs_inode *dp, struct dir_context *ctx,
-		size_t bufsize);
 extern int xfs_dir3_leaf_get_buf(struct xfs_da_args *args, xfs_dir2_db_t bno,
 		struct xfs_buf **bpp, __uint16_t magic);
 extern void xfs_dir3_leaf_log_ents(struct xfs_trans *tp, struct xfs_buf *bp,
@@ -153,7 +151,6 @@ extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp,
 		int size, xfs_dir2_sf_hdr_t *sfhp);
 extern int xfs_dir2_sf_addname(struct xfs_da_args *args);
 extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
-extern int xfs_dir2_sf_getdents(struct xfs_inode *dp, struct dir_context *ctx);
 extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);
 extern int xfs_dir2_sf_removename(struct xfs_da_args *args);
 extern int xfs_dir2_sf_replace(struct xfs_da_args *args);
fs/xfs/xfs_dir2_readdir.c new file +645 -0

645 lines not on this page · raw message

fs/xfs/xfs_dir2_sf.c +0 -94

100 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 19/50] xfs: split out the remote symlink handling

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace.

---
 fs/xfs/Makefile             |   3 +-
 fs/xfs/xfs_format.h         |  42 ++++++++++
 fs/xfs/xfs_symlink.c        | 172 --------------------------------------
 fs/xfs/xfs_symlink.h        |  42 +---------
 fs/xfs/xfs_symlink_remote.c | 199 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 244 insertions(+), 214 deletions(-)
 create mode 100644 fs/xfs/xfs_symlink_remote.c
fs/xfs/Makefile +2 -1
index a73af1c..20b1d94 100644
@@ -50,6 +50,7 @@ xfs-y				+= xfs_aops.o \
 				   xfs_mru_cache.o \
 				   xfs_rename.o \
 				   xfs_super.o \
+				   xfs_symlink.o \
 				   xfs_trans.o \
 				   xfs_utils.o \
 				   xfs_vnodeops.o \
@@ -81,7 +82,7 @@ xfs-y				+= xfs_alloc.o \
 				   xfs_inode_buf.o \
 				   xfs_log_recover.o \
 				   xfs_mount.o \
-				   xfs_symlink.o \
+				   xfs_symlink_remote.o \
 				   xfs_trans_resv.o
 
 # low-level transaction/log code
fs/xfs/xfs_format.h +42 -0

53 lines not on this page · raw message

fs/xfs/xfs_symlink.c +0 -172

186 lines not on this page · raw message

fs/xfs/xfs_symlink.h +1 -41

52 lines not on this page · raw message

fs/xfs/xfs_symlink_remote.c new file +199 -0

199 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 13/50] xfs: move unrelated definitions out of xfs_inode.h

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

---
 fs/xfs/xfs_ialloc.c     |  1 +
 fs/xfs/xfs_icache.h     |  7 +++++++
 fs/xfs/xfs_inode.h      | 38 --------------------------------------
 fs/xfs/xfs_log_format.h |  8 ++++++++
 4 files changed, 16 insertions(+), 38 deletions(-)
fs/xfs/xfs_ialloc.c +1 -0
index 7a0c17d..bd4e2a7 100644
@@ -39,6 +39,7 @@
 #include "xfs_cksum.h"
 #include "xfs_buf_item.h"
 #include "xfs_icreate_item.h"
+#include "xfs_icache.h"
 
 
 /*
fs/xfs/xfs_icache.h +7 -0
index a01afbb..e3f2ee0 100644
@@ -24,6 +24,13 @@ struct xfs_perag;
 #define SYNC_WAIT		0x0001	/* wait for i/o to complete */
 #define SYNC_TRYLOCK		0x0002  /* only try to lock inodes */
 
+/*
+ * Flags for xfs_iget()
+ */
+#define XFS_IGET_CREATE		0x1
+#define XFS_IGET_UNTRUSTED	0x2
+#define XFS_IGET_DONTCACHE	0x4
+
 int xfs_iget(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t ino,
 	     uint flags, uint lock_flags, xfs_inode_t **ipp);
 
fs/xfs/xfs_inode.h +0 -38
index bf0f714..0bd034a 100644
@@ -34,37 +34,6 @@ struct xfs_imap {
 	ushort		im_boffset;	/* inode offset in block in bytes */
 };
 
-/*
- * This is the xfs in-core inode structure.
- * Most of the on-disk inode is embedded in the i_d field.
- *
- * The extent pointers/inline file space, however, are managed
- * separately.  The memory for this information is pointed to by
- * the if_u1 unions depending on the type of the data.
- * This is used to linearize the array of extents for fast in-core
- * access.  This is used until the file's number of extents
- * surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers
- * are accessed through the buffer cache.
- *
- * Other state kept in the in-core inode is used for identification,
- * locking, transactional updating, etc of the inode.
- *
- * Generally, we do not want to hold the i_rlock while holding the
- * i_ilock. Hierarchy is i_iolock followed by i_rlock.
- *
- * xfs_iptr_t contains all the inode fields up to and including the
- * i_mnext and i_mprev fields, it is used as a marker in the inode
- * chain off the mount structure by xfs_sync calls.
- */
-
-/*
- * Flags for xfs_ichgtime().
- */
-#define	XFS_ICHGTIME_MOD	0x1	/* data fork modification timestamp */
-#define	XFS_ICHGTIME_CHG	0x2	/* inode field change timestamp */
-#define	XFS_ICHGTIME_CREATE	0x4	/* inode create timestamp */
-
-
 #ifdef __KERNEL__
 
 struct xfs_buf;
@@ -400,13 +369,6 @@ do { \
 
 #endif /* __KERNEL__ */
 
-/*
- * Flags for xfs_iget()
- */
-#define XFS_IGET_CREATE		0x1
-#define XFS_IGET_UNTRUSTED	0x2
-#define XFS_IGET_DONTCACHE	0x4
-
 int		xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *,
 			       struct xfs_imap *, struct xfs_dinode **,
 			       struct xfs_buf **, uint, uint);
fs/xfs/xfs_log_format.h +8 -0
index faf3f43..198381e 100644
@@ -393,6 +393,14 @@ struct xfs_log_item_desc {
 #define	XFS_DQUOT_REF		1
 
 /*
+ * Flags for xfs_trans_ichgtime().
+ */
+#define	XFS_ICHGTIME_MOD	0x1	/* data fork modification timestamp */
+#define	XFS_ICHGTIME_CHG	0x2	/* inode field change timestamp */
+#define	XFS_ICHGTIME_CREATE	0x4	/* inode create timestamp */
+
+
+/*
  * Inode Log Item Format definitions.
  *
  * This is the structure used to lay out an inode log item in the
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 05/50] xfs: separate dquot on disk format definitions out of xfs_quota.h

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.

---
 fs/xfs/xfs_attr.c        |   2 +-
 fs/xfs/xfs_bmap.c        |   2 +-
 fs/xfs/xfs_bmap_btree.c  |   2 +-
 fs/xfs/xfs_discard.c     |   1 +
 fs/xfs/xfs_dquot.c       |   1 +
 fs/xfs/xfs_dquot_item.c  |   1 +
 fs/xfs/xfs_format.h      |  86 ++++++++++++++++++++++++++++++++
 fs/xfs/xfs_icache.c      |   1 +
 fs/xfs/xfs_inode.c       |   2 +-
 fs/xfs/xfs_ioctl.c       |   1 +
 fs/xfs/xfs_iomap.c       |   1 +
 fs/xfs/xfs_iops.c        |   1 +
 fs/xfs/xfs_log_format.h  |  58 ++++++++++++++++++++++
 fs/xfs/xfs_log_recover.c |   2 +-
 fs/xfs/xfs_mount.c       |   2 +-
 fs/xfs/xfs_qm.c          |   1 +
 fs/xfs/xfs_qm_bhv.c      |   1 +
 fs/xfs/xfs_qm_syscalls.c |   1 +
 fs/xfs/xfs_quota.h       | 126 -----------------------------------------------
 fs/xfs/xfs_quotaops.c    |   1 +
 fs/xfs/xfs_rename.c      |   2 +-
 fs/xfs/xfs_super.c       |   1 +
 fs/xfs/xfs_symlink.c     |   2 +-
 fs/xfs/xfs_trace.c       |   1 +
 fs/xfs/xfs_trans.c       |   2 +-
 fs/xfs/xfs_trans_dquot.c |   1 +
 fs/xfs/xfs_types.h       |   6 +++
 fs/xfs/xfs_utils.c       |   2 +-
 fs/xfs/xfs_vnodeops.c    |   2 +-
 29 files changed, 175 insertions(+), 137 deletions(-)
 create mode 100644 fs/xfs/xfs_format.h
fs/xfs/xfs_attr.c +1 -1
index 20fe3fe..27a48bb 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_bmap.c +1 -1
index 05c698c..0343b44 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
fs/xfs/xfs_bmap_btree.c +1 -1
index 0c61a22..bcee383 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_discard.c +1 -0
index 69cf4fc..65831f9 100644
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
+#include "xfs_format.h"
 #include "xfs_sb.h"
 #include "xfs_log.h"
 #include "xfs_ag.h"
fs/xfs/xfs_dquot.c +1 -0
index 0adf27e..36e1cf3 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_dquot_item.c +1 -0
index 57aa4b0..f07a436 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_format.h new file +86 -0

86 lines not on this page · raw message

fs/xfs/xfs_icache.c +1 -0
index 3f90e1c..d9a4167 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_types.h"
 #include "xfs_log.h"
 #include "xfs_log_priv.h"
fs/xfs/xfs_inode.c +1 -1
index bb262c2..516a70a 100644
@@ -19,7 +19,7 @@
 
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
 #include "xfs_trans.h"
fs/xfs/xfs_ioctl.c +1 -0
index 6e2bca5..3124efa 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_iomap.c +1 -0
index 6a70964..e4577f8 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_iops.c +1 -0
index 96dda62..e441698 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_acl.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_log_format.h +58 -0

62 lines not on this page · raw message

fs/xfs/xfs_log_recover.c +1 -1
index 7d3fc9e..7e48086 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
fs/xfs/xfs_mount.c +1 -1
index a0fa802..ca4a1a5 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
fs/xfs/xfs_qm.c +1 -0
index 1e2361d..92c36ac 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_qm_bhv.c +1 -0
index 437a52d..3af50cc 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_qm_syscalls.c +1 -0
index 8d9e4c7..1851939 100644
@@ -20,6 +20,7 @@
 
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_quota.h +0 -126

144 lines not on this page · raw message

fs/xfs/xfs_quotaops.c +1 -0
index 20e30f9..acf5071 100644
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
+#include "xfs_format.h"
 #include "xfs_sb.h"
 #include "xfs_log.h"
 #include "xfs_ag.h"
fs/xfs/xfs_rename.c +1 -1
index 30ff5f4..0c1f8ef 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_super.c +1 -0
index 19922eb..47a1abd 100644
@@ -17,6 +17,7 @@
  */
 
 #include "xfs.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
 #include "xfs_trans.h"
fs/xfs/xfs_symlink.c +1 -1
index f4895b6..80d550c 100644
@@ -18,7 +18,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_trace.c +1 -0
index b6e3897..5d7b3e4 100644
@@ -18,6 +18,7 @@
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_trans.c +1 -1
index 35a2299..1d2a061 100644
@@ -18,7 +18,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_trans_dquot.c +1 -0
index 61407a8..54ee3c5 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_types.h +6 -0
index 39c48ca..69074ac 100644
@@ -177,4 +177,10 @@ struct xfs_name {
 	int			len;
 };
 
+/*
+ * uid_t and gid_t are hard-coded to 32 bits in the inode.
+ * Hence, an 'id' in a dquot is 32 bits..
+ */
+typedef __uint32_t	xfs_dqid_t;
+
 #endif	/* __XFS_TYPES_H__ */
fs/xfs/xfs_utils.c +1 -1
index 0025c78..58386fa 100644
@@ -17,7 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_vnodeops.c +1 -1
index dc730ac..c2d96cd 100644
@@ -19,7 +19,7 @@
 
 #include "xfs.h"
 #include "xfs_fs.h"
-#include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 07/50] xfs: split out on-disk transaction definitions

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

There's a bunch of definitions in xfs_trans.h that define on-disk formats - transaction headers that get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains in xfs_trans.h are kernel only definitions.

Also, remove the duplicate magic number definitions for XFS_TRANS_MAGIC...

---
 fs/xfs/xfs_log_format.h | 206 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_trans.c      |   4 +-
 fs/xfs/xfs_trans.h      | 205 -----------------------------------------------
 3 files changed, 208 insertions(+), 207 deletions(-)
fs/xfs/xfs_log_format.h +206 -0
index 02639c7..faf3f43 100644
@@ -187,6 +187,212 @@ typedef struct xfs_log_iovec {
 
 
 /*
+ * Transaction Header definitions.
+ *
+ * This is the structure written in the log at the head of every transaction. It
+ * identifies the type and id of the transaction, and contains the number of
+ * items logged by the transaction so we know how many to expect during
+ * recovery.
+ *
+ * Do not change the below structure without redoing the code in
+ * xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans().
+ */
+typedef struct xfs_trans_header {
+	uint		th_magic;		/* magic number */
+	uint		th_type;		/* transaction type */
+	__int32_t	th_tid;			/* transaction id (unused) */
+	uint		th_num_items;		/* num items logged by trans */
+} xfs_trans_header_t;
+
+#define	XFS_TRANS_HEADER_MAGIC	0x5452414e	/* TRAN */
+
+/*
+ * Log item types.
+ */
+#define	XFS_LI_EFI		0x1236
+#define	XFS_LI_EFD		0x1237
+#define	XFS_LI_IUNLINK		0x1238
+#define	XFS_LI_INODE		0x123b	/* aligned ino chunks, var-size ibufs */
+#define	XFS_LI_BUF		0x123c	/* v2 bufs, variable sized inode bufs */
+#define	XFS_LI_DQUOT		0x123d
+#define	XFS_LI_QUOTAOFF		0x123e
+#define	XFS_LI_ICREATE		0x123f
+
+#define XFS_LI_TYPE_DESC \
+	{ XFS_LI_EFI,		"XFS_LI_EFI" }, \
+	{ XFS_LI_EFD,		"XFS_LI_EFD" }, \
+	{ XFS_LI_IUNLINK,	"XFS_LI_IUNLINK" }, \
+	{ XFS_LI_INODE,		"XFS_LI_INODE" }, \
+	{ XFS_LI_BUF,		"XFS_LI_BUF" }, \
+	{ XFS_LI_DQUOT,		"XFS_LI_DQUOT" }, \
+	{ XFS_LI_QUOTAOFF,	"XFS_LI_QUOTAOFF" }, \
+	{ XFS_LI_ICREATE,	"XFS_LI_ICREATE" }
+
+/*
+ * Transaction types.  Used to distinguish types of buffers.
+ */
+#define XFS_TRANS_SETATTR_NOT_SIZE	1
+#define XFS_TRANS_SETATTR_SIZE		2
+#define XFS_TRANS_INACTIVE		3
+#define XFS_TRANS_CREATE		4
+#define XFS_TRANS_CREATE_TRUNC		5
+#define XFS_TRANS_TRUNCATE_FILE		6
+#define XFS_TRANS_REMOVE		7
+#define XFS_TRANS_LINK			8
+#define XFS_TRANS_RENAME		9
+#define XFS_TRANS_MKDIR			10
+#define XFS_TRANS_RMDIR			11
+#define XFS_TRANS_SYMLINK		12
+#define XFS_TRANS_SET_DMATTRS		13
+#define XFS_TRANS_GROWFS		14
+#define XFS_TRANS_STRAT_WRITE		15
+#define XFS_TRANS_DIOSTRAT		16
+/* 17 was XFS_TRANS_WRITE_SYNC */
+#define	XFS_TRANS_WRITEID		18
+#define	XFS_TRANS_ADDAFORK		19
+#define	XFS_TRANS_ATTRINVAL		20
+#define	XFS_TRANS_ATRUNCATE		21
+#define	XFS_TRANS_ATTR_SET		22
+#define	XFS_TRANS_ATTR_RM		23
+#define	XFS_TRANS_ATTR_FLAG		24
+#define	XFS_TRANS_CLEAR_AGI_BUCKET	25
+#define XFS_TRANS_QM_SBCHANGE		26
+/*
+ * Dummy entries since we use the transaction type to index into the
+ * trans_type[] in xlog_recover_print_trans_head()
+ */
+#define XFS_TRANS_DUMMY1		27
+#define XFS_TRANS_DUMMY2		28
+#define XFS_TRANS_QM_QUOTAOFF		29
+#define XFS_TRANS_QM_DQALLOC		30
+#define XFS_TRANS_QM_SETQLIM		31
+#define XFS_TRANS_QM_DQCLUSTER		32
+#define XFS_TRANS_QM_QINOCREATE		33
+#define XFS_TRANS_QM_QUOTAOFF_END	34
+#define XFS_TRANS_SB_UNIT		35
+#define XFS_TRANS_FSYNC_TS		36
+#define	XFS_TRANS_GROWFSRT_ALLOC	37
+#define	XFS_TRANS_GROWFSRT_ZERO		38
+#define	XFS_TRANS_GROWFSRT_FREE		39
+#define	XFS_TRANS_SWAPEXT		40
+#define	XFS_TRANS_SB_COUNT		41
+#define	XFS_TRANS_CHECKPOINT		42
+#define	XFS_TRANS_ICREATE		43
+#define	XFS_TRANS_TYPE_MAX		43
+/* new transaction types need to be reflected in xfs_logprint(8) */
+
+#define XFS_TRANS_TYPES \
+	{ XFS_TRANS_SETATTR_NOT_SIZE,	"SETATTR_NOT_SIZE" }, \
+	{ XFS_TRANS_SETATTR_SIZE,	"SETATTR_SIZE" }, \
+	{ XFS_TRANS_INACTIVE,		"INACTIVE" }, \
+	{ XFS_TRANS_CREATE,		"CREATE" }, \
+	{ XFS_TRANS_CREATE_TRUNC,	"CREATE_TRUNC" }, \
+	{ XFS_TRANS_TRUNCATE_FILE,	"TRUNCATE_FILE" }, \
+	{ XFS_TRANS_REMOVE,		"REMOVE" }, \
+	{ XFS_TRANS_LINK,		"LINK" }, \
+	{ XFS_TRANS_RENAME,		"RENAME" }, \
+	{ XFS_TRANS_MKDIR,		"MKDIR" }, \
+	{ XFS_TRANS_RMDIR,		"RMDIR" }, \
+	{ XFS_TRANS_SYMLINK,		"SYMLINK" }, \
+	{ XFS_TRANS_SET_DMATTRS,	"SET_DMATTRS" }, \
+	{ XFS_TRANS_GROWFS,		"GROWFS" }, \
+	{ XFS_TRANS_STRAT_WRITE,	"STRAT_WRITE" }, \
+	{ XFS_TRANS_DIOSTRAT,		"DIOSTRAT" }, \
+	{ XFS_TRANS_WRITEID,		"WRITEID" }, \
+	{ XFS_TRANS_ADDAFORK,		"ADDAFORK" }, \
+	{ XFS_TRANS_ATTRINVAL,		"ATTRINVAL" }, \
+	{ XFS_TRANS_ATRUNCATE,		"ATRUNCATE" }, \
+	{ XFS_TRANS_ATTR_SET,		"ATTR_SET" }, \
+	{ XFS_TRANS_ATTR_RM,		"ATTR_RM" }, \
+	{ XFS_TRANS_ATTR_FLAG,		"ATTR_FLAG" }, \
+	{ XFS_TRANS_CLEAR_AGI_BUCKET,	"CLEAR_AGI_BUCKET" }, \
+	{ XFS_TRANS_QM_SBCHANGE,	"QM_SBCHANGE" }, \
+	{ XFS_TRANS_QM_QUOTAOFF,	"QM_QUOTAOFF" }, \
+	{ XFS_TRANS_QM_DQALLOC,		"QM_DQALLOC" }, \
+	{ XFS_TRANS_QM_SETQLIM,		"QM_SETQLIM" }, \
+	{ XFS_TRANS_QM_DQCLUSTER,	"QM_DQCLUSTER" }, \
+	{ XFS_TRANS_QM_QINOCREATE,	"QM_QINOCREATE" }, \
+	{ XFS_TRANS_QM_QUOTAOFF_END,	"QM_QOFF_END" }, \
+	{ XFS_TRANS_SB_UNIT,		"SB_UNIT" }, \
+	{ XFS_TRANS_FSYNC_TS,		"FSYNC_TS" }, \
+	{ XFS_TRANS_GROWFSRT_ALLOC,	"GROWFSRT_ALLOC" }, \
+	{ XFS_TRANS_GROWFSRT_ZERO,	"GROWFSRT_ZERO" }, \
+	{ XFS_TRANS_GROWFSRT_FREE,	"GROWFSRT_FREE" }, \
+	{ XFS_TRANS_SWAPEXT,		"SWAPEXT" }, \
+	{ XFS_TRANS_SB_COUNT,		"SB_COUNT" }, \
+	{ XFS_TRANS_CHECKPOINT,		"CHECKPOINT" }, \
+	{ XFS_TRANS_DUMMY1,		"DUMMY1" }, \
+	{ XFS_TRANS_DUMMY2,		"DUMMY2" }, \
+	{ XLOG_UNMOUNT_REC_TYPE,	"UNMOUNT" }
+
+/*
+ * This structure is used to track log items associated with
+ * a transaction.  It points to the log item and keeps some
+ * flags to track the state of the log item.  It also tracks
+ * the amount of space needed to log the item it describes
+ * once we get to commit processing (see xfs_trans_commit()).
+ */
+struct xfs_log_item_desc {
+	struct xfs_log_item	*lid_item;
+	struct list_head	lid_trans;
+	unsigned char		lid_flags;
+};
+
+#define XFS_LID_DIRTY		0x1
+
+/*
+ * Values for t_flags.
+ */
+#define	XFS_TRANS_DIRTY		0x01	/* something needs to be logged */
+#define	XFS_TRANS_SB_DIRTY	0x02	/* superblock is modified */
+#define	XFS_TRANS_PERM_LOG_RES	0x04	/* xact took a permanent log res */
+#define	XFS_TRANS_SYNC		0x08	/* make commit synchronous */
+#define XFS_TRANS_DQ_DIRTY	0x10	/* at least one dquot in trx dirty */
+#define XFS_TRANS_RESERVE	0x20    /* OK to use reserved data blocks */
+#define XFS_TRANS_FREEZE_PROT	0x40	/* Transaction has elevated writer
+					   count in superblock */
+
+/*
+ * Values for call flags parameter.
+ */
+#define	XFS_TRANS_RELEASE_LOG_RES	0x4
+#define	XFS_TRANS_ABORT			0x8
+
+/*
+ * Field values for xfs_trans_mod_sb.
+ */
+#define	XFS_TRANS_SB_ICOUNT		0x00000001
+#define	XFS_TRANS_SB_IFREE		0x00000002
+#define	XFS_TRANS_SB_FDBLOCKS		0x00000004
+#define	XFS_TRANS_SB_RES_FDBLOCKS	0x00000008
+#define	XFS_TRANS_SB_FREXTENTS		0x00000010
+#define	XFS_TRANS_SB_RES_FREXTENTS	0x00000020
+#define	XFS_TRANS_SB_DBLOCKS		0x00000040
+#define	XFS_TRANS_SB_AGCOUNT		0x00000080
+#define	XFS_TRANS_SB_IMAXPCT		0x00000100
+#define	XFS_TRANS_SB_REXTSIZE		0x00000200
+#define	XFS_TRANS_SB_RBMBLOCKS		0x00000400
+#define	XFS_TRANS_SB_RBLOCKS		0x00000800
+#define	XFS_TRANS_SB_REXTENTS		0x00001000
+#define	XFS_TRANS_SB_REXTSLOG		0x00002000
+
+/*
+ * Here we centralize the specification of XFS meta-data buffer
+ * reference count values.  This determine how hard the buffer
+ * cache tries to hold onto the buffer.
+ */
+#define	XFS_AGF_REF		4
+#define	XFS_AGI_REF		4
+#define	XFS_AGFL_REF		3
+#define	XFS_INO_BTREE_REF	3
+#define	XFS_ALLOC_BTREE_REF	2
+#define	XFS_BMAP_BTREE_REF	2
+#define	XFS_DIR_BTREE_REF	2
+#define	XFS_INO_REF		2
+#define	XFS_ATTR_BTREE_REF	1
+#define	XFS_DQUOT_REF		1
+
+/*
  * Inode Log Item Format definitions.
  *
  * This is the structure used to lay out an inode log item in the
fs/xfs/xfs_trans.c +2 -2
index 1d2a061..9b70df3 100644
@@ -744,7 +744,7 @@ _xfs_trans_alloc(
 	atomic_inc(&mp->m_active_trans);
 
 	tp = kmem_zone_zalloc(xfs_trans_zone, memflags);
-	tp->t_magic = XFS_TRANS_MAGIC;
+	tp->t_magic = XFS_TRANS_HEADER_MAGIC;
 	tp->t_type = type;
 	tp->t_mountp = mp;
 	INIT_LIST_HEAD(&tp->t_items);
@@ -789,7 +789,7 @@ xfs_trans_dup(
 	/*
 	 * Initialize the new transaction structure.
 	 */
-	ntp->t_magic = XFS_TRANS_MAGIC;
+	ntp->t_magic = XFS_TRANS_HEADER_MAGIC;
 	ntp->t_type = tp->t_type;
 	ntp->t_mountp = tp->t_mountp;
 	INIT_LIST_HEAD(&ntp->t_items);
fs/xfs/xfs_trans.h +0 -205

217 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 10/50] xfs: sync minor header differences needed by userspace.

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Little things like exported functions, __KERNEL__ protections, and so on that ensure user and kernel shared headers are identical.

---
 fs/xfs/xfs_attr.c        |  1 +
 fs/xfs/xfs_attr_leaf.c   |  1 +
 fs/xfs/xfs_attr_leaf.h   |  2 ++
 fs/xfs/xfs_attr_remote.c |  1 +
 fs/xfs/xfs_bmap.h        |  2 ++
 fs/xfs/xfs_btree.h       |  2 --
 fs/xfs/xfs_dir2_format.h |  3 +++
 fs/xfs/xfs_fs.h          | 17 +++++++++++++++++
 fs/xfs/xfs_sb.h          |  7 +++++++
 fs/xfs/xfs_symlink.h     |  3 ++-
 fs/xfs/xfs_trans.h       |  5 +----
 fs/xfs/xfs_trans_priv.h  |  3 +++
 fs/xfs/xfs_types.h       |  3 ++-
 13 files changed, 42 insertions(+), 8 deletions(-)
fs/xfs/xfs_attr.c +1 -0
index 27a48bb..0d92e21 100644
@@ -21,6 +21,7 @@
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
+#include "xfs_trans_priv.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
fs/xfs/xfs_attr_leaf.c +1 -0
index b800fbc..e6497d0 100644
@@ -22,6 +22,7 @@
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
+#include "xfs_trans_priv.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
fs/xfs/xfs_attr_leaf.h +2 -0
index 444a770..c102213 100644
@@ -333,6 +333,8 @@ int	xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
 			struct xfs_buf **bpp);
 void	xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to,
 				     struct xfs_attr_leafblock *from);
+void	xfs_attr3_leaf_hdr_to_disk(struct xfs_attr_leafblock *to,
+				   struct xfs_attr3_icleaf_hdr *from);
 
 extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops;
 
fs/xfs/xfs_attr_remote.c +1 -0
index ef6b0c1..39a59ea 100644
@@ -22,6 +22,7 @@
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
+#include "xfs_trans_priv.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
fs/xfs/xfs_bmap.h +2 -0
index 1cf1292..314dca1 100644
@@ -137,9 +137,11 @@ typedef struct xfs_bmalloca {
 	char			conv;	/* overwriting unwritten extents */
 	char			stack_switch;
 	int			flags;
+#ifdef __KERNEL__
 	struct completion	*done;
 	struct work_struct	work;
 	int			result;
+#endif /* __KERNEL__ */
 } xfs_bmalloca_t;
 
 /*
fs/xfs/xfs_btree.h +0 -2
index 55e3c7c..c8473c7 100644
@@ -88,13 +88,11 @@ struct xfs_btree_block {
 #define XFS_BTREE_SBLOCK_CRC_LEN	(XFS_BTREE_SBLOCK_LEN + 40)
 #define XFS_BTREE_LBLOCK_CRC_LEN	(XFS_BTREE_LBLOCK_LEN + 48)
 
-
 #define XFS_BTREE_SBLOCK_CRC_OFF \
 	offsetof(struct xfs_btree_block, bb_u.s.bb_crc)
 #define XFS_BTREE_LBLOCK_CRC_OFF \
 	offsetof(struct xfs_btree_block, bb_u.l.bb_crc)
 
-
 /*
  * Generic key, ptr and record wrapper structures.
  *
fs/xfs/xfs_dir2_format.h +3 -0
index 7826782..2095e17 100644
@@ -519,6 +519,9 @@ struct xfs_dir3_leaf {
 
 #define XFS_DIR3_LEAF_CRC_OFF  offsetof(struct xfs_dir3_leaf_hdr, info.crc)
 
+extern void xfs_dir3_leaf_hdr_from_disk(struct xfs_dir3_icleaf_hdr *to,
+					struct xfs_dir2_leaf *from);
+
 static inline int
 xfs_dir3_leaf_hdr_size(struct xfs_dir2_leaf *lp)
 {
fs/xfs/xfs_fs.h +17 -0
index d046955..68c2e18 100644
@@ -311,6 +311,17 @@ typedef struct xfs_bstat {
 } xfs_bstat_t;
 
 /*
+ * Project quota id helpers (previously projid was 16bit only
+ * and using two 16bit values to hold new 32bit projid was choosen
+ * to retain compatibility with "old" filesystems).
+ */
+static inline __uint32_t
+bstat_get_projid(struct xfs_bstat *bs)
+{
+	return (__uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo;
+}
+
+/*
  * The user-level BulkStat Request interface structure.
  */
 typedef struct xfs_fsop_bulkreq {
@@ -511,8 +522,14 @@ typedef struct xfs_handle {
 #define XFS_IOC_ERROR_INJECTION	     _IOW ('X', 116, struct xfs_error_injection)
 #define XFS_IOC_ERROR_CLEARALL	     _IOW ('X', 117, struct xfs_error_injection)
 /*	XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118	 */
+
 /*	XFS_IOC_FREEZE		  -- FIFREEZE   119	 */
 /*	XFS_IOC_THAW		  -- FITHAW     120	 */
+#ifndef FIFREEZE
+#define XFS_IOC_FREEZE		     _IOWR('X', 119, int)
+#define XFS_IOC_THAW		     _IOWR('X', 120, int)
+#endif
+
 #define XFS_IOC_FSSETDM_BY_HANDLE    _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)
 #define XFS_IOC_ATTRLIST_BY_HANDLE   _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
 #define XFS_IOC_ATTRMULTI_BY_HANDLE  _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
fs/xfs/xfs_sb.h +7 -0
index a6ff9d6..40b003e 100644
@@ -554,6 +554,13 @@ static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp)
 		(sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT));
 }
 
+static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp)
+{
+	sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
+	sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT;
+	sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT;
+}
+
 static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp)
 {
 	return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
fs/xfs/xfs_symlink.h +2 -1
index 3743948..c8e3a02 100644
@@ -49,7 +49,8 @@ struct xfs_dsymlink_hdr {
 			sizeof(struct xfs_dsymlink_hdr) : 0))
 
 int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
-
+bool xfs_symlink_hdr_ok(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
+			uint32_t size, struct xfs_buf *bp);
 void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
 				 struct xfs_inode *ip, struct xfs_ifork *ifp);
 
fs/xfs/xfs_trans.h +1 -4
index ffaa584..772d5ae 100644
@@ -64,7 +64,7 @@ struct xfs_log_item;
 #define	XFS_ADDAFORK_LOG_RES(mp)	((mp)->m_reservations.tr_addafork)
 #define	XFS_ATTRINVAL_LOG_RES(mp)	((mp)->m_reservations.tr_attrinval)
 #define	XFS_ATTRSETM_LOG_RES(mp)	((mp)->m_reservations.tr_attrsetm)
-#define XFS_ATTRSETRT_LOG_RES(mp)	((mp)->m_reservations.tr_attrsetrt)
+#define	XFS_ATTRSETRT_LOG_RES(mp)	((mp)->m_reservations.tr_attrsetrt)
 #define	XFS_ATTRRM_LOG_RES(mp)		((mp)->m_reservations.tr_attrrm)
 #define	XFS_CLEAR_AGI_BUCKET_LOG_RES(mp)  ((mp)->m_reservations.tr_clearagi)
 #define XFS_QM_SBCHANGE_LOG_RES(mp)	((mp)->m_reservations.tr_qm_sbchange)
@@ -325,7 +325,4 @@ extern kmem_zone_t	*xfs_log_item_desc_zone;
 
 #endif	/* __KERNEL__ */
 
-void		xfs_trans_init(struct xfs_mount *);
-int		xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
-
 #endif	/* __XFS_TRANS_H__ */
fs/xfs/xfs_trans_priv.h +3 -0
index 53b7c9b..d43b130 100644
@@ -25,6 +25,9 @@ struct xfs_trans;
 struct xfs_ail;
 struct xfs_log_vec;
 
+
+void	xfs_trans_init(struct xfs_mount *);
+int	xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
 void	xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *);
 void	xfs_trans_del_item(struct xfs_log_item *);
 void	xfs_trans_free_items(struct xfs_trans *tp, xfs_lsn_t commit_lsn,
fs/xfs/xfs_types.h +2 -1
index 781772c..6ed6b26 100644
@@ -32,7 +32,6 @@ typedef unsigned int		__uint32_t;
 typedef signed long long int	__int64_t;
 typedef unsigned long long int	__uint64_t;
 
-typedef __uint32_t		prid_t;		/* project ID */
 typedef __uint32_t		inst_t;		/* an instruction */
 
 typedef __s64			xfs_off_t;	/* <file offset> type */
@@ -55,6 +54,8 @@ typedef __uint64_t __psunsigned_t;
 
 #endif	/* __KERNEL__ */
 
+typedef __uint32_t	prid_t;		/* project ID */
+
 typedef __uint32_t	xfs_agblock_t;	/* blockno in alloc. group */
 typedef	__uint32_t	xfs_agino_t;	/* inode # within allocation grp */
 typedef	__uint32_t	xfs_extlen_t;	/* extent length in blocks */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 16/50] xfs: reshuffle dir2 definitions around for userspace

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Many of the definitions within xfs_dir2_priv.h are needed in userspace outside libxfs. Definitions within xfs_dir2_priv.h are wholly contained within libxfs, so we need to shuffle some of the definitions around to keep consistency across files shared between user and kernel space.

---
 fs/xfs/xfs_bmap.c         |  3 ++-
 fs/xfs/xfs_da_btree.c     |  2 +-
 fs/xfs/xfs_dir2.c         |  2 +-
 fs/xfs/xfs_dir2.h         | 51 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_dir2_block.c   |  2 +-
 fs/xfs/xfs_dir2_data.c    |  6 ++----
 fs/xfs/xfs_dir2_leaf.c    |  1 +
 fs/xfs/xfs_dir2_node.c    |  1 +
 fs/xfs/xfs_dir2_priv.h    | 31 ----------------------------
 fs/xfs/xfs_dir2_readdir.c |  1 +
 fs/xfs/xfs_dir2_sf.c      |  6 +++---
 fs/xfs/xfs_export.c       |  4 +++-
 fs/xfs/xfs_file.c         |  2 +-
 fs/xfs/xfs_icreate_item.c | 12 -----------
 fs/xfs/xfs_log_recover.c  |  2 +-
 fs/xfs/xfs_mount.c        |  4 +++-
 fs/xfs/xfs_rename.c       |  3 ++-
 fs/xfs/xfs_rtalloc.c      |  1 -
 fs/xfs/xfs_super.c        |  3 ++-
 fs/xfs/xfs_symlink.c      |  3 ++-
 fs/xfs/xfs_utils.c        |  4 +++-
 fs/xfs/xfs_vnodeops.c     |  3 ++-
 22 files changed, 83 insertions(+), 64 deletions(-)
fs/xfs/xfs_bmap.c +2 -1
index 0343b44..72a2eea 100644
@@ -24,9 +24,10 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
 #include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_ialloc_btree.h"
fs/xfs/xfs_da_btree.c +1 -1
index 0b8b2a1..8bbd7ef 100644
@@ -27,8 +27,8 @@
 #include "xfs_mount.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
-#include "xfs_dir2.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
fs/xfs/xfs_dir2.c +1 -1
index 431be44..c3263a5 100644
@@ -31,8 +31,8 @@
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
-#include "xfs_dir2.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_vnodeops.h"
fs/xfs/xfs_dir2.h +51 -0

61 lines not on this page · raw message

fs/xfs/xfs_dir2_block.c +1 -1
index 5e84000..becd69f 100644
@@ -31,8 +31,8 @@
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
 #include "xfs_buf_item.h"
-#include "xfs_dir2.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_trace.h"
fs/xfs/xfs_dir2_data.c +2 -4
index c293023..4e1917d 100644
@@ -29,14 +29,12 @@
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_buf_item.h"
 #include "xfs_cksum.h"
 
-STATIC xfs_dir2_data_free_t *
-xfs_dir2_data_freefind(xfs_dir2_data_hdr_t *hdr, xfs_dir2_data_unused_t *dup);
-
 /*
  * Check the consistency of the data block.
  * The input can also be a block-format directory.
@@ -325,7 +323,7 @@ xfs_dir3_data_readahead(
  * Given a data block and an unused entry from that block,
  * return the bestfree entry if any that corresponds to it.
  */
-STATIC xfs_dir2_data_free_t *
+xfs_dir2_data_free_t *
 xfs_dir2_data_freefind(
 	xfs_dir2_data_hdr_t	*hdr,		/* data block */
 	xfs_dir2_data_unused_t	*dup)		/* data unused entry */
fs/xfs/xfs_dir2_leaf.c +1 -0
index e1386aa..5505edb 100644
@@ -31,6 +31,7 @@
 #include "xfs_inode.h"
 #include "xfs_bmap.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_trace.h"
fs/xfs/xfs_dir2_node.c +1 -0
index 2226a00..b4bd9b6 100644
@@ -30,6 +30,7 @@
 #include "xfs_inode.h"
 #include "xfs_bmap.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_trace.h"
fs/xfs/xfs_dir2_priv.h +0 -31
index 72ff8d7..807eb65 100644
@@ -20,18 +20,12 @@
 
 /* xfs_dir2.c */
 extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
-extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
-extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
 extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
 				xfs_dir2_db_t *dbp);
-extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
-				struct xfs_buf *bp);
 extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
 				const unsigned char *name, int len);
 
 /* xfs_dir2_block.c */
-extern const struct xfs_buf_ops xfs_dir3_block_buf_ops;
-
 extern int xfs_dir3_block_read(struct xfs_trans *tp, struct xfs_inode *dp,
 			       struct xfs_buf **bpp);
 extern int xfs_dir2_block_addname(struct xfs_da_args *args);
@@ -48,39 +42,17 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
 #define	xfs_dir3_data_check(dp,bp)
 #endif
 
-extern const struct xfs_buf_ops xfs_dir3_data_buf_ops;
-extern const struct xfs_buf_ops xfs_dir3_free_buf_ops;
-
 extern int __xfs_dir3_data_check(struct xfs_inode *dp, struct xfs_buf *bp);
 extern int xfs_dir3_data_read(struct xfs_trans *tp, struct xfs_inode *dp,
 		xfs_dablk_t bno, xfs_daddr_t mapped_bno, struct xfs_buf **bpp);
-extern int xfs_dir3_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp,
-		xfs_dablk_t bno, xfs_daddr_t mapped_bno);
 
 extern struct xfs_dir2_data_free *
 xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr,
 		struct xfs_dir2_data_unused *dup, int *loghead);
-extern void xfs_dir2_data_freescan(struct xfs_mount *mp,
-		struct xfs_dir2_data_hdr *hdr, int *loghead);
 extern int xfs_dir3_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
 		struct xfs_buf **bpp);
-extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_buf *bp,
-		struct xfs_dir2_data_entry *dep);
-extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
-		struct xfs_buf *bp);
-extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp,
-		struct xfs_dir2_data_unused *dup);
-extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_buf *bp,
-		xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
-		int *needlogp, int *needscanp);
-extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_buf *bp,
-		struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset,
-		xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
 
 /* xfs_dir2_leaf.c */
-extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;
-extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops;
-
 extern int xfs_dir3_leafn_read(struct xfs_trans *tp, struct xfs_inode *dp,
 		xfs_dablk_t fbno, xfs_daddr_t mappedbno, struct xfs_buf **bpp);
 extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,
@@ -142,9 +114,6 @@ extern int xfs_dir2_free_read(struct xfs_trans *tp, struct xfs_inode *dp,
 		xfs_dablk_t fbno, struct xfs_buf **bpp);
 
 /* xfs_dir2_sf.c */
-extern xfs_ino_t xfs_dir2_sf_get_parent_ino(struct xfs_dir2_sf_hdr *sfp);
-extern xfs_ino_t xfs_dir2_sfe_get_ino(struct xfs_dir2_sf_hdr *sfp,
-		struct xfs_dir2_sf_entry *sfep);
 extern int xfs_dir2_block_sfsize(struct xfs_inode *dp,
 		struct xfs_dir2_data_hdr *block, struct xfs_dir2_sf_hdr *sfhp);
 extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp,
fs/xfs/xfs_dir2_readdir.c +1 -0
index 2bc4b32..5f4f705 100644
@@ -30,6 +30,7 @@
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_trace.h"
fs/xfs/xfs_dir2_sf.c +3 -3
index f24ce90..65b65c5 100644
@@ -29,8 +29,8 @@
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_error.h"
-#include "xfs_dir2.h"
 #include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_trace.h"
 
@@ -95,7 +95,7 @@ xfs_dir2_sf_get_parent_ino(
 	return xfs_dir2_sf_get_ino(hdr, &hdr->parent);
 }
 
-static void
+void
 xfs_dir2_sf_put_parent_ino(
 	struct xfs_dir2_sf_hdr	*hdr,
 	xfs_ino_t		ino)
@@ -123,7 +123,7 @@ xfs_dir2_sfe_get_ino(
 	return xfs_dir2_sf_get_ino(hdr, xfs_dir2_sfe_inop(sfep));
 }
 
-static void
+void
 xfs_dir2_sfe_put_ino(
 	struct xfs_dir2_sf_hdr	*hdr,
 	struct xfs_dir2_sf_entry *sfep,
fs/xfs/xfs_export.c +3 -1
index c585bc6..29c880f 100644
@@ -21,8 +21,10 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
+#include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_export.h"
 #include "xfs_vnodeops.h"
 #include "xfs_bmap_btree.h"
fs/xfs/xfs_file.c +1 -1
index de3dc98..1ba3c79 100644
@@ -32,7 +32,7 @@
 #include "xfs_vnodeops.h"
 #include "xfs_da_btree.h"
 #include "xfs_dir2_format.h"
-#include "xfs_dir2_priv.h"
+#include "xfs_dir2.h"
 #include "xfs_ioctl.h"
 #include "xfs_trace.h"
 
fs/xfs/xfs_icreate_item.c +0 -12
index 7716a4e..441a78a 100644
@@ -20,23 +20,11 @@
 #include "xfs_types.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
-#include "xfs_inum.h"
 #include "xfs_trans.h"
-#include "xfs_buf_item.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
 #include "xfs_trans_priv.h"
-#include "xfs_bmap_btree.h"
-#include "xfs_alloc_btree.h"
-#include "xfs_ialloc_btree.h"
-#include "xfs_attr_sf.h"
-#include "xfs_dinode.h"
-#include "xfs_inode.h"
-#include "xfs_inode_item.h"
-#include "xfs_btree.h"
-#include "xfs_ialloc.h"
 #include "xfs_error.h"
 #include "xfs_icreate_item.h"
 
fs/xfs/xfs_log_recover.c +1 -1
index 7e48086..62ddae3 100644
@@ -51,7 +51,7 @@
 #include "xfs_symlink.h"
 #include "xfs_da_btree.h"
 #include "xfs_dir2_format.h"
-#include "xfs_dir2_priv.h"
+#include "xfs_dir2.h"
 #include "xfs_attr_leaf.h"
 #include "xfs_attr_remote.h"
 
fs/xfs/xfs_mount.c +3 -1
index ca4a1a5..b07ca4b 100644
@@ -25,8 +25,10 @@
 #include "xfs_trans_priv.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
+#include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_ialloc_btree.h"
fs/xfs/xfs_rename.c +2 -1
index 0c1f8ef..4715c7f 100644
@@ -22,9 +22,10 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
 #include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
fs/xfs/xfs_rtalloc.c +0 -1
index 5d900ec..bb4f7a1 100644
@@ -23,7 +23,6 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
fs/xfs/xfs_super.c +2 -1
index 47a1abd..aefc004 100644
@@ -23,7 +23,6 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_alloc.h"
 #include "xfs_quota.h"
 #include "xfs_mount.h"
@@ -47,6 +46,8 @@
 #include "xfs_trans_priv.h"
 #include "xfs_filestream.h"
 #include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_extfree_item.h"
 #include "xfs_mru_cache.h"
 #include "xfs_inode_item.h"
fs/xfs/xfs_symlink.c +2 -1
index 80d550c..dd7c099 100644
@@ -24,9 +24,10 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
 #include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_ialloc_btree.h"
 #include "xfs_dinode.h"
fs/xfs/xfs_utils.c +3 -1
index 58386fa..fde7d22 100644
@@ -22,8 +22,10 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
+#include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
fs/xfs/xfs_vnodeops.c +2 -1
index c2d96cd..221e2e3 100644
@@ -25,9 +25,10 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
 #include "xfs_mount.h"
 #include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_ialloc_btree.h"
 #include "xfs_dinode.h"
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 04/50] xfs: split out EFI/EFD log item format definition

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.

---
 fs/xfs/xfs_extfree_item.h | 88 ++---------------------------------------------
 fs/xfs/xfs_log_format.h   | 83 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 86 deletions(-)
fs/xfs/xfs_extfree_item.h +2 -86
index 4322224..0ffbce3 100644
@@ -18,93 +18,11 @@
 #ifndef	__XFS_EXTFREE_ITEM_H__
 #define	__XFS_EXTFREE_ITEM_H__
 
+/* kernel only EFI/EFD definitions */
+
 struct xfs_mount;
 struct kmem_zone;
 
-typedef struct xfs_extent {
-	xfs_dfsbno_t	ext_start;
-	xfs_extlen_t	ext_len;
-} xfs_extent_t;
-
-/*
- * Since an xfs_extent_t has types (start:64, len: 32)
- * there are different alignments on 32 bit and 64 bit kernels.
- * So we provide the different variants for use by a
- * conversion routine.
- */
-
-typedef struct xfs_extent_32 {
-	__uint64_t	ext_start;
-	__uint32_t	ext_len;
-} __attribute__((packed)) xfs_extent_32_t;
-
-typedef struct xfs_extent_64 {
-	__uint64_t	ext_start;
-	__uint32_t	ext_len;
-	__uint32_t	ext_pad;
-} xfs_extent_64_t;
-
-/*
- * This is the structure used to lay out an efi log item in the
- * log.  The efi_extents field is a variable size array whose
- * size is given by efi_nextents.
- */
-typedef struct xfs_efi_log_format {
-	__uint16_t		efi_type;	/* efi log item type */
-	__uint16_t		efi_size;	/* size of this item */
-	__uint32_t		efi_nextents;	/* # extents to free */
-	__uint64_t		efi_id;		/* efi identifier */
-	xfs_extent_t		efi_extents[1];	/* array of extents to free */
-} xfs_efi_log_format_t;
-
-typedef struct xfs_efi_log_format_32 {
-	__uint16_t		efi_type;	/* efi log item type */
-	__uint16_t		efi_size;	/* size of this item */
-	__uint32_t		efi_nextents;	/* # extents to free */
-	__uint64_t		efi_id;		/* efi identifier */
-	xfs_extent_32_t		efi_extents[1];	/* array of extents to free */
-} __attribute__((packed)) xfs_efi_log_format_32_t;
-
-typedef struct xfs_efi_log_format_64 {
-	__uint16_t		efi_type;	/* efi log item type */
-	__uint16_t		efi_size;	/* size of this item */
-	__uint32_t		efi_nextents;	/* # extents to free */
-	__uint64_t		efi_id;		/* efi identifier */
-	xfs_extent_64_t		efi_extents[1];	/* array of extents to free */
-} xfs_efi_log_format_64_t;
-
-/*
- * This is the structure used to lay out an efd log item in the
- * log.  The efd_extents array is a variable size array whose
- * size is given by efd_nextents;
- */
-typedef struct xfs_efd_log_format {
-	__uint16_t		efd_type;	/* efd log item type */
-	__uint16_t		efd_size;	/* size of this item */
-	__uint32_t		efd_nextents;	/* # of extents freed */
-	__uint64_t		efd_efi_id;	/* id of corresponding efi */
-	xfs_extent_t		efd_extents[1];	/* array of extents freed */
-} xfs_efd_log_format_t;
-
-typedef struct xfs_efd_log_format_32 {
-	__uint16_t		efd_type;	/* efd log item type */
-	__uint16_t		efd_size;	/* size of this item */
-	__uint32_t		efd_nextents;	/* # of extents freed */
-	__uint64_t		efd_efi_id;	/* id of corresponding efi */
-	xfs_extent_32_t		efd_extents[1];	/* array of extents freed */
-} __attribute__((packed)) xfs_efd_log_format_32_t;
-
-typedef struct xfs_efd_log_format_64 {
-	__uint16_t		efd_type;	/* efd log item type */
-	__uint16_t		efd_size;	/* size of this item */
-	__uint32_t		efd_nextents;	/* # of extents freed */
-	__uint64_t		efd_efi_id;	/* id of corresponding efi */
-	xfs_extent_64_t		efd_extents[1];	/* array of extents freed */
-} xfs_efd_log_format_64_t;
-
-
-#ifdef __KERNEL__
-
 /*
  * Max number of extents in fast allocation path.
  */
@@ -160,6 +78,4 @@ int			xfs_efi_copy_format(xfs_log_iovec_t *buf,
 					    xfs_efi_log_format_t *dst_efi_fmt);
 void			xfs_efi_item_free(xfs_efi_log_item_t *);
 
-#endif	/* __KERNEL__ */
-
 #endif	/* __XFS_EXTFREE_ITEM_H__ */
fs/xfs/xfs_log_format.h +83 -0

87 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 50/50] xfs: use reference counts to free clean buffer items

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

When a transaction is cancelled and the buffer log item is clean in the transaction, the buffer log item is unconditionally freed. If the log item is in the AIL, however, this leads to a use after free condition as the item still has other users.

In this case, xfs_buf_item_relse() should only be called on clean buffer items if the reference count has dropped to zero. This ensures only the last user frees the item.

---
 fs/xfs/xfs_buf_item.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/xfs/xfs_buf_item.c +2 -4
index 9358504..3a944b1 100644
@@ -613,11 +613,9 @@ xfs_buf_item_unlock(
 			}
 		}
 	}
-	if (clean)
-		xfs_buf_item_relse(bp);
-	else if (aborted) {
+	if (clean || aborted) {
 		if (atomic_dec_and_test(&bip->bli_refcount)) {
-			ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp));
+			ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
 			xfs_buf_item_relse(bp);
 		}
 	} else
Signature · 6 lines
1.8.3.2

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

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 24 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in the transaction, the buffer log item is unconditionally freed. If the log item is in the AIL, however, this leads to a use after free condition as the item still has other users.

In this case, xfs_buf_item_relse() should only be called on clean buffer items if the reference count has dropped to zero. This ensures only the last user frees the item.

---
  fs/xfs/xfs_buf_item.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
fs/xfs/xfs_buf_item.c +0 -0
index 9358504..3a944b1 100644
@@ -613,11 +613,9 @@ xfs_buf_item_unlock(
  			}
  		}
  	}

fs/xfs/xfs_buf_item.c xfs_buf_item_unlock( · line 621

Quoted 10 lines
fs/xfs/xfs_buf_item.c +2 -4
-	if (clean)
-		xfs_buf_item_relse(bp);
-	else if (aborted) {
+	if (clean || aborted) {
  		if (atomic_dec_and_test(&bip->bli_refcount)) {
-			ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp));
+			ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
  			xfs_buf_item_relse(bp);
  		}
  	} else

why is a clean buffer on the AIL? Racing with a completion handler?

rather than this:

	if (clean || aborted) {
		if (atomic_dec_and_test(&bip->bli_refcount)) {
			ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
			xfs_buf_item_relse(bp);
		}
	} else
		atomic_dec(&bip->bli_refcount);

why not fold it into this:

	if (atomic_dec_and_test(&bip->bli_refcount)) {
		ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
		xfs_buf_item_relse(bp);
	}

--Mark.

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

#24 lore raw

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 29 lines · Mark Tinguely
Quoted 28 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in the transaction, the buffer log item is unconditionally freed. If the log item is in the AIL, however, this leads to a use after free condition as the item still has other users.

In this case, xfs_buf_item_relse() should only be called on clean buffer items if the reference count has dropped to zero. This ensures only the last user frees the item.

---
 fs/xfs/xfs_buf_item.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/xfs/xfs_buf_item.c +1 -3
index 9358504..3a944b1 100644
@@ -613,11 +613,9 @@ xfs_buf_item_unlock(
 			}
 		}
 	}
-	if (clean)
-		xfs_buf_item_relse(bp);
-	else if (aborted) {
+	if (clean || aborted) {
Quoted 8 lines

fs/xfs/xfs_buf_item.c xfs_buf_item_unlock( · line 621

Quoted 6 lines
fs/xfs/xfs_buf_item.c +1 -1
 		if (atomic_dec_and_test(&bip->bli_refcount)) {
-			ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp));
+			ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
 			xfs_buf_item_relse(bp);
 		}
 	} else

why is a clean buffer on the AIL? Racing with a completion handler?

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

Quoted 10 lines

rather than this:

	if (clean || aborted) {
		if (atomic_dec_and_test(&bip->bli_refcount)) {
			ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
			xfs_buf_item_relse(bp);
		}
	} else
		atomic_dec(&bip->bli_refcount);
Quoted 6 lines

why not fold it into this:

	if (atomic_dec_and_test(&bip->bli_refcount)) {
		ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
		xfs_buf_item_relse(bp);
	}

Basically, the code as it stands documents the different exit conditions of a transaction commit. If the item was logged, we expect it to continue existing and something else will free it. If we change it, we lose awareness that there are different exit criteria, and it risks introducing a use after free if there is ever a race condition w.r.t. unpinning the item in an async CIL commit.

I'm not saying that there is a problem here, just that the code as it stands will not free the item in this case. The stale buffer handling has similar requirements (i.e. decrement without freeing so the unpin on log IO completion will free it) and there's a comment in xfs_log_commit_cil() related to avoiding such race conditions.

So I'd prefer to leave it as it stands...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 5 lines · Dave Chinner
Quoted 4 lines · Mark Tinguely
Quoted 3 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in

...

Quoted 5 lines
Quoted 2 lines

why is a clean buffer on the AIL? Racing with a completion handler?

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

I am wondering because it should not have made it into the CIL if it was not dirtied in a transaction - at least according to the the log item descriptor flag at least.

Quoted 25 lines
Quoted 11 lines

rather than this:

	if (clean || aborted) {
		if (atomic_dec_and_test(&bip->bli_refcount)) {
			ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
			xfs_buf_item_relse(bp);
		}
	} else
		atomic_dec(&bip->bli_refcount);
Quoted 6 lines

why not fold it into this:

	if (atomic_dec_and_test(&bip->bli_refcount)) {
		ASSERT(!aborted || XFS_FORCED_SHUTDOWN(lip->li_mountp));
		xfs_buf_item_relse(bp);
	}

Basically, the code as it stands documents the different exit conditions of a transaction commit. If the item was logged, we expect it to continue existing and something else will free it. If we change it, we lose awareness that there are different exit criteria, and it risks introducing a use after free if there is ever a race condition w.r.t. unpinning the item in an async CIL commit.

Quoted 7 lines

I'm not saying that there is a problem here, just that the code as it stands will not free the item in this case. The stale buffer handling has similar requirements (i.e. decrement without freeing so the unpin on log IO completion will free it) and there's a comment in xfs_log_commit_cil() related to avoiding such race conditions.

So I'd prefer to leave it as it stands...

okay with me.

--Mark.

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

#26 lore raw

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 10 lines · Mark Tinguely
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Mark Tinguely
Quoted 3 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in

...

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

why is a clean buffer on the AIL? Racing with a completion handler?

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

I am wondering because it should not have made it into the CIL if it was not dirtied in a transaction - at least according to the the log item descriptor flag at least.

CIL != AIL. IOWs, the bli_refcount going to zero doesn't always mean the bli should be freed. All a zero value means is that it is not tracked by any transaction. If the item is not going to be placed in the AIL (or not already in the AIL) then it can be released (freed). Clean or aborted items are not going into the AIL, so they can be freed immeidately. Everything else needs to avoid freeing the item until the correct state is reached, even if the ref count goes to zero.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 13 lines · Dave Chinner
Quoted 12 lines · Mark Tinguely
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Mark Tinguely
Quoted 3 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in

...

Quoted 3 lines
Quoted 2 lines

why is a clean buffer on the AIL? Racing with a completion handler?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

I am wondering because it should not have made it into the CIL if it was not dirtied in a transaction - at least according to the the log item descriptor flag at least.

CIL != AIL. IOWs, the bli_refcount going to zero doesn't always

By the way, can you explain what the difference is between CIL and AIL?

Quoted 19 lines

mean the bli should be freed. All a zero value means is that it is not tracked by any transaction. If the item is not going to be placed in the AIL (or not already in the AIL) then it can be released (freed). Clean or aborted items are not going into the AIL, so they can be freed immeidately. Everything else needs to avoid freeing the item until the correct state is reached, even if the ref count goes to zero.

Cheers,

Dave.
--
Dave Chinner
[email protected]

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

Signature · 8 lines
Regards,

Zhi Yong Wu

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

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 17 lines · Zhi Yong Wu
Quoted 16 lines · Dave Chinner
Quoted 15 lines · Mark Tinguely
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Mark Tinguely
Quoted 3 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in

...

Quoted 5 lines
Quoted 2 lines

why is a clean buffer on the AIL? Racing with a completion handler?

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

I am wondering because it should not have made it into the CIL if it was not dirtied in a transaction - at least according to the the log item descriptor flag at least.

CIL != AIL. IOWs, the bli_refcount going to zero doesn't always

By the way, can you explain what the difference is between CIL and AIL?

Documentation/filesystems/xfs-delayed-logging-design.txt

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

In reply to Dave Chinner
Quoted 20 lines · Dave Chinner
Quoted 10 lines · Mark Tinguely
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Mark Tinguely
Quoted 3 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in

...

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

why is a clean buffer on the AIL? Racing with a completion handler?

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

I am wondering because it should not have made it into the CIL if it was not dirtied in a transaction - at least according to the the log item descriptor flag at least.

Quoted 9 lines

CIL != AIL. IOWs, the bli_refcount going to zero doesn't always mean the bli should be freed. All a zero value means is that it is not tracked by any transaction. If the item is not going to be placed in the AIL (or not already in the AIL) then it can be released (freed). Clean or aborted items are not going into the AIL, so they can be freed immeidately. Everything else needs to avoid freeing the item until the correct state is reached, even if the ref count goes to zero.

yep.

You are saying that the problem is releasing a buffer that is clean and also in the AIL, I am just trying to figure out if you are fixing a symptom or the problem.

--Mark.

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

Reviewed-by
#30 lore raw

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 31 lines · Mark Tinguely
Quoted 20 lines · Dave Chinner
Quoted 10 lines · Mark Tinguely
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Mark Tinguely
Quoted 3 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in

...

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

why is a clean buffer on the AIL? Racing with a completion handler?

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

I am wondering because it should not have made it into the CIL if it was not dirtied in a transaction - at least according to the the log item descriptor flag at least.

Quoted 9 lines

CIL != AIL. IOWs, the bli_refcount going to zero doesn't always mean the bli should be freed. All a zero value means is that it is not tracked by any transaction. If the item is not going to be placed in the AIL (or not already in the AIL) then it can be released (freed). Clean or aborted items are not going into the AIL, so they can be freed immeidately. Everything else needs to avoid freeing the item until the correct state is reached, even if the ref count goes to zero.

Quoted 7 lines

yep.

You are saying that the problem is releasing a buffer that is clean and also in the AIL, I am just trying to figure out if you are fixing a symptom or the problem.

--Mark.

Sorry for the noise - I was thinking wrong - the clean check is on the current transaction format map for some reason I had buffer maps on my mind - so I get to wear the pointy hat *again* today!

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

#31 lore raw

Re: [PATCH 50/50] xfs: use reference counts to free clean buffer items

Quoted 38 lines · Mark Tinguely
Quoted 37 lines · Mark Tinguely
Quoted 20 lines · Dave Chinner
Quoted 10 lines · Mark Tinguely
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Mark Tinguely
Quoted 3 lines · Dave Chinner

From: Dave Chinner<[email protected]>

When a transaction is cancelled and the buffer log item is clean in

...

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

why is a clean buffer on the AIL? Racing with a completion handler?

"clean" means that it wasn't dirtied in the transaction - it can be in the AIL and holding a reference count that way.

I am wondering because it should not have made it into the CIL if it was not dirtied in a transaction - at least according to the the log item descriptor flag at least.

Quoted 9 lines

CIL != AIL. IOWs, the bli_refcount going to zero doesn't always mean the bli should be freed. All a zero value means is that it is not tracked by any transaction. If the item is not going to be placed in the AIL (or not already in the AIL) then it can be released (freed). Clean or aborted items are not going into the AIL, so they can be freed immeidately. Everything else needs to avoid freeing the item until the correct state is reached, even if the ref count goes to zero.

yep.

You are saying that the problem is releasing a buffer that is clean and also in the AIL, I am just trying to figure out if you are fixing a symptom or the problem.

Quoted 6 lines
Quoted 1 line

--Mark.

Sorry for the noise - I was thinking wrong - the clean check is on the current transaction format map for some reason I had buffer maps on my mind - so I get to wear the pointy hat *again* today!

I think you are still misunderstanding it - the format map will remain dirty even when the item is in the AIL. If the item is relogged, then it has to log all the same regions as the AIL is currently tracking again.

This is why a buffer that is clean *cannot* be in the AIL - it has to be dirty in some way for it to have been committed to the log and then placed in the AIL. And that dirty status is kept until the item is removed from the AIL and freed...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Applied
#32 lore raw

Re: ***** SUSPECTED SPAM ***** [PATCH 50/50] xfs: use reference counts to free clean buffer items

In reply to Dave Chinner
Quoted 7 lines · Dave Chinner

From: Dave Chinner <[email protected]>

When a transaction is cancelled and the buffer log item is clean in the transaction, the buffer log item is unconditionally freed. If the log item is in the AIL, however, this leads to a use after free condition as the item still has other users.

Quoted 5 lines

In this case, xfs_buf_item_relse() should only be called on clean buffer items if the reference count has dropped to zero. This ensures only the last user frees the item.

Applied.

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

#33 lore raw

***** SUSPECTED SPAM ***** [PATCH 32/50] xfs: xfs_filestreams.h doesn't need __KERNEL__

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Because it is only used within the kernel.

---
 fs/xfs/xfs_filestream.h | 4 ----
 1 file changed, 4 deletions(-)
fs/xfs/xfs_filestream.h +0 -4
index 09dd9af..6d61dbe 100644
@@ -18,8 +18,6 @@
 #ifndef __XFS_FILESTREAM_H__
 #define __XFS_FILESTREAM_H__
 
-#ifdef __KERNEL__
-
 struct xfs_mount;
 struct xfs_inode;
 struct xfs_perag;
@@ -69,6 +67,4 @@ xfs_inode_is_filestream(
 		(ip->i_d.di_flags & XFS_DIFLAG_FILESTREAM);
 }
 
-#endif /* __KERNEL__ */
-
 #endif /* __XFS_FILESTREAM_H__ */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 18/50] xfs: split out attribute fork truncation code into separate file

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The attribute inactivation code is not used by userspace, so like the attribute listing, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.

---
 fs/xfs/Makefile            |   1 +
 fs/xfs/xfs_attr.c          |  71 -------
 fs/xfs/xfs_attr_inactive.c | 454 +++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_attr_leaf.c     | 352 -----------------------------------
 4 files changed, 455 insertions(+), 423 deletions(-)
 create mode 100644 fs/xfs/xfs_attr_inactive.c
fs/xfs/Makefile +1 -0
index 94df3ec..a73af1c 100644
@@ -27,6 +27,7 @@ xfs-y				+= xfs_trace.o
 
 # highlevel code
 xfs-y				+= xfs_aops.o \
+				   xfs_attr_inactive.o \
 				   xfs_attr_list.o \
 				   xfs_bit.o \
 				   xfs_buf.o \
fs/xfs/xfs_attr.c +0 -71

77 lines not on this page · raw message

fs/xfs/xfs_attr_inactive.c new file +454 -0

454 lines not on this page · raw message

fs/xfs/xfs_attr_leaf.c +0 -352

361 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 29/50] xfs: kill __KERNEL__ check for debug code in allocation code

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of __KERNEL__ users.

---
 fs/xfs/xfs_alloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/xfs_alloc.c +3 -3
index 71596e5..5a1393f 100644
@@ -878,7 +878,7 @@ xfs_alloc_ag_vextent_near(
 	xfs_agblock_t	ltnew;		/* useful start bno of left side */
 	xfs_extlen_t	rlen;		/* length of returned extent */
 	int		forced = 0;
-#if defined(DEBUG) && defined(__KERNEL__)
+#ifdef DEBUG
 	/*
 	 * Randomly don't execute the first algorithm.
 	 */
@@ -938,8 +938,8 @@ restart:
 		xfs_extlen_t	blen=0;
 		xfs_agblock_t	bnew=0;
 
-#if defined(DEBUG) && defined(__KERNEL__)
-		if (!dofirst)
+#ifdef DEBUG
+		if (dofirst)
 			break;
 #endif
 		/*
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 34/50] xfs: make struct xfs_perag kernel only

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The struct xfs_perag has many kernel-only definitions in it, requiring a __KERNEL__ guard so userspace can use it to. Move it to xfs_mount.h so that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another __KERNEL__ check in the XFS header files.

---
 fs/xfs/xfs_acl.c            |  1 +
 fs/xfs/xfs_ag.h             | 53 ---------------------------------------------
 fs/xfs/xfs_mount.h          | 52 ++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_symlink_remote.c |  1 +
 4 files changed, 54 insertions(+), 53 deletions(-)
fs/xfs/xfs_acl.c +1 -0
index 0c4368a..2f77db8 100644
@@ -22,6 +22,7 @@
 #include "xfs_attr.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_inode.h"
+#include "xfs_ag.h"
 #include "xfs_sb.h"
 #include "xfs_mount.h"
 #include "xfs_trace.h"
fs/xfs/xfs_ag.h +0 -53

59 lines not on this page · raw message

fs/xfs/xfs_mount.h +52 -0

58 lines not on this page · raw message

fs/xfs/xfs_symlink_remote.c +1 -0
index a318524..01c85e3 100644
@@ -21,6 +21,7 @@
 #include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
+#include "xfs_ag.h"
 #include "xfs_sb.h"
 #include "xfs_mount.h"
 #include "xfs_bmap_btree.h"
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 45/50] xfs: avoid CIL allocation during insert

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Now that we have the size of the log vector that has been allocated, we can determine if we need to allocate a new log vector for formatting and insertion. We only need to allocate a new vector if it won't fit into the existing buffer.

However, we need to hold the CIL context lock while we do this so that we can't race with a push draining the currently queued log vectors. It is safe to do this as long as we do GFP_NOFS allocation to avoid avoid memory allocation recursing into the filesystem. Hence we can safely overwrite the existing log vector on the CIL if it is large enough to hold all the dirty regions of the current item.

---
 fs/xfs/xfs_log_cil.c | 52 +++++++++++++++++++++++++++++++++-------------------
 fs/xfs/xfs_trans.h   |  1 -
 2 files changed, 33 insertions(+), 20 deletions(-)
fs/xfs/xfs_log_cil.c +33 -19
index 423ceaf..b20b157 100644
@@ -185,6 +185,22 @@ xlog_cil_prepare_log_vecs(
 		buf_size = sizeof(struct xfs_log_vec) + nbytes +
 				niovecs * sizeof(struct xfs_log_iovec);
 
+		/* compare to existing item size */
+		if (lip->li_lv && buf_size <= lip->li_lv->lv_size) {
+			/* same or smaller, optimise common overwrite case */
+			lv = lip->li_lv;
+			lv->lv_next = NULL;
+
+			if (ordered)
+				goto insert;
+
+			/* Ensure the lv is set up according to ->iop_size */
+			lv->lv_niovecs = niovecs;
+			lv->lv_buf = (char *)lv + buf_size - nbytes;
+			lv->lv_buf_len = xlog_cil_lv_item_format(lip, lv);
+			goto insert;
+		}
+
 		/* allocate new data chunk */
 		lv = kmem_zalloc(buf_size, KM_SLEEP|KM_NOFS);
 		lv->lv_item = lip;
@@ -204,8 +220,8 @@ xlog_cil_prepare_log_vecs(
 		lv->lv_buf = (char *)lv + buf_size - nbytes;
 
 		lv->lv_buf_len = xlog_cil_lv_item_format(lip, lv);
-		ASSERT(lv->lv_buf_len <= nbytes);
 insert:
+		ASSERT(lv->lv_buf_len <= nbytes);
 		if (!ret_lv)
 			ret_lv = lv;
 		else
@@ -230,7 +246,17 @@ xfs_cil_prepare_item(
 {
 	struct xfs_log_vec	*old = lv->lv_item->li_lv;
 
-	if (old) {
+	if (!old) {
+		/* new lv, must pin the log item */
+		ASSERT(!lv->lv_item->li_lv);
+
+		if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED) {
+			*len += lv->lv_buf_len;
+			*diff_iovecs += lv->lv_niovecs;
+		}
+		lv->lv_item->li_ops->iop_pin(lv->lv_item);
+
+	} else if (old != lv) {
 		/* existing lv on log item, space used is a delta */
 		ASSERT((old->lv_buf && old->lv_buf_len && old->lv_niovecs) ||
 			old->lv_buf_len == XFS_LOG_VEC_ORDERED);
@@ -249,15 +275,8 @@ xfs_cil_prepare_item(
 		*diff_iovecs += lv->lv_niovecs - old->lv_niovecs;
 		kmem_free(old);
 	} else {
-		/* new lv, must pin the log item */
-		ASSERT(!lv->lv_item->li_lv);
-
-		if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED) {
-			*len += lv->lv_buf_len;
-			*diff_iovecs += lv->lv_niovecs;
-		}
-		IOP_PIN(lv->lv_item);
-
+		/* re-used lv */
+		/* XXX: can't account for len/diff_iovecs yet */
 	}
 
 	/* attach new log vector to log item */
@@ -733,18 +752,13 @@ xfs_log_commit_cil(
 	if (flags & XFS_TRANS_RELEASE_LOG_RES)
 		log_flags = XFS_LOG_REL_PERM_RESERV;
 
-	/*
-	 * Do all the hard work of formatting items (including memory
-	 * allocation) outside the CIL context lock. This prevents stalling CIL
-	 * pushes when we are low on memory and a transaction commit spends a
-	 * lot of time in memory reclaim.
-	 */
+	/* lock out background commit */
+	down_read(&log->l_cilp->xc_ctx_lock);
+
 	log_vector = xlog_cil_prepare_log_vecs(tp);
 	if (!log_vector)
 		return ENOMEM;
 
-	/* lock out background commit */
-	down_read(&log->l_cilp->xc_ctx_lock);
 	if (commit_lsn)
 		*commit_lsn = log->l_cilp->xc_ctx->sequence;
 
fs/xfs/xfs_trans.h +0 -1
index 24bbdcd..4786170 100644
@@ -77,7 +77,6 @@ struct xfs_item_ops {
 	void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
 };
 
-#define IOP_PIN(ip)		(*(ip)->li_ops->iop_pin)(ip)
 #define IOP_UNPIN(ip, remove)	(*(ip)->li_ops->iop_unpin)(ip, remove)
 #define IOP_PUSH(ip, list)	(*(ip)->li_ops->iop_push)(ip, list)
 #define IOP_UNLOCK(ip)		(*(ip)->li_ops->iop_unlock)(ip)
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by
#38 lore raw

Re: [PATCH 45/50] xfs: avoid CIL allocation during insert

Quoted 15 lines · Dave Chinner

From: Dave Chinner<[email protected]>

Now that we have the size of the log vector that has been allocated, we can determine if we need to allocate a new log vector for formatting and insertion. We only need to allocate a new vector if it won't fit into the existing buffer.

However, we need to hold the CIL context lock while we do this so that we can't race with a push draining the currently queued log vectors. It is safe to do this as long as we do GFP_NOFS allocation to avoid avoid memory allocation recursing into the filesystem. Hence we can safely overwrite the existing log vector on the CIL if it is large enough to hold all the dirty regions of the current item.

Quoted 2 lines

---

Looks good.

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

#39 lore raw

***** SUSPECTED SPAM ***** [PATCH 21/50] xfs: create xfs_bmap_util.[ch]

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

There is a bunch of code in xfs_bmap.c that is kernel specific and not shared with userspace. To minimise the difference between the kernel and userspace code, shift this unshared code to xfs_bmap_util.c, and the declarations to xfs_bmap_util.h.

The biggest issue here is xfs_bmap_finish() - userspace has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to include xfs_bmap_util.h as well.

It also introduces and interesting dance for the stack switching code in xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved to xfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.

---
 fs/xfs/Makefile          |   1 +
 fs/xfs/xfs_aops.c        |   1 +
 fs/xfs/xfs_attr.c        |   1 +
 fs/xfs/xfs_attr_remote.c |   1 +
 fs/xfs/xfs_bmap.c        | 804 +--------------------------------------------
 fs/xfs/xfs_bmap.h        |  56 ----
 fs/xfs/xfs_bmap_util.c   | 834 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_bmap_util.h   |  96 ++++++
 fs/xfs/xfs_dfrag.c       |   1 +
 fs/xfs/xfs_dquot.c       |   1 +
 fs/xfs/xfs_filestream.c  |   5 +-
 fs/xfs/xfs_inode.c       |   1 +
 fs/xfs/xfs_ioctl.c       |   1 +
 fs/xfs/xfs_iomap.c       |   1 +
 fs/xfs/xfs_iops.c        |   1 +
 fs/xfs/xfs_rename.c      |   1 +
 fs/xfs/xfs_rtalloc.c     |   1 +
 fs/xfs/xfs_symlink.c     |   1 +
 fs/xfs/xfs_trans_resv.c  |   1 +
 fs/xfs/xfs_vnodeops.c    |   1 +
 20 files changed, 957 insertions(+), 853 deletions(-)
 create mode 100644 fs/xfs/xfs_bmap_util.c
 create mode 100644 fs/xfs/xfs_bmap_util.h
fs/xfs/Makefile +1 -0
index fb14461..dcd21b9 100644
@@ -30,6 +30,7 @@ xfs-y				+= xfs_aops.o \
 				   xfs_attr_inactive.o \
 				   xfs_attr_list.o \
 				   xfs_bit.o \
+				   xfs_bmap_util.o \
 				   xfs_buf.o \
 				   xfs_dfrag.o \
 				   xfs_dir2_readdir.o \
fs/xfs/xfs_aops.c +1 -0
index 7967086..709347d 100644
@@ -31,6 +31,7 @@
 #include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include <linux/aio.h>
 #include <linux/gfp.h>
 #include <linux/mpage.h>
fs/xfs/xfs_attr.c +1 -0
index 6ab77e3..91acc38 100644
@@ -33,6 +33,7 @@
 #include "xfs_alloc.h"
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_attr.h"
 #include "xfs_attr_leaf.h"
 #include "xfs_attr_remote.h"
fs/xfs/xfs_attr_remote.c +1 -0
index 39a59ea..13a0ed9 100644
@@ -34,6 +34,7 @@
 #include "xfs_alloc.h"
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_attr.h"
 #include "xfs_attr_leaf.h"
 #include "xfs_attr_remote.h"
fs/xfs/xfs_bmap.c +9 -795

892 lines not on this page · raw message

fs/xfs/xfs_bmap.h +0 -56

66 lines not on this page · raw message

fs/xfs/xfs_bmap_util.c new file +834 -0

834 lines not on this page · raw message

fs/xfs/xfs_bmap_util.h new file +96 -0

96 lines not on this page · raw message

fs/xfs/xfs_dfrag.c +1 -0
index e36445c..815dace 100644
@@ -31,6 +31,7 @@
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_itable.h"
 #include "xfs_dfrag.h"
 #include "xfs_error.h"
fs/xfs/xfs_dquot.c +1 -0
index 36e1cf3..e90e123 100644
@@ -29,6 +29,7 @@
 #include "xfs_bmap_btree.h"
 #include "xfs_inode.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_rtalloc.h"
 #include "xfs_error.h"
 #include "xfs_itable.h"
fs/xfs/xfs_filestream.c +3 -2
index 9eae097..d0e8890 100644
@@ -26,6 +26,7 @@
 #include "xfs_sb.h"
 #include "xfs_mount.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_alloc.h"
 #include "xfs_utils.h"
 #include "xfs_mru_cache.h"
@@ -668,8 +669,8 @@ exit:
  */
 int
 xfs_filestream_new_ag(
-	xfs_bmalloca_t	*ap,
-	xfs_agnumber_t	*agp)
+	struct xfs_bmalloca	*ap,
+	xfs_agnumber_t		*agp)
 {
 	int		flags, err;
 	xfs_inode_t	*ip, *pip = NULL;
fs/xfs/xfs_inode.c +1 -0
index fcda5b3..1029f56 100644
@@ -39,6 +39,7 @@
 #include "xfs_alloc.h"
 #include "xfs_ialloc.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_error.h"
 #include "xfs_utils.h"
 #include "xfs_quota.h"
fs/xfs/xfs_ioctl.c +1 -0
index 3124efa..7c27538 100644
@@ -33,6 +33,7 @@
 #include "xfs_error.h"
 #include "xfs_attr.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_buf_item.h"
 #include "xfs_utils.h"
 #include "xfs_dfrag.h"
fs/xfs/xfs_iomap.c +1 -0
index e4577f8..b04a60f 100644
@@ -33,6 +33,7 @@
 #include "xfs_inode_item.h"
 #include "xfs_btree.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_rtalloc.h"
 #include "xfs_error.h"
 #include "xfs_itable.h"
fs/xfs/xfs_iops.c +1 -0
index e441698..17b70f0 100644
@@ -30,6 +30,7 @@
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_rtalloc.h"
 #include "xfs_error.h"
 #include "xfs_itable.h"
fs/xfs/xfs_rename.c +1 -0
index 4715c7f..68cb725 100644
@@ -31,6 +31,7 @@
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_error.h"
 #include "xfs_quota.h"
 #include "xfs_utils.h"
fs/xfs/xfs_rtalloc.c +1 -0
index bb4f7a1..084caa8 100644
@@ -29,6 +29,7 @@
 #include "xfs_inode.h"
 #include "xfs_alloc.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_rtalloc.h"
 #include "xfs_fsops.h"
 #include "xfs_error.h"
fs/xfs/xfs_symlink.c +1 -0
index 18f24de..1ce2756 100644
@@ -35,6 +35,7 @@
 #include "xfs_ialloc.h"
 #include "xfs_alloc.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_error.h"
 #include "xfs_quota.h"
 #include "xfs_utils.h"
fs/xfs/xfs_trans_resv.c +1 -0
index 5a1537e..ed6446e 100644
@@ -37,6 +37,7 @@
 #include "xfs_alloc.h"
 #include "xfs_extent_busy.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_quota.h"
 #include "xfs_qm.h"
 #include "xfs_trans_space.h"
fs/xfs/xfs_vnodeops.c +1 -0
index 221e2e3..dc81a8d 100644
@@ -38,6 +38,7 @@
 #include "xfs_ialloc.h"
 #include "xfs_alloc.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_acl.h"
 #include "xfs_attr.h"
 #include "xfs_error.h"
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 28/50] xfs: don't special case shared superblock mounts

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check can be used as neither like it...

---
 fs/xfs/xfs_sb.h | 7 -------
 1 file changed, 7 deletions(-)
fs/xfs/xfs_sb.h +0 -7
index 91e163a..db7593f 100644
@@ -355,15 +355,8 @@ static inline int xfs_sb_good_version(xfs_sb_t *sbp)
 		     (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))
 			return 0;
 
-#ifdef __KERNEL__
 		if (sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN)
 			return 0;
-#else
-		if ((sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) &&
-		    sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN)
-			return 0;
-#endif
-
 		return 1;
 	}
 	if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 47/50] xfs: split the CIL lock

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The xc_cil_lock is used for two purposes - to protect the CIL itself, and to protect the push/commit state and lists. These are two logically separate structures and operations, so can have their own locks. This means that pushing on the CIL and the commit wait ordering won't contend for a lock with other transactions that are completing concurrently. As the CIL insertion is the hottest path throught eh CIL, this is a big win.

---
 fs/xfs/xfs_log_cil.c  | 41 +++++++++++++++++++++--------------------
 fs/xfs/xfs_log_priv.h |  9 ++++++---
 2 files changed, 27 insertions(+), 23 deletions(-)
fs/xfs/xfs_log_cil.c +21 -20
index c1a3384..cfe9797 100644
@@ -402,9 +402,9 @@ xlog_cil_committed(
 	xfs_extent_busy_clear(mp, &ctx->busy_extents,
 			     (mp->m_flags & XFS_MOUNT_DISCARD) && !abort);
 
-	spin_lock(&ctx->cil->xc_cil_lock);
+	spin_lock(&ctx->cil->xc_push_lock);
 	list_del(&ctx->committing);
-	spin_unlock(&ctx->cil->xc_cil_lock);
+	spin_unlock(&ctx->cil->xc_push_lock);
 
 	xlog_cil_free_logvec(ctx->lv_chain);
 
@@ -459,7 +459,7 @@ xlog_cil_push(
 	down_write(&cil->xc_ctx_lock);
 	ctx = cil->xc_ctx;
 
-	spin_lock(&cil->xc_cil_lock);
+	spin_lock(&cil->xc_push_lock);
 	push_seq = cil->xc_push_seq;
 	ASSERT(push_seq <= ctx->sequence);
 
@@ -470,10 +470,10 @@ xlog_cil_push(
 	 */
 	if (list_empty(&cil->xc_cil)) {
 		cil->xc_push_seq = 0;
-		spin_unlock(&cil->xc_cil_lock);
+		spin_unlock(&cil->xc_push_lock);
 		goto out_skip;
 	}
-	spin_unlock(&cil->xc_cil_lock);
+	spin_unlock(&cil->xc_push_lock);
 
 
 	/* check for a previously pushed seqeunce */
@@ -541,9 +541,9 @@ xlog_cil_push(
 	 * that higher sequences will wait for us to write out a commit record
 	 * before they do.
 	 */
-	spin_lock(&cil->xc_cil_lock);
+	spin_lock(&cil->xc_push_lock);
 	list_add(&ctx->committing, &cil->xc_committing);
-	spin_unlock(&cil->xc_cil_lock);
+	spin_unlock(&cil->xc_push_lock);
 	up_write(&cil->xc_ctx_lock);
 
 	/*
@@ -578,7 +578,7 @@ xlog_cil_push(
 	 * order the commit records so replay will get them in the right order.
 	 */
 restart:
-	spin_lock(&cil->xc_cil_lock);
+	spin_lock(&cil->xc_push_lock);
 	list_for_each_entry(new_ctx, &cil->xc_committing, committing) {
 		/*
 		 * Higher sequences will wait for this one so skip them.
@@ -591,11 +591,11 @@ restart:
 			 * It is still being pushed! Wait for the push to
 			 * complete, then start again from the beginning.
 			 */
-			xlog_wait(&cil->xc_commit_wait, &cil->xc_cil_lock);
+			xlog_wait(&cil->xc_commit_wait, &cil->xc_push_lock);
 			goto restart;
 		}
 	}
-	spin_unlock(&cil->xc_cil_lock);
+	spin_unlock(&cil->xc_push_lock);
 
 	/* xfs_log_done always frees the ticket on error. */
 	commit_lsn = xfs_log_done(log->l_mp, tic, &commit_iclog, 0);
@@ -614,10 +614,10 @@ restart:
 	 * callbacks to the iclog we can assign the commit LSN to the context
 	 * and wake up anyone who is waiting for the commit to complete.
 	 */
-	spin_lock(&cil->xc_cil_lock);
+	spin_lock(&cil->xc_push_lock);
 	ctx->commit_lsn = commit_lsn;
 	wake_up_all(&cil->xc_commit_wait);
-	spin_unlock(&cil->xc_cil_lock);
+	spin_unlock(&cil->xc_push_lock);
 
 	/* release the hounds! */
 	return xfs_log_release_iclog(log->l_mp, commit_iclog);
@@ -670,12 +670,12 @@ xlog_cil_push_background(
 	if (cil->xc_ctx->space_used < XLOG_CIL_SPACE_LIMIT(log))
 		return;
 
-	spin_lock(&cil->xc_cil_lock);
+	spin_lock(&cil->xc_push_lock);
 	if (cil->xc_push_seq < cil->xc_current_sequence) {
 		cil->xc_push_seq = cil->xc_current_sequence;
 		queue_work(log->l_mp->m_cil_workqueue, &cil->xc_push_work);
 	}
-	spin_unlock(&cil->xc_cil_lock);
+	spin_unlock(&cil->xc_push_lock);
 
 }
 
@@ -698,14 +698,14 @@ xlog_cil_push_foreground(
 	 * If the CIL is empty or we've already pushed the sequence then
 	 * there's no work we need to do.
 	 */
-	spin_lock(&cil->xc_cil_lock);
+	spin_lock(&cil->xc_push_lock);
 	if (list_empty(&cil->xc_cil) || push_seq <= cil->xc_push_seq) {
-		spin_unlock(&cil->xc_cil_lock);
+		spin_unlock(&cil->xc_push_lock);
 		return;
 	}
 
 	cil->xc_push_seq = push_seq;
-	spin_unlock(&cil->xc_cil_lock);
+	spin_unlock(&cil->xc_push_lock);
 
 	/* do the push now */
 	xlog_cil_push(log);
@@ -808,7 +808,7 @@ xlog_cil_force_lsn(
 	 * on commits for those as well.
 	 */
 restart:
-	spin_lock(&cil->xc_cil_lock);
+	spin_lock(&cil->xc_push_lock);
 	list_for_each_entry(ctx, &cil->xc_committing, committing) {
 		if (ctx->sequence > sequence)
 			continue;
@@ -817,7 +817,7 @@ restart:
 			 * It is still being pushed! Wait for the push to
 			 * complete, then start again from the beginning.
 			 */
-			xlog_wait(&cil->xc_commit_wait, &cil->xc_cil_lock);
+			xlog_wait(&cil->xc_commit_wait, &cil->xc_push_lock);
 			goto restart;
 		}
 		if (ctx->sequence != sequence)
@@ -825,7 +825,7 @@ restart:
 		/* found it! */
 		commit_lsn = ctx->commit_lsn;
 	}
-	spin_unlock(&cil->xc_cil_lock);
+	spin_unlock(&cil->xc_push_lock);
 	return commit_lsn;
 }
 
@@ -883,6 +883,7 @@ xlog_cil_init(
 	INIT_LIST_HEAD(&cil->xc_cil);
 	INIT_LIST_HEAD(&cil->xc_committing);
 	spin_lock_init(&cil->xc_cil_lock);
+	spin_lock_init(&cil->xc_push_lock);
 	init_rwsem(&cil->xc_ctx_lock);
 	init_waitqueue_head(&cil->xc_commit_wait);
 
fs/xfs/xfs_log_priv.h +6 -3
index edd0964..136654b 100644
@@ -278,14 +278,17 @@ struct xfs_cil {
 	struct xlog		*xc_log;
 	struct list_head	xc_cil;
 	spinlock_t		xc_cil_lock;
+
+	struct rw_semaphore	xc_ctx_lock ____cacheline_aligned_in_smp;
 	struct xfs_cil_ctx	*xc_ctx;
-	struct rw_semaphore	xc_ctx_lock;
+
+	spinlock_t		xc_push_lock ____cacheline_aligned_in_smp;
+	xfs_lsn_t		xc_push_seq;
 	struct list_head	xc_committing;
 	wait_queue_head_t	xc_commit_wait;
 	xfs_lsn_t		xc_current_sequence;
 	struct work_struct	xc_push_work;
-	xfs_lsn_t		xc_push_seq;
-};
+} ____cacheline_aligned_in_smp;
 
 /*
  * The amount of log space we allow the CIL to aggregate is difficult to size.
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 11/50] xfs: split out transaction reservation code

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The transaction reservation size calculations is used by both kernel and userspace, but most of the transaction code in xfs_trans.c is kernel specific. Split all the transaction reservation code out into it's own files to make sharing with userspace simpler. This just leaves kernel-only definitions in xfs_trans.h, so it doesn't need to be shared with userspace anymore, either.

---
 fs/xfs/Makefile         |   3 +-
 fs/xfs/xfs_acl.c        |   1 +
 fs/xfs/xfs_buf.c        |   1 +
 fs/xfs/xfs_discard.c    |   4 +-
 fs/xfs/xfs_mount.h      |  42 +--
 fs/xfs/xfs_quotaops.c   |   3 +-
 fs/xfs/xfs_trans.c      | 654 +-------------------------------------------
 fs/xfs/xfs_trans.h      |  77 +-----
 fs/xfs/xfs_trans_resv.c | 701 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_trans_resv.h | 137 ++++++++++
 10 files changed, 851 insertions(+), 772 deletions(-)
 create mode 100644 fs/xfs/xfs_trans_resv.c
 create mode 100644 fs/xfs/xfs_trans_resv.h
fs/xfs/Makefile +2 -1
index 4a45080..dc72b6b 100644
@@ -47,6 +47,7 @@ xfs-y				+= xfs_aops.o \
 				   xfs_mru_cache.o \
 				   xfs_rename.o \
 				   xfs_super.o \
+				   xfs_trans.o \
 				   xfs_utils.o \
 				   xfs_vnodeops.o \
 				   xfs_xattr.o \
@@ -76,7 +77,7 @@ xfs-y				+= xfs_alloc.o \
 				   xfs_log_recover.o \
 				   xfs_mount.o \
 				   xfs_symlink.o \
-				   xfs_trans.o
+				   xfs_trans_resv.o
 
 # low-level transaction/log code
 xfs-y				+= xfs_log.o \
fs/xfs/xfs_acl.c +1 -0
index 695606a..150c670 100644
@@ -17,6 +17,7 @@
  */
 #include "xfs.h"
 #include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
 #include "xfs_acl.h"
 #include "xfs_attr.h"
 #include "xfs_bmap_btree.h"
fs/xfs/xfs_buf.c +1 -0
index 1b2472a..c8136d0 100644
@@ -35,6 +35,7 @@
 #include <linux/freezer.h>
 
 #include "xfs_sb.h"
+#include "xfs_trans_resv.h"
 #include "xfs_log.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
fs/xfs/xfs_discard.c +2 -2
index 65831f9..45560ee 100644
@@ -17,12 +17,12 @@
  */
 #include "xfs.h"
 #include "xfs_format.h"
-#include "xfs_sb.h"
 #include "xfs_log.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
 #include "xfs_quota.h"
-#include "xfs_trans.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_ialloc_btree.h"
fs/xfs/xfs_mount.h +2 -40

54 lines not on this page · raw message

fs/xfs/xfs_quotaops.c +2 -1
index acf5071..446a2fc 100644
@@ -17,8 +17,9 @@
  */
 #include "xfs.h"
 #include "xfs_format.h"
-#include "xfs_sb.h"
+#include "xfs_trans_resv.h"
 #include "xfs_log.h"
+#include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
 #include "xfs_quota.h"
fs/xfs/xfs_trans.c +1 -653

666 lines not on this page · raw message

fs/xfs/xfs_trans.h +2 -75

88 lines not on this page · raw message

fs/xfs/xfs_trans_resv.c new file +701 -0

701 lines not on this page · raw message

fs/xfs/xfs_trans_resv.h new file +137 -0

137 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 36/50] xfs: Introduce tr_fsyncts to m_reservation

In reply to Dave Chinner

From: Jie Liu <[email protected]>

A preparation step.

For now fsync_ts transaction use the pre-calculated log reservation size of tr_swrite. This patch introduce a new item tr_fsyncts to mp->m_reservations structure so that we can fetch the log reservation value for it in a same manner to others.

---
 fs/xfs/xfs_trans_resv.c | 1 +
 fs/xfs/xfs_trans_resv.h | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_trans_resv.c +1 -0
index 3761481..e9211ad 100644
@@ -759,6 +759,7 @@ xfs_trans_resv_calc(
 	resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp);
 	resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp);
 	resp->tr_swrite.tr_logres = xfs_calc_swrite_reservation(mp);
+	resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp);
 	resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp);
 	resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp);
 	resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp);
fs/xfs/xfs_trans_resv.h +2 -1
index 0aac1fa..326f17d 100644
@@ -62,6 +62,7 @@ struct xfs_trans_resv {
 	struct xfs_trans_res	tr_qm_quotaoff;	/* turn quota off */
 	struct xfs_trans_res	tr_qm_equotaoff;/* end of turn quota off */
 	struct xfs_trans_res	tr_sb;		/* modify superblock */
+	struct xfs_trans_res	tr_fsyncts;	/* update timestamps on fsync */
 };
 
 /*
@@ -109,7 +110,7 @@ struct xfs_trans_resv {
  * Logging the inode timestamps on an fsync -- same as SWRITE
  * as long as SWRITE logs the entire inode core
  */
-#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_resv.tr_swrite.tr_logres)
+#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_resv.tr_fsyncts.tr_logres)
 #define XFS_WRITEID_LOG_RES(mp)	 ((mp)->m_resv.tr_swrite.tr_logres)
 #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_resv.tr_addafork.tr_logres)
 #define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_resv.tr_attrsetm.tr_logres)
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 44/50] xfs: Reduce allocations during CIL insertion

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Now that we have the size of the object before the formatting pass is called, we can allocation the log vector and it's buffer in a single allocation rather than two separate allocations.

Store the size of the allocated buffer in the log vector so that we potentially avoid allocation for future modifications of the object.

While touching this code, remove the IOP_FORMAT definition.

---
 fs/xfs/xfs_log.h     |  1 +
 fs/xfs/xfs_log_cil.c | 95 +++++++++++++++++++++++++++++++---------------------
 fs/xfs/xfs_trans.h   |  1 -
 3 files changed, 57 insertions(+), 40 deletions(-)
fs/xfs/xfs_log.h +1 -0
index e63d9e1..1c45848 100644
@@ -27,6 +27,7 @@ struct xfs_log_vec {
 	struct xfs_log_item	*lv_item;	/* owner */
 	char			*lv_buf;	/* formatted buffer */
 	int			lv_buf_len;	/* size of formatted buffer */
+	int			lv_size;	/* size of allocated lv */
 };
 
 #define XFS_LOG_VEC_ORDERED	(-1)
fs/xfs/xfs_log_cil.c +56 -39

143 lines not on this page · raw message

fs/xfs/xfs_trans.h +0 -1
index 97144ec..24bbdcd 100644
@@ -77,7 +77,6 @@ struct xfs_item_ops {
 	void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
 };
 
-#define IOP_FORMAT(ip,vp)	(*(ip)->li_ops->iop_format)(ip, vp)
 #define IOP_PIN(ip)		(*(ip)->li_ops->iop_pin)(ip)
 #define IOP_UNPIN(ip, remove)	(*(ip)->li_ops->iop_unpin)(ip, remove)
 #define IOP_PUSH(ip, list)	(*(ip)->li_ops->iop_push)(ip, list)
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by
#45 lore raw

Re: [PATCH 44/50] xfs: Reduce allocations during CIL insertion

Quoted 14 lines · Dave Chinner

From: Dave Chinner<[email protected]>

Now that we have the size of the object before the formatting pass is called, we can allocation the log vector and it's buffer in a single allocation rather than two separate allocations.

Store the size of the allocated buffer in the log vector so that we potentially avoid allocation for future modifications of the object.

While touching this code, remove the IOP_FORMAT definition.

---

...

Quoted 3 lines

/* Skip items which aren't dirty in this transaction. */

(quoted diff) +0 -0
@@ -150,48 +178,39 @@ xlog_cil_prepare_log_vecs(

...

fs/xfs/xfs_log_cil.c xlog_cil_prepare_log_vecs( · line 206

Quoted 1 line
fs/xfs/xfs_log_cil.c +1 -0
+		lv->lv_buf_len = xlog_cil_lv_item_format(lip, lv);

Looks good

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

#46 lore raw

***** SUSPECTED SPAM ***** [PATCH 48/50] xfs: Add read-only support for dirent filetype field

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Add support for the file type field in directory entries so that readdir can return the type of the inode the dirent points to to userspace without first having to read the inode off disk.

The encoding of the type field is a single byte that is added to the end of the directory entry name length. For all intents and purposes, it appends a "hidden" byte to the name field which contains the type information. As the directory entry is already of dynamic size, helpers are already required to access and decode the direct entry structures.

Hence the relevent extraction and iteration helpers are updated to understand the hidden byte. Helpers for reading and writing the filetype field from the directory entries are also added. Only the read helpers are used by this patch. It also adds all the code necessary to read the type information out of the dirents on disk.

Further we add the superblock feature bit and helpers to indicate that we understand the on-disk format change. This is not a compatible change - existing kernels cannot read the new format successfully - so an incompatible feature flag is added. We don't yet allow filesystems to mount with this flag yet - that will be added once write support is added.

Finally, the code to take the type from the VFS, convert it to an XFS on-disk type and put it into the xfs_name structures passed around is added, but the directory code does not use this field yet. That will be in the next patch.

---
 fs/xfs/xfs_da_btree.h     |   1 +
 fs/xfs/xfs_dir2.c         |   5 +-
 fs/xfs/xfs_dir2.h         |   4 +-
 fs/xfs/xfs_dir2_block.c   |  16 ++--
 fs/xfs/xfs_dir2_data.c    |  13 ++--
 fs/xfs/xfs_dir2_format.h  | 183 ++++++++++++++++++++++++++++++++++++++++------
 fs/xfs/xfs_dir2_leaf.c    |   6 +-
 fs/xfs/xfs_dir2_node.c    |   8 +-
 fs/xfs/xfs_dir2_priv.h    |   9 +++
 fs/xfs/xfs_dir2_readdir.c |  69 ++++++++++++++---
 fs/xfs/xfs_dir2_sf.c      | 121 +++++++++++++++++-------------
 fs/xfs/xfs_iops.c         |  27 ++++---
 fs/xfs/xfs_sb.h           |  22 ++++--
 fs/xfs/xfs_types.h        |   1 +
 14 files changed, 362 insertions(+), 123 deletions(-)
fs/xfs/xfs_da_btree.h +1 -0
index 6fb3371..8cdc77b 100644
@@ -176,6 +176,7 @@ enum xfs_dacmp {
 typedef struct xfs_da_args {
 	const __uint8_t	*name;		/* string (maybe not NULL terminated) */
 	int		namelen;	/* length of string (maybe no NULL) */
+	__uint8_t	filetype;	/* filetype of inode for directories */
 	__uint8_t	*value;		/* set of bytes (maybe contain NULLs) */
 	int		valuelen;	/* length of value */
 	int		flags;		/* argument flags (eg: ATTR_NOCREATE) */
fs/xfs/xfs_dir2.c +4 -1
index 841933c..f9825b1 100644
@@ -37,7 +37,8 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 
-struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2};
+struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR };
+
 
 /*
  * ASCII case-insensitive (ie. A-Z) support for directories that was
@@ -386,6 +387,7 @@ xfs_dir_replace(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.inumber = inum;
 	args.dp = dp;
@@ -433,6 +435,7 @@ xfs_dir_canenter(
 	memset(&args, 0, sizeof(xfs_da_args_t));
 	args.name = name->name;
 	args.namelen = name->len;
+	args.filetype = name->type;
 	args.hashval = dp->i_mount->m_dirnameops->hashname(name);
 	args.dp = dp;
 	args.whichfork = XFS_DATA_FORK;
fs/xfs/xfs_dir2.h +2 -2
index 7fe2b8f..768ddad 100644
@@ -68,8 +68,8 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
 extern xfs_ino_t xfs_dir2_sf_get_parent_ino(struct xfs_dir2_sf_hdr *sfp);
 extern void xfs_dir2_sf_put_parent_ino(struct xfs_dir2_sf_hdr *sfp,
 		xfs_ino_t ino);
-extern xfs_ino_t xfs_dir2_sfe_get_ino(struct xfs_dir2_sf_hdr *sfp,
-		struct xfs_dir2_sf_entry *sfep);
+extern xfs_ino_t xfs_dir3_sfe_get_ino(struct xfs_mount *mp,
+		struct xfs_dir2_sf_hdr *sfp, struct xfs_dir2_sf_entry *sfep);
 extern void xfs_dir2_sfe_put_ino( struct xfs_dir2_sf_hdr *,
 		struct xfs_dir2_sf_entry *sfep, xfs_ino_t ino);
 
fs/xfs/xfs_dir2_block.c +8 -8
index becd69f..1cd2f56 100644
@@ -369,7 +369,7 @@ xfs_dir2_block_addname(
 	if (error)
 		return error;
 
-	len = xfs_dir2_data_entsize(args->namelen);
+	len = xfs_dir3_data_entsize(mp, args->namelen);
 
 	/*
 	 * Set up pointers to parts of the block.
@@ -549,7 +549,7 @@ xfs_dir2_block_addname(
 	dep->inumber = cpu_to_be64(args->inumber);
 	dep->namelen = args->namelen;
 	memcpy(dep->name, args->name, args->namelen);
-	tagp = xfs_dir2_data_entry_tag_p(dep);
+	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	/*
 	 * Clean up the bestfree array and log the header, tail, and entry.
@@ -799,7 +799,7 @@ xfs_dir2_block_removename(
 	needlog = needscan = 0;
 	xfs_dir2_data_make_free(tp, bp,
 		(xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
-		xfs_dir2_data_entsize(dep->namelen), &needlog, &needscan);
+		xfs_dir3_data_entsize(mp, dep->namelen), &needlog, &needscan);
 	/*
 	 * Fix up the block tail.
 	 */
@@ -1159,7 +1159,7 @@ xfs_dir2_sf_to_block(
 	dep->inumber = cpu_to_be64(dp->i_ino);
 	dep->namelen = 1;
 	dep->name[0] = '.';
-	tagp = xfs_dir2_data_entry_tag_p(dep);
+	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	xfs_dir2_data_log_entry(tp, bp, dep);
 	blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
@@ -1172,7 +1172,7 @@ xfs_dir2_sf_to_block(
 	dep->inumber = cpu_to_be64(xfs_dir2_sf_get_parent_ino(sfp));
 	dep->namelen = 2;
 	dep->name[0] = dep->name[1] = '.';
-	tagp = xfs_dir2_data_entry_tag_p(dep);
+	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	xfs_dir2_data_log_entry(tp, bp, dep);
 	blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
@@ -1217,10 +1217,10 @@ xfs_dir2_sf_to_block(
 		 * Copy a real entry.
 		 */
 		dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset);
-		dep->inumber = cpu_to_be64(xfs_dir2_sfe_get_ino(sfp, sfep));
+		dep->inumber = cpu_to_be64(xfs_dir3_sfe_get_ino(mp, sfp, sfep));
 		dep->namelen = sfep->namelen;
 		memcpy(dep->name, sfep->name, dep->namelen);
-		tagp = xfs_dir2_data_entry_tag_p(dep);
+		tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 		*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 		xfs_dir2_data_log_entry(tp, bp, dep);
 		name.name = sfep->name;
@@ -1233,7 +1233,7 @@ xfs_dir2_sf_to_block(
 		if (++i == sfp->count)
 			sfep = NULL;
 		else
-			sfep = xfs_dir2_sf_nextentry(sfp, sfep);
+			sfep = xfs_dir3_sf_nextentry(mp, sfp, sfep);
 	}
 	/* Done with the temporary buffer */
 	kmem_free(sfp);
fs/xfs/xfs_dir2_data.c +7 -6
index 98c23fa..1b59e43 100644
@@ -147,7 +147,7 @@ __xfs_dir3_data_check(
 		XFS_WANT_CORRUPTED_RETURN(
 			!xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)));
 		XFS_WANT_CORRUPTED_RETURN(
-			be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep)) ==
+			be16_to_cpu(*xfs_dir3_data_entry_tag_p(mp, dep)) ==
 					       (char *)dep - (char *)hdr);
 		count++;
 		lastfree = 0;
@@ -166,7 +166,7 @@ __xfs_dir3_data_check(
 			}
 			XFS_WANT_CORRUPTED_RETURN(i < be32_to_cpu(btp->count));
 		}
-		p += xfs_dir2_data_entsize(dep->namelen);
+		p += xfs_dir3_data_entsize(mp, dep->namelen);
 	}
 	/*
 	 * Need to have seen all the entries and all the bestfree slots.
@@ -536,8 +536,8 @@ xfs_dir2_data_freescan(
 		else {
 			dep = (xfs_dir2_data_entry_t *)p;
 			ASSERT((char *)dep - (char *)hdr ==
-			       be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep)));
-			p += xfs_dir2_data_entsize(dep->namelen);
+			       be16_to_cpu(*xfs_dir3_data_entry_tag_p(mp, dep)));
+			p += xfs_dir3_data_entsize(mp, dep->namelen);
 		}
 	}
 }
@@ -627,7 +627,8 @@ xfs_dir2_data_log_entry(
 	struct xfs_buf		*bp,
 	xfs_dir2_data_entry_t	*dep)		/* data entry pointer */
 {
-	xfs_dir2_data_hdr_t	*hdr = bp->b_addr;
+	struct xfs_dir2_data_hdr *hdr = bp->b_addr;
+	struct xfs_mount	*mp = tp->t_mountp;
 
 	ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
 	       hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -635,7 +636,7 @@ xfs_dir2_data_log_entry(
 	       hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
 
 	xfs_trans_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr),
-		(uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) -
+		(uint)((char *)(xfs_dir3_data_entry_tag_p(mp, dep) + 1) -
 		       (char *)hdr - 1));
 }
 
fs/xfs/xfs_dir2_format.h +160 -23

260 lines not on this page · raw message

fs/xfs/xfs_dir2_leaf.c +3 -3
index 591eaf2..887b1bd 100644
@@ -696,7 +696,7 @@ xfs_dir2_leaf_addname(
 	ents = xfs_dir3_leaf_ents_p(leaf);
 	xfs_dir3_leaf_hdr_from_disk(&leafhdr, leaf);
 	bestsp = xfs_dir2_leaf_bests_p(ltp);
-	length = xfs_dir2_data_entsize(args->namelen);
+	length = xfs_dir3_data_entsize(mp, args->namelen);
 
 	/*
 	 * See if there are any entries with the same hash value
@@ -897,7 +897,7 @@ xfs_dir2_leaf_addname(
 	dep->inumber = cpu_to_be64(args->inumber);
 	dep->namelen = args->namelen;
 	memcpy(dep->name, args->name, dep->namelen);
-	tagp = xfs_dir2_data_entry_tag_p(dep);
+	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	/*
 	 * Need to scan fix up the bestfree table.
@@ -1427,7 +1427,7 @@ xfs_dir2_leaf_removename(
 	 */
 	xfs_dir2_data_make_free(tp, dbp,
 		(xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
-		xfs_dir2_data_entsize(dep->namelen), &needlog, &needscan);
+		xfs_dir3_data_entsize(mp, dep->namelen), &needlog, &needscan);
 	/*
 	 * We just mark the leaf entry stale by putting a null in it.
 	 */
fs/xfs/xfs_dir2_node.c +4 -4
index 18e287d..49f1e9e 100644
@@ -605,7 +605,7 @@ xfs_dir2_leafn_lookup_for_addname(
 		ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
 		       free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
 	}
-	length = xfs_dir2_data_entsize(args->namelen);
+	length = xfs_dir3_data_entsize(mp, args->namelen);
 	/*
 	 * Loop over leaf entries with the right hash value.
 	 */
@@ -1259,7 +1259,7 @@ xfs_dir2_leafn_remove(
 	longest = be16_to_cpu(bf[0].length);
 	needlog = needscan = 0;
 	xfs_dir2_data_make_free(tp, dbp, off,
-		xfs_dir2_data_entsize(dep->namelen), &needlog, &needscan);
+		xfs_dir3_data_entsize(mp, dep->namelen), &needlog, &needscan);
 	/*
 	 * Rescan the data block freespaces for bestfree.
 	 * Log the data block header if needed.
@@ -1711,7 +1711,7 @@ xfs_dir2_node_addname_int(
 	dp = args->dp;
 	mp = dp->i_mount;
 	tp = args->trans;
-	length = xfs_dir2_data_entsize(args->namelen);
+	length = xfs_dir3_data_entsize(mp, args->namelen);
 	/*
 	 * If we came in with a freespace block that means that lookup
 	 * found an entry with our hash value.  This is the freespace
@@ -2007,7 +2007,7 @@ xfs_dir2_node_addname_int(
 	dep->inumber = cpu_to_be64(args->inumber);
 	dep->namelen = args->namelen;
 	memcpy(dep->name, args->name, dep->namelen);
-	tagp = xfs_dir2_data_entry_tag_p(dep);
+	tagp = xfs_dir3_data_entry_tag_p(mp, dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)hdr);
 	xfs_dir2_data_log_entry(tp, dbp, dep);
 	/*
fs/xfs/xfs_dir2_priv.h +9 -0
index 6d2a99c2..1bad84c 100644
@@ -18,6 +18,8 @@
 #ifndef __XFS_DIR2_PRIV_H__
 #define __XFS_DIR2_PRIV_H__
 
+struct dir_context;
+
 /* xfs_dir2.c */
 extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
 extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
@@ -25,6 +27,13 @@ extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
 extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
 				const unsigned char *name, int len);
 
+#define S_SHIFT 12
+extern const unsigned char xfs_mode_to_ftype[];
+
+extern unsigned char xfs_dir3_get_dtype(struct xfs_mount *mp,
+					__uint8_t filetype);
+
+
 /* xfs_dir2_block.c */
 extern int xfs_dir3_block_read(struct xfs_trans *tp, struct xfs_inode *dp,
 			       struct xfs_buf **bpp);
fs/xfs/xfs_dir2_readdir.c +59 -10

133 lines not on this page · raw message

fs/xfs/xfs_dir2_sf.c +72 -49

312 lines not on this page · raw message

fs/xfs/xfs_iops.c +16 -11
index 82c5a5d..b250495 100644
@@ -40,6 +40,9 @@
 #include "xfs_trace.h"
 #include "xfs_icache.h"
 #include "xfs_symlink.h"
+#include "xfs_da_btree.h"
+#include "xfs_dir2_format.h"
+#include "xfs_dir2_priv.h"
 
 #include <linux/capability.h>
 #include <linux/xattr.h>
@@ -88,10 +91,12 @@ xfs_init_security(
 static void
 xfs_dentry_to_name(
 	struct xfs_name	*namep,
-	struct dentry	*dentry)
+	struct dentry	*dentry,
+	int		mode)
 {
 	namep->name = dentry->d_name.name;
 	namep->len = dentry->d_name.len;
+	namep->type = xfs_mode_to_ftype[(mode & S_IFMT) >> S_SHIFT];
 }
 
 STATIC void
@@ -107,7 +112,7 @@ xfs_cleanup_inode(
 	 * xfs_init_security we must back out.
 	 * ENOSPC can hit here, among other things.
 	 */
-	xfs_dentry_to_name(&teardown, dentry);
+	xfs_dentry_to_name(&teardown, dentry, 0);
 
 	xfs_remove(XFS_I(dir), &teardown, XFS_I(inode));
 	iput(inode);
@@ -147,7 +152,7 @@ xfs_vn_mknod(
 			mode &= ~current_umask();
 	}
 
-	xfs_dentry_to_name(&name, dentry);
+	xfs_dentry_to_name(&name, dentry, mode);
 	error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip);
 	if (unlikely(error))
 		goto out_free_acl;
@@ -208,7 +213,7 @@ xfs_vn_lookup(
 	if (dentry->d_name.len >= MAXNAMELEN)
 		return ERR_PTR(-ENAMETOOLONG);
 
-	xfs_dentry_to_name(&name, dentry);
+	xfs_dentry_to_name(&name, dentry, 0);
 	error = xfs_lookup(XFS_I(dir), &name, &cip, NULL);
 	if (unlikely(error)) {
 		if (unlikely(error != ENOENT))
@@ -235,7 +240,7 @@ xfs_vn_ci_lookup(
 	if (dentry->d_name.len >= MAXNAMELEN)
 		return ERR_PTR(-ENAMETOOLONG);
 
-	xfs_dentry_to_name(&xname, dentry);
+	xfs_dentry_to_name(&xname, dentry, 0);
 	error = xfs_lookup(XFS_I(dir), &xname, &ip, &ci_name);
 	if (unlikely(error)) {
 		if (unlikely(error != ENOENT))
@@ -270,7 +275,7 @@ xfs_vn_link(
 	struct xfs_name	name;
 	int		error;
 
-	xfs_dentry_to_name(&name, dentry);
+	xfs_dentry_to_name(&name, dentry, inode->i_mode);
 
 	error = xfs_link(XFS_I(dir), XFS_I(inode), &name);
 	if (unlikely(error))
@@ -289,7 +294,7 @@ xfs_vn_unlink(
 	struct xfs_name	name;
 	int		error;
 
-	xfs_dentry_to_name(&name, dentry);
+	xfs_dentry_to_name(&name, dentry, 0);
 
 	error = -xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode));
 	if (error)
@@ -319,7 +324,7 @@ xfs_vn_symlink(
 
 	mode = S_IFLNK |
 		(irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO);
-	xfs_dentry_to_name(&name, dentry);
+	xfs_dentry_to_name(&name, dentry, mode);
 
 	error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip);
 	if (unlikely(error))
@@ -351,12 +356,12 @@ xfs_vn_rename(
 	struct xfs_name	oname;
 	struct xfs_name	nname;
 
-	xfs_dentry_to_name(&oname, odentry);
-	xfs_dentry_to_name(&nname, ndentry);
+	xfs_dentry_to_name(&oname, odentry, 0);
+	xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode);
 
 	return -xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
 			   XFS_I(ndir), &nname, new_inode ?
-			   			XFS_I(new_inode) : NULL);
+						XFS_I(new_inode) : NULL);
 }
 
 /*
fs/xfs/xfs_sb.h +16 -6
index db7593f..3c297a4 100644
@@ -555,12 +555,6 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp)
 	sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT;
 }
 
-static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp)
-{
-	return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
-}
-
-
 /*
  * Extended v5 superblock feature masks. These are to be used for new v5
  * superblock features only.
@@ -599,7 +593,9 @@ xfs_sb_has_ro_compat_feature(
 	return (sbp->sb_features_ro_compat & feature) != 0;
 }
 
+#define XFS_SB_FEAT_INCOMPAT_FTYPE	(1 << 0)	/* filetype in dirent */
 #define XFS_SB_FEAT_INCOMPAT_ALL 0
+
 #define XFS_SB_FEAT_INCOMPAT_UNKNOWN	~XFS_SB_FEAT_INCOMPAT_ALL
 static inline bool
 xfs_sb_has_incompat_feature(
@@ -619,11 +615,25 @@ xfs_sb_has_incompat_log_feature(
 	return (sbp->sb_features_log_incompat & feature) != 0;
 }
 
+/*
+ * V5 superblock specific feature checks
+ */
+static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp)
+{
+	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);
+}
+
 /*
  * end of superblock version macros
  */
fs/xfs/xfs_types.h +1 -0
index ce44b18..82bbc34 100644
@@ -140,6 +140,7 @@ typedef enum {
 struct xfs_name {
 	const unsigned char	*name;
 	int			len;
+	int			type;
 };
 
 /*
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 31/50] xfs: remove __KERNEL__ check from xfs_dir2_leaf.c

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....

---
 fs/xfs/xfs_dir2_leaf.c | 4 ----
 1 file changed, 4 deletions(-)
fs/xfs/xfs_dir2_leaf.c +0 -4
index 5505edb..591eaf2 100644
@@ -1586,10 +1586,6 @@ xfs_dir2_leaf_search_hash(
 	ents = xfs_dir3_leaf_ents_p(leaf);
 	xfs_dir3_leaf_hdr_from_disk(&leafhdr, leaf);
 
-#ifndef __KERNEL__
-	if (!leafhdr.count)
-		return 0;
-#endif
 	/*
 	 * Note, the table cannot be empty, so we have to go through the loop.
 	 * Binary search the leaf entries looking for our hash value.
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 37/50] xfs: Make writeid transaction use tr_writeid

In reply to Dave Chinner

From: Jie Liu <[email protected]>

tr_writeid is defined at mp->m_resv structure, however, it does not really being used when it should be..

This patch changes it to tr_writeid to fetch the correct log reservation size.

---
 fs/xfs/xfs_trans_resv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans_resv.h +1 -1
index 326f17d..b8d5666 100644
@@ -111,7 +111,7 @@ struct xfs_trans_resv {
  * as long as SWRITE logs the entire inode core
  */
 #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_resv.tr_fsyncts.tr_logres)
-#define XFS_WRITEID_LOG_RES(mp)	 ((mp)->m_resv.tr_swrite.tr_logres)
+#define XFS_WRITEID_LOG_RES(mp)	 ((mp)->m_resv.tr_writeid.tr_logres)
 #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_resv.tr_addafork.tr_logres)
 #define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_resv.tr_attrsetm.tr_logres)
 #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_resv.tr_attrinval.tr_logres)
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 40/50] xfs: Refactor xfs_ticket_alloc() to extract a new helper

In reply to Dave Chinner

From: Jie Liu <[email protected]>

Refactor xlog_ticket_alloc() to extract a new helper, i.e. xfs_log_calc_unit_res().

This helper would be used to calculate the total log reservation size by adding extra log operation/transation headers for a new log ticket.

---
 fs/xfs/xfs_log.c        | 60 +++++++++++++++++++++++++++++++------------------
 fs/xfs/xfs_log_format.h |  4 ++++
 2 files changed, 42 insertions(+), 22 deletions(-)
fs/xfs/xfs_log.c +38 -22
index bf89eb9..704f095 100644
@@ -3391,24 +3391,17 @@ xfs_log_ticket_get(
 }
 
 /*
- * Allocate and initialise a new log ticket.
+ * Figure out the total log space unit (in bytes) that would be
+ * required for a log ticket.
  */
-struct xlog_ticket *
-xlog_ticket_alloc(
-	struct xlog	*log,
-	int		unit_bytes,
-	int		cnt,
-	char		client,
-	bool		permanent,
-	xfs_km_flags_t	alloc_flags)
+int
+xfs_log_calc_unit_res(
+	struct xfs_mount	*mp,
+	int			unit_bytes)
 {
-	struct xlog_ticket *tic;
-	uint		num_headers;
-	int		iclog_space;
-
-	tic = kmem_zone_zalloc(xfs_log_ticket_zone, alloc_flags);
-	if (!tic)
-		return NULL;
+	struct xlog		*log = mp->m_log;
+	int			iclog_space;
+	uint			num_headers;
 
 	/*
 	 * Permanent reservations have up to 'cnt'-1 active log operations
@@ -3483,20 +3476,43 @@ xlog_ticket_alloc(
 	unit_bytes += log->l_iclog_hsize;
 
 	/* for roundoff padding for transaction data and one for commit record */
-	if (xfs_sb_version_haslogv2(&log->l_mp->m_sb) &&
-	    log->l_mp->m_sb.sb_logsunit > 1) {
+	if (xfs_sb_version_haslogv2(&mp->m_sb) && mp->m_sb.sb_logsunit > 1) {
 		/* log su roundoff */
-		unit_bytes += 2*log->l_mp->m_sb.sb_logsunit;
+		unit_bytes += 2 * mp->m_sb.sb_logsunit;
 	} else {
 		/* BB roundoff */
-		unit_bytes += 2*BBSIZE;
+		unit_bytes += 2 * BBSIZE;
         }
 
+	return unit_bytes;
+}
+
+/*
+ * Allocate and initialise a new log ticket.
+ */
+struct xlog_ticket *
+xlog_ticket_alloc(
+	struct xlog		*log,
+	int			unit_bytes,
+	int			cnt,
+	char			client,
+	bool			permanent,
+	xfs_km_flags_t		alloc_flags)
+{
+	struct xlog_ticket	*tic;
+	int			unit_res;
+
+	tic = kmem_zone_zalloc(xfs_log_ticket_zone, alloc_flags);
+	if (!tic)
+		return NULL;
+
+	unit_res = xfs_log_calc_unit_res(log->l_mp, unit_bytes);
+
 	atomic_set(&tic->t_ref, 1);
 	tic->t_task		= current;
 	INIT_LIST_HEAD(&tic->t_queue);
-	tic->t_unit_res		= unit_bytes;
-	tic->t_curr_res		= unit_bytes;
+	tic->t_unit_res		= unit_res;
+	tic->t_curr_res		= unit_res;
 	tic->t_cnt		= cnt;
 	tic->t_ocnt		= cnt;
 	tic->t_tid		= prandom_u32();
fs/xfs/xfs_log_format.h +4 -0
index 198381e..cc08f59 100644
@@ -18,6 +18,8 @@
 #ifndef	__XFS_LOG_FORMAT_H__
 #define __XFS_LOG_FORMAT_H__
 
+struct xfs_mount;
+
 /*
  * On-disk Log Format definitions.
  *
@@ -834,4 +836,6 @@ struct xfs_icreate_log {
 	__be32		icl_gen;	/* inode generation number to use */
 };
 
+int	xfs_log_calc_unit_res(struct xfs_mount *mp, int unit_bytes);
+
 #endif /* __XFS_LOG_FORMAT_H__ */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 41/50] xfs: Add xfs_log_rlimit.c

In reply to Dave Chinner

From: Jie Liu <[email protected]>

Add source files for xfs_log_rlimit.c The new file is used for log size calculations and validation shared with userspace.

[dchinner: xfs_log_calc_max_attrsetm_res() does not modify the tr_attrsetm reservation, just calculates the maximum. ]

[dchinner: rework loop in xfs_log_get_max_trans_res() ]

---
 fs/xfs/Makefile         |   1 +
 fs/xfs/xfs_log_format.h |   7 ++-
 fs/xfs/xfs_log_rlimit.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 fs/xfs/xfs_log_rlimit.c
fs/xfs/Makefile +1 -0
index d6ccf57..0719e4d 100644
@@ -79,6 +79,7 @@ xfs-y				+= xfs_alloc.o \
 				   xfs_inode_fork.o \
 				   xfs_inode_buf.o \
 				   xfs_log_recover.o \
+				   xfs_log_rlimit.o \
 				   xfs_sb.o \
 				   xfs_symlink_remote.o \
 				   xfs_trans_resv.o
fs/xfs/xfs_log_format.h +6 -1
index cc08f59..a49ab2c 100644
@@ -19,6 +19,7 @@
 #define __XFS_LOG_FORMAT_H__
 
 struct xfs_mount;
+struct xfs_trans_res;
 
 /*
  * On-disk Log Format definitions.
@@ -51,6 +52,9 @@ typedef __uint32_t xlog_tid_t;
 
 #define XLOG_HEADER_SIZE	512
 
+/* Minimum number of transactions that must fit in the log (defined by mkfs) */
+#define XFS_MIN_LOG_FACTOR	3
+
 #define XLOG_REC_SHIFT(log) \
 	BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
 	 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
@@ -135,7 +139,6 @@ typedef struct xlog_op_header {
 	__u16	   oh_res2;	/* 32 bit align			:  2 b */
 } xlog_op_header_t;
 
-
 /* valid values for h_fmt */
 #define XLOG_FMT_UNKNOWN  0
 #define XLOG_FMT_LINUX_LE 1
@@ -837,5 +840,7 @@ struct xfs_icreate_log {
 };
 
 int	xfs_log_calc_unit_res(struct xfs_mount *mp, int unit_bytes);
+int	xfs_log_calc_minimum_size(struct xfs_mount *);
+
 
 #endif /* __XFS_LOG_FORMAT_H__ */
fs/xfs/xfs_log_rlimit.c new file +145 -0

145 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 20/50] xfs: introduce xfs_sb.c for sharing with libxfs

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

xfs_mount.c is shared with userspace, but the only functions that are shared are to do with physical superblock manipulations. This means that less than 25% of the xfs_mount.c code is actually shared with userspace. Move all the superblock functions to xfs_sb.c and share that instead with libxfs.

Note that this will leave all the in-core transaction related superblock counter modifications in xfs_mount.c as none of that is shared with userspace. With a few more small changes, xfs_mount.h won't need to be shared with userspace anymore, either.

---
 fs/xfs/Makefile    |   3 +-
 fs/xfs/xfs_mount.c | 784 +------------------------------------------------
 fs/xfs/xfs_mount.h |  19 +-
 fs/xfs/xfs_sb.c    | 834 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_sb.h    |  20 ++
 5 files changed, 863 insertions(+), 797 deletions(-)
 create mode 100644 fs/xfs/xfs_sb.c
fs/xfs/Makefile +2 -1
index 20b1d94..fb14461 100644
@@ -47,6 +47,7 @@ xfs-y				+= xfs_aops.o \
 				   xfs_iops.o \
 				   xfs_itable.o \
 				   xfs_message.o \
+				   xfs_mount.o \
 				   xfs_mru_cache.o \
 				   xfs_rename.o \
 				   xfs_super.o \
@@ -81,7 +82,7 @@ xfs-y				+= xfs_alloc.o \
 				   xfs_inode_fork.o \
 				   xfs_inode_buf.o \
 				   xfs_log_recover.o \
-				   xfs_mount.o \
+				   xfs_sb.o \
 				   xfs_symlink_remote.o \
 				   xfs_trans_resv.o
 
fs/xfs/xfs_mount.c +5 -779

839 lines not on this page · raw message

fs/xfs/xfs_mount.h +2 -17
index 27d0d5c..5488df1 100644
@@ -292,14 +292,6 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
 }
 
 /*
- * perag get/put wrappers for ref counting
- */
-struct xfs_perag *xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno);
-struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *mp, xfs_agnumber_t agno,
-					int tag);
-void	xfs_perag_put(struct xfs_perag *pag);
-
-/*
  * Per-cpu superblock locking functions
  */
 #ifdef HAVE_PERCPU_SB
@@ -331,6 +323,8 @@ typedef struct xfs_mod_sb {
 extern int	xfs_log_sbcount(xfs_mount_t *);
 extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);
 extern int	xfs_mountfs(xfs_mount_t *mp);
+extern int	xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount,
+				     xfs_agnumber_t *maxagi);
 
 extern void	xfs_unmountfs(xfs_mount_t *);
 extern int	xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, int);
@@ -349,13 +343,4 @@ extern void	xfs_set_low_space_thresholds(struct xfs_mount *);
 
 #endif	/* __KERNEL__ */
 
-extern void	xfs_sb_calc_crc(struct xfs_buf	*);
-extern void	xfs_mod_sb(struct xfs_trans *, __int64_t);
-extern int	xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t,
-					xfs_agnumber_t *);
-extern void	xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
-extern void	xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
-
-extern const struct xfs_buf_ops xfs_sb_buf_ops;
-
 #endif	/* __XFS_MOUNT_H__ */
fs/xfs/xfs_sb.c new file +834 -0

834 lines not on this page · raw message

fs/xfs/xfs_sb.h +20 -0
index 40b003e..91e163a 100644
@@ -26,6 +26,7 @@
 
 struct xfs_buf;
 struct xfs_mount;
+struct xfs_trans;
 
 #define	XFS_SB_MAGIC		0x58465342	/* 'XFSB' */
 #define	XFS_SB_VERSION_1	1		/* 5.3, 6.0.1, 6.1 */
@@ -674,4 +675,23 @@ xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
 #define XFS_B_TO_FSBT(mp,b)	(((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)
 #define XFS_B_FSB_OFFSET(mp,b)	((b) & (mp)->m_blockmask)
 
+/*
+ * perag get/put wrappers for ref counting
+ */
+extern struct xfs_perag *xfs_perag_get(struct xfs_mount *, xfs_agnumber_t);
+extern struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *, xfs_agnumber_t,
+					   int tag);
+extern void	xfs_perag_put(struct xfs_perag *pag);
+extern int	xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t);
+
+extern void	xfs_sb_calc_crc(struct xfs_buf	*);
+extern void	xfs_mod_sb(struct xfs_trans *, __int64_t);
+extern void	xfs_sb_mount_common(struct xfs_mount *, struct xfs_sb *);
+extern void	xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
+extern void	xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
+extern void	xfs_sb_quota_from_disk(struct xfs_sb *sbp);
+
+extern const struct xfs_buf_ops xfs_sb_buf_ops;
+extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;
+
 #endif	/* __XFS_SB_H__ */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 14/50] xfs: introduce xfs_inode_buf.c for inode buffer operations

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.

---
 fs/xfs/Makefile        |   1 +
 fs/xfs/xfs_inode.c     | 420 ---------------------------------------------
 fs/xfs/xfs_inode.h     |  41 +----
 fs/xfs/xfs_inode_buf.c | 453 +++++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_inode_buf.h |  53 ++++++
 5 files changed, 514 insertions(+), 454 deletions(-)
 create mode 100644 fs/xfs/xfs_inode_buf.c
 create mode 100644 fs/xfs/xfs_inode_buf.h
fs/xfs/Makefile +1 -0
index ce0b87e..7f2319d 100644
@@ -75,6 +75,7 @@ xfs-y				+= xfs_alloc.o \
 				   xfs_icreate_item.o \
 				   xfs_inode.o \
 				   xfs_inode_fork.o \
+				   xfs_inode_buf.o \
 				   xfs_log_recover.o \
 				   xfs_mount.o \
 				   xfs_symlink.o \
fs/xfs/xfs_inode.c +0 -420

432 lines not on this page · raw message

fs/xfs/xfs_inode.h +7 -34

65 lines not on this page · raw message

fs/xfs/xfs_inode_buf.c new file +453 -0

453 lines not on this page · raw message

fs/xfs/xfs_inode_buf.h new file +53 -0

53 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 33/50] xfs: move kernel specific type definitions to xfs.h

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

xfs_types.h is shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines to xfs_linux.h so we can remove the __KERNEL__ guards from xfs_types.h.

---
 fs/xfs/xfs_linux.h | 32 ++++++++++++++++++++++++++++++++
 fs/xfs/xfs_types.h | 36 ------------------------------------
 2 files changed, 32 insertions(+), 36 deletions(-)
fs/xfs/xfs_linux.h +32 -0
index 800f896..3bc52b7 100644
@@ -32,6 +32,38 @@
 # define XFS_BIG_INUMS	0
 #endif
 
+/*
+ * Kernel specific type declarations for XFS
+ */
+typedef signed char		__int8_t;
+typedef unsigned char		__uint8_t;
+typedef signed short int	__int16_t;
+typedef unsigned short int	__uint16_t;
+typedef signed int		__int32_t;
+typedef unsigned int		__uint32_t;
+typedef signed long long int	__int64_t;
+typedef unsigned long long int	__uint64_t;
+
+typedef __uint32_t		inst_t;		/* an instruction */
+
+typedef __s64			xfs_off_t;	/* <file offset> type */
+typedef unsigned long long	xfs_ino_t;	/* <inode> type */
+typedef __s64			xfs_daddr_t;	/* <disk address> type */
+typedef char *			xfs_caddr_t;	/* <core address> type */
+typedef __u32			xfs_dev_t;
+typedef __u32			xfs_nlink_t;
+
+/* __psint_t is the same size as a pointer */
+#if (BITS_PER_LONG == 32)
+typedef __int32_t __psint_t;
+typedef __uint32_t __psunsigned_t;
+#elif (BITS_PER_LONG == 64)
+typedef __int64_t __psint_t;
+typedef __uint64_t __psunsigned_t;
+#else
+#error BITS_PER_LONG must be 32 or 64
+#endif
+
 #include "xfs_types.h"
 
 #include "kmem.h"
fs/xfs/xfs_types.h +0 -36
index 6ed6b26..ce44b18 100644
@@ -18,42 +18,6 @@
 #ifndef __XFS_TYPES_H__
 #define	__XFS_TYPES_H__
 
-#ifdef __KERNEL__
-
-/*
- * Additional type declarations for XFS
- */
-typedef signed char		__int8_t;
-typedef unsigned char		__uint8_t;
-typedef signed short int	__int16_t;
-typedef unsigned short int	__uint16_t;
-typedef signed int		__int32_t;
-typedef unsigned int		__uint32_t;
-typedef signed long long int	__int64_t;
-typedef unsigned long long int	__uint64_t;
-
-typedef __uint32_t		inst_t;		/* an instruction */
-
-typedef __s64			xfs_off_t;	/* <file offset> type */
-typedef unsigned long long	xfs_ino_t;	/* <inode> type */
-typedef __s64			xfs_daddr_t;	/* <disk address> type */
-typedef char *			xfs_caddr_t;	/* <core address> type */
-typedef __u32			xfs_dev_t;
-typedef __u32			xfs_nlink_t;
-
-/* __psint_t is the same size as a pointer */
-#if (BITS_PER_LONG == 32)
-typedef __int32_t __psint_t;
-typedef __uint32_t __psunsigned_t;
-#elif (BITS_PER_LONG == 64)
-typedef __int64_t __psint_t;
-typedef __uint64_t __psunsigned_t;
-#else
-#error BITS_PER_LONG must be 32 or 64
-#endif
-
-#endif	/* __KERNEL__ */
-
 typedef __uint32_t	prid_t;		/* project ID */
 
 typedef __uint32_t	xfs_agblock_t;	/* blockno in alloc. group */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 22/50] xfs: minor cleanups

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

These come from syncing the shared userspace and kernel code. Small whitespace and trivial cleanups.

---
 fs/xfs/xfs_attr_leaf.c   | 2 --
 fs/xfs/xfs_attr_remote.c | 8 +-------
 fs/xfs/xfs_bmap_btree.c  | 4 +---
 fs/xfs/xfs_inode_fork.c  | 4 ++--
 4 files changed, 4 insertions(+), 14 deletions(-)
fs/xfs/xfs_attr_leaf.c +0 -2
index fe0ade9..4dba2f9 100644
@@ -936,7 +936,6 @@ out:
 	return error;
 }
 
-
 /*========================================================================
  * Routines used for growing the Btree.
  *========================================================================*/
@@ -1297,7 +1296,6 @@ xfs_attr3_leaf_compact(
 	ichdr_dst->freemap[0].size = ichdr_dst->firstused -
 						ichdr_dst->freemap[0].base;
 
-
 	/* write the header back to initialise the underlying buffer */
 	xfs_attr3_leaf_hdr_to_disk(leaf_dst, ichdr_dst);
 
fs/xfs/xfs_attr_remote.c +1 -7
index 13a0ed9..b42926a 100644
@@ -251,7 +251,7 @@ xfs_attr_rmtval_copyout(
 		int hdr_size = 0;
 		int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, XFS_LBSIZE(mp));
 
-		byte_cnt = min_t(int, *valuelen, byte_cnt);
+		byte_cnt = min(*valuelen, byte_cnt);
 
 		if (xfs_sb_version_hascrc(&mp->m_sb)) {
 			if (!xfs_attr3_rmt_hdr_ok(mp, src, ino, *offset,
@@ -545,11 +545,6 @@ xfs_attr_rmtval_remove(
 
 	/*
 	 * Roll through the "value", invalidating the attribute value's blocks.
-	 * Note that args->rmtblkcnt is the minimum number of data blocks we'll
-	 * see for a CRC enabled remote attribute. Each extent will have a
-	 * header, and so we may have more blocks than we realise here.  If we
-	 * fail to map the blocks correctly, we'll have problems with the buffer
-	 * lookups.
 	 */
 	lblkno = args->rmtblkno;
 	blkcnt = args->rmtblkcnt;
@@ -630,4 +625,3 @@ xfs_attr_rmtval_remove(
 	}
 	return(0);
 }
-
fs/xfs/xfs_bmap_btree.c +1 -3
index bcee383..cf3bc76 100644
@@ -722,7 +722,7 @@ xfs_bmbt_key_diff(
 				      cur->bc_rec.b.br_startoff;
 }
 
-static int
+static bool
 xfs_bmbt_verify(
 	struct xfs_buf		*bp)
 {
@@ -775,7 +775,6 @@ xfs_bmbt_verify(
 		return false;
 
 	return true;
-
 }
 
 static void
@@ -789,7 +788,6 @@ xfs_bmbt_read_verify(
 				     bp->b_target->bt_mount, bp->b_addr);
 		xfs_buf_ioerror(bp, EFSCORRUPTED);
 	}
-
 }
 
 static void
fs/xfs/xfs_inode_fork.c +2 -2
index 8b8ba02..f06570b 100644
@@ -780,8 +780,8 @@ xfs_iextents_copy(
 		}
 
 		/* Translate to on disk format */
-		put_unaligned(cpu_to_be64(ep->l0), &dp->l0);
-		put_unaligned(cpu_to_be64(ep->l1), &dp->l1);
+		put_unaligned_be64(ep->l0, &dp->l0);
+		put_unaligned_be64(ep->l1, &dp->l1);
 		dp++;
 		copied++;
 	}
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 25/50] xfs: consolidate xfs_rename.c

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Move the rename code to xfs_inode.c to continue consolidating all the kernel xfs_inode operations in the one place.

---
 fs/xfs/Makefile     |   1 -
 fs/xfs/xfs_inode.c  | 308 +++++++++++++++++++++++++++++++++++++++++++++-
 fs/xfs/xfs_rename.c | 347 ----------------------------------------------------
 3 files changed, 307 insertions(+), 349 deletions(-)
 delete mode 100644 fs/xfs/xfs_rename.c
fs/xfs/Makefile +0 -1
index 8691dba..e5a0758 100644
@@ -50,7 +50,6 @@ xfs-y				+= xfs_aops.o \
 				   xfs_message.o \
 				   xfs_mount.o \
 				   xfs_mru_cache.o \
-				   xfs_rename.o \
 				   xfs_super.o \
 				   xfs_symlink.o \
 				   xfs_trans.o \
fs/xfs/xfs_inode.c +307 -1

320 lines not on this page · raw message

fs/xfs/xfs_rename.c deleted +0 -347

347 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 23/50] xfs: fix issues that cause userspace warnings

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.

---
 fs/xfs/xfs_attr_remote.c | 8 ++++----
 fs/xfs/xfs_bmap.c        | 3 ---
 fs/xfs/xfs_da_btree.c    | 6 +++---
 fs/xfs/xfs_dir2_node.c   | 2 ++
 fs/xfs/xfs_ialloc.c      | 2 +-
 fs/xfs/xfs_rtalloc.c     | 4 ++--
 6 files changed, 12 insertions(+), 13 deletions(-)
fs/xfs/xfs_attr_remote.c +4 -4
index b42926a..712a502 100644
@@ -239,7 +239,7 @@ xfs_attr_rmtval_copyout(
 	xfs_ino_t	ino,
 	int		*offset,
 	int		*valuelen,
-	char		**dst)
+	__uint8_t	**dst)
 {
 	char		*src = bp->b_addr;
 	xfs_daddr_t	bno = bp->b_bn;
@@ -286,7 +286,7 @@ xfs_attr_rmtval_copyin(
 	xfs_ino_t	ino,
 	int		*offset,
 	int		*valuelen,
-	char		**src)
+	__uint8_t	**src)
 {
 	char		*dst = bp->b_addr;
 	xfs_daddr_t	bno = bp->b_bn;
@@ -339,7 +339,7 @@ xfs_attr_rmtval_get(
 	struct xfs_mount	*mp = args->dp->i_mount;
 	struct xfs_buf		*bp;
 	xfs_dablk_t		lblkno = args->rmtblkno;
-	char			*dst = args->value;
+	__uint8_t		*dst = args->value;
 	int			valuelen = args->valuelen;
 	int			nmap;
 	int			error;
@@ -403,7 +403,7 @@ xfs_attr_rmtval_set(
 	struct xfs_bmbt_irec	map;
 	xfs_dablk_t		lblkno;
 	xfs_fileoff_t		lfileoff = 0;
-	char			*src = args->value;
+	__uint8_t		*src = args->value;
 	int			blkcnt;
 	int			valuelen;
 	int			nmap;
fs/xfs/xfs_bmap.c +0 -3
index 1f09faf..a9331a6 100644
@@ -4258,12 +4258,9 @@ __xfs_bmapi_allocate(
 	struct xfs_ifork	*ifp = XFS_IFORK_PTR(bma->ip, whichfork);
 	int			tmp_logflags = 0;
 	int			error;
-	int			rt;
 
 	ASSERT(bma->length > 0);
 
-	rt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(bma->ip);
-
 	/*
 	 * For the wasdelay case, we could also just allocate the stuff asked
 	 * for in this bmap call but that wouldn't be as good.
fs/xfs/xfs_da_btree.c +3 -3
index 8bbd7ef..d4e59a4 100644
@@ -399,7 +399,7 @@ xfs_da3_split(
 	struct xfs_da_intnode	*node;
 	struct xfs_buf		*bp;
 	int			max;
-	int			action;
+	int			action = 0;
 	int			error;
 	int			i;
 
@@ -2454,9 +2454,9 @@ static int
 xfs_buf_map_from_irec(
 	struct xfs_mount	*mp,
 	struct xfs_buf_map	**mapp,
-	unsigned int		*nmaps,
+	int			*nmaps,
 	struct xfs_bmbt_irec	*irecs,
-	unsigned int		nirecs)
+	int			nirecs)
 {
 	struct xfs_buf_map	*map;
 	int			i;
fs/xfs/xfs_dir2_node.c +2 -0
index b4bd9b6..18e287d 100644
@@ -313,11 +313,13 @@ xfs_dir2_free_log_header(
 	struct xfs_trans	*tp,
 	struct xfs_buf		*bp)
 {
+#ifdef DEBUG
 	xfs_dir2_free_t		*free;		/* freespace structure */
 
 	free = bp->b_addr;
 	ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
 	       free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
+#endif
 	xfs_trans_log_buf(tp, bp, 0, xfs_dir3_free_hdr_size(tp->t_mountp) - 1);
 }
 
fs/xfs/xfs_ialloc.c +1 -1
index bd4e2a7..266024b 100644
@@ -1342,7 +1342,7 @@ xfs_imap(
 	xfs_agblock_t	cluster_agbno;	/* first block in inode cluster */
 	int		error;	/* error code */
 	int		offset;	/* index of inode in its buffer */
-	int		offset_agbno;	/* blks from chunk start to inode */
+	xfs_agblock_t	offset_agbno;	/* blks from chunk start to inode */
 
 	ASSERT(ino != NULLFSINO);
 
fs/xfs/xfs_rtalloc.c +2 -2
index 084caa8..7a445e6 100644
@@ -736,8 +736,8 @@ xfs_rtallocate_range(
 {
 	xfs_rtblock_t	end;		/* end of the allocated extent */
 	int		error;		/* error value */
-	xfs_rtblock_t	postblock;	/* first block allocated > end */
-	xfs_rtblock_t	preblock;	/* first block allocated < start */
+	xfs_rtblock_t	postblock = 0;	/* first block allocated > end */
+	xfs_rtblock_t	preblock = 0;	/* first block allocated < start */
 
 	end = start + len - 1;
 	/*
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 38/50] xfs: refactor xfs_trans_reserve() interface

In reply to Dave Chinner

From: Jie Liu <[email protected]>

With the new xfs_trans_res structure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refine xfs_trans_reserve() interface to be more neat.

Also, introduce a new helper M_RES() to return a pointer to the mp->m_resv structure to simplify the input.

---
 fs/xfs/xfs_aops.c          |  2 +-
 fs/xfs/xfs_attr.c          | 33 +++++++++--------
 fs/xfs/xfs_attr_inactive.c |  5 ++-
 fs/xfs/xfs_bmap.c          |  4 +--
 fs/xfs/xfs_bmap_util.c     | 42 ++++++++--------------
 fs/xfs/xfs_dquot.c         |  6 ++--
 fs/xfs/xfs_fsops.c         |  8 ++---
 fs/xfs/xfs_inode.c         | 88 +++++++++++++++++++---------------------------
 fs/xfs/xfs_ioctl.c         |  4 +--
 fs/xfs/xfs_iomap.c         | 18 ++++------
 fs/xfs/xfs_iops.c          |  8 ++---
 fs/xfs/xfs_log_recover.c   |  5 ++-
 fs/xfs/xfs_mount.c         |  9 ++---
 fs/xfs/xfs_qm.c            | 11 +++---
 fs/xfs/xfs_qm_syscalls.c   | 13 +++----
 fs/xfs/xfs_rtalloc.c       | 17 ++++-----
 fs/xfs/xfs_symlink.c       | 10 +++---
 fs/xfs/xfs_trans.c         | 51 ++++++++++++++-------------
 fs/xfs/xfs_trans.h         |  3 +-
 fs/xfs/xfs_trans_resv.c    |  7 ++--
 fs/xfs/xfs_trans_resv.h    |  3 ++
 21 files changed, 150 insertions(+), 197 deletions(-)
fs/xfs/xfs_aops.c +1 -1
index a82c837..1269434 100644
@@ -116,7 +116,7 @@ xfs_setfilesize_trans_alloc(
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);
 
-	error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_fsyncts, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
fs/xfs/xfs_attr.c +16 -17
index 046cf3d..176dbb6 100644
@@ -226,13 +226,14 @@ xfs_attr_set_int(
 	int		valuelen,
 	int		flags)
 {
-	xfs_da_args_t	args;
-	xfs_fsblock_t	firstblock;
-	xfs_bmap_free_t flist;
-	int		error, err2, committed;
-	xfs_mount_t	*mp = dp->i_mount;
-	int             rsvd = (flags & ATTR_ROOT) != 0;
-	int		local;
+	xfs_da_args_t		args;
+	xfs_fsblock_t		firstblock;
+	xfs_bmap_free_t		flist;
+	int			error, err2, committed;
+	struct xfs_mount	*mp = dp->i_mount;
+	struct xfs_trans_res	tres;
+	int			rsvd = (flags & ATTR_ROOT) != 0;
+	int			local;
 
 	/*
 	 * Attach the dquots to the inode.
@@ -292,11 +293,11 @@ xfs_attr_set_int(
 	if (rsvd)
 		args.trans->t_flags |= XFS_TRANS_RESERVE;
 
-	error = xfs_trans_reserve(args.trans, args.total,
-				  XFS_ATTRSETM_LOG_RES(mp) +
-				  XFS_ATTRSETRT_LOG_RES(mp) * args.total,
-				  0, XFS_TRANS_PERM_LOG_RES,
-				  XFS_ATTRSET_LOG_COUNT);
+	tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
+			 M_RES(mp)->tr_attrsetrt.tr_logres * args.total;
+	tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
+	tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
+	error = xfs_trans_reserve(args.trans, &tres, args.total, 0);
 	if (error) {
 		xfs_trans_cancel(args.trans, 0);
 		return(error);
@@ -516,11 +517,9 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)
 	if (flags & ATTR_ROOT)
 		args.trans->t_flags |= XFS_TRANS_RESERVE;
 
-	if ((error = xfs_trans_reserve(args.trans,
-				      XFS_ATTRRM_SPACE_RES(mp),
-				      XFS_ATTRRM_LOG_RES(mp),
-				      0, XFS_TRANS_PERM_LOG_RES,
-				      XFS_ATTRRM_LOG_COUNT))) {
+	error = xfs_trans_reserve(args.trans, &M_RES(mp)->tr_attrrm,
+				  XFS_ATTRRM_SPACE_RES(mp), 0);
+	if (error) {
 		xfs_trans_cancel(args.trans, 0);
 		return(error);
 	}
fs/xfs/xfs_attr_inactive.c +2 -3
index ace95e7..bb24b07 100644
@@ -412,9 +412,8 @@ xfs_attr_inactive(xfs_inode_t *dp)
 	 * the log.
 	 */
 	trans = xfs_trans_alloc(mp, XFS_TRANS_ATTRINVAL);
-	if ((error = xfs_trans_reserve(trans, 0, XFS_ATTRINVAL_LOG_RES(mp), 0,
-				      XFS_TRANS_PERM_LOG_RES,
-				      XFS_ATTRINVAL_LOG_COUNT))) {
+	error = xfs_trans_reserve(trans, &M_RES(mp)->tr_attrinval, 0, 0);
+	if (error) {
 		xfs_trans_cancel(trans, 0);
 		return(error);
 	}
fs/xfs/xfs_bmap.c +2 -2
index 51e07e7..6c2d89e 100644
@@ -1148,8 +1148,8 @@ xfs_bmap_add_attrfork(
 	blks = XFS_ADDAFORK_SPACE_RES(mp);
 	if (rsvd)
 		tp->t_flags |= XFS_TRANS_RESERVE;
-	if ((error = xfs_trans_reserve(tp, blks, XFS_ADDAFORK_LOG_RES(mp), 0,
-			XFS_TRANS_PERM_LOG_RES, XFS_ADDAFORK_LOG_COUNT)))
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_addafork, blks, 0);
+	if (error)
 		goto error0;
 	xfs_ilock(ip, XFS_ILOCK_EXCL);
 	error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
fs/xfs/xfs_bmap_util.c +15 -27

90 lines not on this page · raw message

fs/xfs/xfs_dquot.c +2 -4
index e90e123..251c666 100644
@@ -712,10 +712,8 @@ xfs_qm_dqread(
 
 	if (flags & XFS_QMOPT_DQALLOC) {
 		tp = xfs_trans_alloc(mp, XFS_TRANS_QM_DQALLOC);
-		error = xfs_trans_reserve(tp, XFS_QM_DQALLOC_SPACE_RES(mp),
-					  XFS_QM_DQALLOC_LOG_RES(mp), 0,
-					  XFS_TRANS_PERM_LOG_RES,
-					  XFS_WRITE_LOG_COUNT);
+		error = xfs_trans_reserve(tp, &M_RES(mp)->tr_attrsetm,
+					  XFS_QM_DQALLOC_SPACE_RES(mp), 0);
 		if (error)
 			goto error1;
 		cancelflags = XFS_TRANS_RELEASE_LOG_RES;
fs/xfs/xfs_fsops.c +4 -4
index 614eb0c..e64ee52 100644
@@ -203,8 +203,9 @@ xfs_growfs_data_private(
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS);
 	tp->t_flags |= XFS_TRANS_RESERVE;
-	if ((error = xfs_trans_reserve(tp, XFS_GROWFS_SPACE_RES(mp),
-			XFS_GROWDATA_LOG_RES(mp), 0, 0, 0))) {
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growdata,
+				  XFS_GROWFS_SPACE_RES(mp), 0);
+	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
 	}
@@ -739,8 +740,7 @@ xfs_fs_log_dummy(
 	int		error;
 
 	tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1, KM_SLEEP);
-	error = xfs_trans_reserve(tp, 0, XFS_SB_LOG_RES(mp), 0, 0,
-				  XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_sb, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
fs/xfs/xfs_inode.c +36 -52

189 lines not on this page · raw message

fs/xfs/xfs_ioctl.c +2 -2
index efb216d..e9c17e2 100644
@@ -367,7 +367,7 @@ xfs_set_dmattrs(
 		return XFS_ERROR(EIO);
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_SET_DMATTRS);
-	error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES (mp), 0, 0, 0);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
@@ -1001,7 +1001,7 @@ xfs_ioctl_setattr(
 	 * first do an error checking pass.
 	 */
 	tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
-	code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
+	code = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
 	if (code)
 		goto error_return;
 
fs/xfs/xfs_iomap.c +6 -12
index cf8f744..8d4d49b 100644
@@ -188,10 +188,8 @@ xfs_iomap_write_direct(
 	 * Allocate and setup the transaction
 	 */
 	tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT);
-	error = xfs_trans_reserve(tp, resblks,
-			XFS_WRITE_LOG_RES(mp), resrtextents,
-			XFS_TRANS_PERM_LOG_RES,
-			XFS_WRITE_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
+				  resblks, resrtextents);
 	/*
 	 * Check for running out of space, note: need lock to return
 	 */
@@ -699,10 +697,8 @@ xfs_iomap_write_allocate(
 			tp = xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE);
 			tp->t_flags |= XFS_TRANS_RESERVE;
 			nres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK);
-			error = xfs_trans_reserve(tp, nres,
-					XFS_WRITE_LOG_RES(mp),
-					0, XFS_TRANS_PERM_LOG_RES,
-					XFS_WRITE_LOG_COUNT);
+			error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
+						  nres, 0);
 			if (error) {
 				xfs_trans_cancel(tp, 0);
 				return XFS_ERROR(error);
@@ -865,10 +861,8 @@ xfs_iomap_write_unwritten(
 		sb_start_intwrite(mp->m_super);
 		tp = _xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE, KM_NOFS);
 		tp->t_flags |= XFS_TRANS_RESERVE | XFS_TRANS_FREEZE_PROT;
-		error = xfs_trans_reserve(tp, resblks,
-				XFS_WRITE_LOG_RES(mp), 0,
-				XFS_TRANS_PERM_LOG_RES,
-				XFS_WRITE_LOG_COUNT);
+		error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
+					  resblks, 0);
 		if (error) {
 			xfs_trans_cancel(tp, 0);
 			return XFS_ERROR(error);
fs/xfs/xfs_iops.c +3 -5
index 24be68d..82c5a5d 100644
@@ -546,7 +546,7 @@ xfs_setattr_nonsize(
 	}
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
-	error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
 	if (error)
 		goto out_dqrele;
 
@@ -808,9 +808,7 @@ xfs_setattr_size(
 		goto out_unlock;
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_SIZE);
-	error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0,
-				 XFS_TRANS_PERM_LOG_RES,
-				 XFS_ITRUNCATE_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0);
 	if (error)
 		goto out_trans_cancel;
 
@@ -933,7 +931,7 @@ xfs_vn_update_time(
 	trace_xfs_update_time(ip);
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);
-	error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_fsyncts, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return -error;
fs/xfs/xfs_log_recover.c +2 -3
index 81c04eb..217e7fb 100644
@@ -3377,7 +3377,7 @@ xlog_recover_process_efi(
 	}
 
 	tp = xfs_trans_alloc(mp, 0);
-	error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0, 0, 0);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0);
 	if (error)
 		goto abort_error;
 	efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
@@ -3483,8 +3483,7 @@ xlog_recover_clear_agi_bucket(
 	int		error;
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_CLEAR_AGI_BUCKET);
-	error = xfs_trans_reserve(tp, 0, XFS_CLEAR_AGI_BUCKET_LOG_RES(mp),
-				  0, 0, 0);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_clearagi, 0, 0);
 	if (error)
 		goto out_abort;
 
fs/xfs/xfs_mount.c +3 -6
index 7a9986d..85b6aaa 100644
@@ -597,8 +597,7 @@ xfs_mount_reset_sbqflags(
 		return 0;
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
-	error = xfs_trans_reserve(tp, 0, XFS_QM_SBCHANGE_LOG_RES(mp),
-				  0, 0, XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_qm_sbchange, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		xfs_alert(mp, "%s: Superblock update failed!", __func__);
@@ -1071,8 +1070,7 @@ xfs_log_sbcount(xfs_mount_t *mp)
 		return 0;
 
 	tp = _xfs_trans_alloc(mp, XFS_TRANS_SB_COUNT, KM_SLEEP);
-	error = xfs_trans_reserve(tp, 0, XFS_SB_LOG_RES(mp), 0, 0,
-				  XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_sb, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
@@ -1392,8 +1390,7 @@ xfs_mount_log_sb(
 			 XFS_SB_VERSIONNUM));
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT);
-	error = xfs_trans_reserve(tp, 0, XFS_SB_LOG_RES(mp), 0, 0,
-				  XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_sb, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
fs/xfs/xfs_qm.c +4 -7
index 35a6f56..479c933 100644
@@ -865,11 +865,9 @@ xfs_qm_qino_alloc(
 	}
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QINOCREATE);
-	if ((error = xfs_trans_reserve(tp,
-				      XFS_QM_QINOCREATE_SPACE_RES(mp),
-				      XFS_CREATE_LOG_RES(mp), 0,
-				      XFS_TRANS_PERM_LOG_RES,
-				      XFS_CREATE_LOG_COUNT))) {
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_create,
+				  XFS_QM_QINOCREATE_SPACE_RES(mp), 0);
+	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
 	}
@@ -1740,8 +1738,7 @@ xfs_qm_write_sb_changes(
 	int		error;
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
-	error = xfs_trans_reserve(tp, 0, XFS_QM_SBCHANGE_LOG_RES(mp),
-				  0, 0, XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_qm_sbchange, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
fs/xfs/xfs_qm_syscalls.c +4 -9
index 6fdccc3..5290af2 100644
@@ -247,9 +247,7 @@ xfs_qm_scall_trunc_qfile(
 	xfs_ilock(ip, XFS_IOLOCK_EXCL);
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_TRUNCATE_FILE);
-	error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0,
-				  XFS_TRANS_PERM_LOG_RES,
-				  XFS_ITRUNCATE_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		xfs_iunlock(ip, XFS_IOLOCK_EXCL);
@@ -540,8 +538,7 @@ xfs_qm_scall_setqlim(
 	xfs_dqunlock(dqp);
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM);
-	error = xfs_trans_reserve(tp, 0, XFS_QM_SETQLIM_LOG_RES(mp),
-				  0, 0, XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_qm_setqlim, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		goto out_rele;
@@ -675,8 +672,7 @@ xfs_qm_log_quotaoff_end(
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END);
 
-	error = xfs_trans_reserve(tp, 0, XFS_QM_QUOTAOFF_END_LOG_RES(mp),
-				  0, 0, XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_qm_equotaoff, 0, 0);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return (error);
@@ -709,8 +705,7 @@ xfs_qm_log_quotaoff(
 	uint			oldsbqflag=0;
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF);
-	error = xfs_trans_reserve(tp, 0, XFS_QM_QUOTAOFF_LOG_RES(mp),
-				  0, 0, XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_qm_quotaoff, 0, 0);
 	if (error)
 		goto error0;
 
fs/xfs/xfs_rtalloc.c +9 -8
index 6dbcb5e..6f9e63c 100644
@@ -100,10 +100,9 @@ xfs_growfs_rt_alloc(
 		/*
 		 * Reserve space & log for one extent added to the file.
 		 */
-		if ((error = xfs_trans_reserve(tp, resblks,
-				XFS_GROWRTALLOC_LOG_RES(mp), 0,
-				XFS_TRANS_PERM_LOG_RES,
-				XFS_DEFAULT_PERM_LOG_COUNT)))
+		error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growdata,
+					  resblks, 0);
+		if (error)
 			goto error_cancel;
 		cancelflags = XFS_TRANS_RELEASE_LOG_RES;
 		/*
@@ -146,8 +145,9 @@ xfs_growfs_rt_alloc(
 			/*
 			 * Reserve log for one block zeroing.
 			 */
-			if ((error = xfs_trans_reserve(tp, 0,
-					XFS_GROWRTZERO_LOG_RES(mp), 0, 0, 0)))
+			error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growrtzero,
+						  0, 0);
+			if (error)
 				goto error_cancel;
 			/*
 			 * Lock the bitmap inode.
@@ -1957,8 +1957,9 @@ xfs_growfs_rt(
 		 * Start a transaction, get the log reservation.
 		 */
 		tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_FREE);
-		if ((error = xfs_trans_reserve(tp, 0,
-				XFS_GROWRTFREE_LOG_RES(nmp), 0, 0, 0)))
+		error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growrtfree,
+					  0, 0);
+		if (error)
 			goto error_cancel;
 		/*
 		 * Lock out other callers by grabbing the bitmap inode lock.
fs/xfs/xfs_symlink.c +4 -6
index e6facbf..7676fe3 100644
@@ -231,12 +231,10 @@ xfs_symlink(
 	else
 		fs_blocks = xfs_symlink_blocks(mp, pathlen);
 	resblks = XFS_SYMLINK_SPACE_RES(mp, link_name->len, fs_blocks);
-	error = xfs_trans_reserve(tp, resblks, XFS_SYMLINK_LOG_RES(mp), 0,
-			XFS_TRANS_PERM_LOG_RES, XFS_SYMLINK_LOG_COUNT);
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_symlink, resblks, 0);
 	if (error == ENOSPC && fs_blocks == 0) {
 		resblks = 0;
-		error = xfs_trans_reserve(tp, 0, XFS_SYMLINK_LOG_RES(mp), 0,
-				XFS_TRANS_PERM_LOG_RES, XFS_SYMLINK_LOG_COUNT);
+		error = xfs_trans_reserve(tp, &M_RES(mp)->tr_symlink, 0, 0);
 	}
 	if (error) {
 		cancel_flags = 0;
@@ -539,8 +537,8 @@ xfs_inactive_symlink_rmt(
 	 * Put an itruncate log reservation in the new transaction
 	 * for our caller.
 	 */
-	if ((error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0,
-			XFS_TRANS_PERM_LOG_RES, XFS_ITRUNCATE_LOG_COUNT))) {
+	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0);
+	if (error) {
 		ASSERT(XFS_FORCED_SHUTDOWN(mp));
 		goto error0;
 	}
fs/xfs/xfs_trans.c +26 -25

111 lines not on this page · raw message

fs/xfs/xfs_trans.h +2 -1
index b5dc61e..7eb81cc 100644
@@ -34,6 +34,7 @@ struct xfs_log_iovec;
 struct xfs_log_item_desc;
 struct xfs_mount;
 struct xfs_trans;
+struct xfs_trans_res;
 struct xfs_dquot_acct;
 struct xfs_busy_extent;
 
@@ -170,7 +171,7 @@ typedef struct xfs_trans {
 xfs_trans_t	*xfs_trans_alloc(struct xfs_mount *, uint);
 xfs_trans_t	*_xfs_trans_alloc(struct xfs_mount *, uint, xfs_km_flags_t);
 xfs_trans_t	*xfs_trans_dup(xfs_trans_t *);
-int		xfs_trans_reserve(xfs_trans_t *, uint, uint, uint,
+int		xfs_trans_reserve(struct xfs_trans *, struct xfs_trans_res *,
 				  uint, uint);
 void		xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t);
 
fs/xfs/xfs_trans_resv.c +4 -3
index e9211ad..24110f3 100644
@@ -547,7 +547,8 @@ xfs_calc_attrsetm_reservation(
  * Since the runtime attribute transaction space is dependent on the total
  * blocks needed for the 1st bmap, here we calculate out the space unit for
  * one block so that the caller could figure out the total space according
- * to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp).
+ * to the attibute extent length in blocks by:
+ *	ext * M_RES(mp)->tr_attrsetrt.tr_logres
  */
 STATIC uint
 xfs_calc_attrsetrt_reservation(
@@ -619,14 +620,14 @@ xfs_calc_qm_setqlim_reservation(
 
 /*
  * Allocating quota on disk if needed.
- *	the write transaction log space: XFS_WRITE_LOG_RES(mp)
+ *	the write transaction log space: M_RES(mp)->tr_write.tr_logres
  *	the unit of quota allocation: one system block size
  */
 STATIC uint
 xfs_calc_qm_dqalloc_reservation(
 	struct xfs_mount	*mp)
 {
-	return XFS_WRITE_LOG_RES(mp) +
+	return M_RES(mp)->tr_write.tr_logres +
 		xfs_calc_buf_res(1,
 			XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1);
 }
fs/xfs/xfs_trans_resv.h +3 -0
index b8d5666..140d3f3 100644
@@ -65,6 +65,9 @@ struct xfs_trans_resv {
 	struct xfs_trans_res	tr_fsyncts;	/* update timestamps on fsync */
 };
 
+/* shorthand way of accessing reservation structure */
+#define M_RES(mp)	(&(mp)->m_resv)
+
 /*
  * Per-extent log reservation for the allocation btree changes
  * involved in freeing or allocating an extent.
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 09/50] xfs: introduce xfs_quota_defs.h

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to xfs_quota_defs.h so we can unshare xfs_quota.h and remove the __KERNEL__ regions from it.

---
 fs/xfs/xfs_quota.h      | 134 +----------------------------------------
 fs/xfs/xfs_quota_defs.h | 157 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 160 insertions(+), 131 deletions(-)
 create mode 100644 fs/xfs/xfs_quota_defs.h
fs/xfs/xfs_quota.h +3 -131
index 16bde32..fc2fed6 100644
@@ -18,141 +18,14 @@
 #ifndef __XFS_QUOTA_H__
 #define __XFS_QUOTA_H__
 
-struct xfs_trans;
+#include "xfs_quota_defs.h"
 
 /*
- * Even though users may not have quota limits occupying all 64-bits,
- * they may need 64-bit accounting. Hence, 64-bit quota-counters,
- * and quota-limits. This is a waste in the common case, but hey ...
+ * Kernel only quota definitions and functions
  */
-typedef __uint64_t	xfs_qcnt_t;
-typedef __uint16_t	xfs_qwarncnt_t;
-
-/*
- * flags for q_flags field in the dquot.
- */
-#define XFS_DQ_USER		0x0001		/* a user quota */
-#define XFS_DQ_PROJ		0x0002		/* project quota */
-#define XFS_DQ_GROUP		0x0004		/* a group quota */
-#define XFS_DQ_DIRTY		0x0008		/* dquot is dirty */
-#define XFS_DQ_FREEING		0x0010		/* dquot is beeing torn down */
-
-#define XFS_DQ_ALLTYPES		(XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP)
 
-#define XFS_DQ_FLAGS \
-	{ XFS_DQ_USER,		"USER" }, \
-	{ XFS_DQ_PROJ,		"PROJ" }, \
-	{ XFS_DQ_GROUP,		"GROUP" }, \
-	{ XFS_DQ_DIRTY,		"DIRTY" }, \
-	{ XFS_DQ_FREEING,	"FREEING" }
-
-/*
- * We have the possibility of all three quota types being active at once, and
- * hence free space modification requires modification of all three current
- * dquots in a single transaction. For this case we need to have a reservation
- * of at least 3 dquots.
- *
- * However, a chmod operation can change both UID and GID in a single
- * transaction, resulting in requiring {old, new} x {uid, gid} dquots to be
- * modified. Hence for this case we need to reserve space for at least 4 dquots.
- *
- * And in the worst case, there's a rename operation that can be modifying up to
- * 4 inodes with dquots attached to them. In reality, the only inodes that can
- * have their dquots modified are the source and destination directory inodes
- * due to directory name creation and removal. That can require space allocation
- * and/or freeing on both directory inodes, and hence all three dquots on each
- * inode can be modified. And if the directories are world writeable, all the
- * dquots can be unique and so 6 dquots can be modified....
- *
- * And, of course, we also need to take into account the dquot log format item
- * used to describe each dquot.
- */
-#define XFS_DQUOT_LOGRES(mp)	\
-	((sizeof(struct xfs_dq_logformat) + sizeof(struct xfs_disk_dquot)) * 6)
-
-#define XFS_IS_QUOTA_RUNNING(mp)	((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)
-#define XFS_IS_UQUOTA_RUNNING(mp)	((mp)->m_qflags & XFS_UQUOTA_ACCT)
-#define XFS_IS_PQUOTA_RUNNING(mp)	((mp)->m_qflags & XFS_PQUOTA_ACCT)
-#define XFS_IS_GQUOTA_RUNNING(mp)	((mp)->m_qflags & XFS_GQUOTA_ACCT)
-#define XFS_IS_UQUOTA_ENFORCED(mp)	((mp)->m_qflags & XFS_UQUOTA_ENFD)
-#define XFS_IS_GQUOTA_ENFORCED(mp)	((mp)->m_qflags & XFS_GQUOTA_ENFD)
-#define XFS_IS_PQUOTA_ENFORCED(mp)	((mp)->m_qflags & XFS_PQUOTA_ENFD)
-
-/*
- * Incore only flags for quotaoff - these bits get cleared when quota(s)
- * are in the process of getting turned off. These flags are in m_qflags but
- * never in sb_qflags.
- */
-#define XFS_UQUOTA_ACTIVE	0x1000  /* uquotas are being turned off */
-#define XFS_GQUOTA_ACTIVE	0x2000  /* gquotas are being turned off */
-#define XFS_PQUOTA_ACTIVE	0x4000  /* pquotas are being turned off */
-#define XFS_ALL_QUOTA_ACTIVE	\
-	(XFS_UQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE)
-
-/*
- * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees
- * quota will be not be switched off as long as that inode lock is held.
- */
-#define XFS_IS_QUOTA_ON(mp)	((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
-						   XFS_GQUOTA_ACTIVE | \
-						   XFS_PQUOTA_ACTIVE))
-#define XFS_IS_OQUOTA_ON(mp)	((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \
-						   XFS_PQUOTA_ACTIVE))
-#define XFS_IS_UQUOTA_ON(mp)	((mp)->m_qflags & XFS_UQUOTA_ACTIVE)
-#define XFS_IS_GQUOTA_ON(mp)	((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
-#define XFS_IS_PQUOTA_ON(mp)	((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
-
-/*
- * Flags to tell various functions what to do. Not all of these are meaningful
- * to a single function. None of these XFS_QMOPT_* flags are meant to have
- * persistent values (ie. their values can and will change between versions)
- */
-#define XFS_QMOPT_DQALLOC	0x0000002 /* alloc dquot ondisk if needed */
-#define XFS_QMOPT_UQUOTA	0x0000004 /* user dquot requested */
-#define XFS_QMOPT_PQUOTA	0x0000008 /* project dquot requested */
-#define XFS_QMOPT_FORCE_RES	0x0000010 /* ignore quota limits */
-#define XFS_QMOPT_SBVERSION	0x0000040 /* change superblock version num */
-#define XFS_QMOPT_DOWARN        0x0000400 /* increase warning cnt if needed */
-#define XFS_QMOPT_DQREPAIR	0x0001000 /* repair dquot if damaged */
-#define XFS_QMOPT_GQUOTA	0x0002000 /* group dquot requested */
-#define XFS_QMOPT_ENOSPC	0x0004000 /* enospc instead of edquot (prj) */
-
-/*
- * flags to xfs_trans_mod_dquot to indicate which field needs to be
- * modified.
- */
-#define XFS_QMOPT_RES_REGBLKS	0x0010000
-#define XFS_QMOPT_RES_RTBLKS	0x0020000
-#define XFS_QMOPT_BCOUNT	0x0040000
-#define XFS_QMOPT_ICOUNT	0x0080000
-#define XFS_QMOPT_RTBCOUNT	0x0100000
-#define XFS_QMOPT_DELBCOUNT	0x0200000
-#define XFS_QMOPT_DELRTBCOUNT	0x0400000
-#define XFS_QMOPT_RES_INOS	0x0800000
-
-/*
- * flags for dqalloc.
- */
-#define XFS_QMOPT_INHERIT	0x1000000
-
-/*
- * flags to xfs_trans_mod_dquot.
- */
-#define XFS_TRANS_DQ_RES_BLKS	XFS_QMOPT_RES_REGBLKS
-#define XFS_TRANS_DQ_RES_RTBLKS	XFS_QMOPT_RES_RTBLKS
-#define XFS_TRANS_DQ_RES_INOS	XFS_QMOPT_RES_INOS
-#define XFS_TRANS_DQ_BCOUNT	XFS_QMOPT_BCOUNT
-#define XFS_TRANS_DQ_DELBCOUNT	XFS_QMOPT_DELBCOUNT
-#define XFS_TRANS_DQ_ICOUNT	XFS_QMOPT_ICOUNT
-#define XFS_TRANS_DQ_RTBCOUNT	XFS_QMOPT_RTBCOUNT
-#define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT
-
-
-#define XFS_QMOPT_QUOTALL	\
-		(XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA)
-#define XFS_QMOPT_RESBLK_MASK	(XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
+struct xfs_trans;
 
-#ifdef __KERNEL__
 /*
  * This check is done typically without holding the inode lock;
  * that may seem racy, but it is harmless in the context that it is used.
@@ -289,5 +162,4 @@ extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
 
 extern const struct xfs_buf_ops xfs_dquot_buf_ops;
 
-#endif	/* __KERNEL__ */
 #endif	/* __XFS_QUOTA_H__ */
fs/xfs/xfs_quota_defs.h new file +157 -0

157 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 26/50] xfs: consolidate xfs_utils.c

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

There are a few small helper functions in xfs_util, all related to xfs_inode modifications. Move them all to xfs_inode.c so all xfs_inode operations are consiolidated in the one place.

---
 fs/xfs/Makefile          |   1 -
 fs/xfs/xfs_error.c       |   1 -
 fs/xfs/xfs_filestream.c  |   1 -
 fs/xfs/xfs_inode.c       | 279 ++++++++++++++++++++++++++++++++++++++++-
 fs/xfs/xfs_inode.h       |   7 ++
 fs/xfs/xfs_inode_fork.c  |   1 -
 fs/xfs/xfs_ioctl.c       |   1 -
 fs/xfs/xfs_iomap.c       |   1 -
 fs/xfs/xfs_iops.c        |   1 -
 fs/xfs/xfs_log_recover.c |   1 -
 fs/xfs/xfs_mount.c       |   1 -
 fs/xfs/xfs_qm.c          |   1 -
 fs/xfs/xfs_qm_syscalls.c |   1 -
 fs/xfs/xfs_rtalloc.c     |   1 -
 fs/xfs/xfs_super.c       |   1 -
 fs/xfs/xfs_symlink.c     |   1 -
 fs/xfs/xfs_utils.c       | 316 -----------------------------------------------
 fs/xfs/xfs_utils.h       |  27 ----
 18 files changed, 285 insertions(+), 358 deletions(-)
 delete mode 100644 fs/xfs/xfs_utils.c
 delete mode 100644 fs/xfs/xfs_utils.h
fs/xfs/Makefile +0 -1
index e5a0758..201c61d 100644
@@ -53,7 +53,6 @@ xfs-y				+= xfs_aops.o \
 				   xfs_super.o \
 				   xfs_symlink.o \
 				   xfs_trans.o \
-				   xfs_utils.o \
 				   xfs_xattr.o \
 				   kmem.o \
 				   uuid.o
fs/xfs/xfs_error.c +0 -1
index 35d3f5b..1123d93f 100644
@@ -26,7 +26,6 @@
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
-#include "xfs_utils.h"
 #include "xfs_error.h"
 
 #ifdef DEBUG
fs/xfs/xfs_filestream.c +0 -1
index d0e8890..ce78e65 100644
@@ -28,7 +28,6 @@
 #include "xfs_bmap.h"
 #include "xfs_bmap_util.h"
 #include "xfs_alloc.h"
-#include "xfs_utils.h"
 #include "xfs_mru_cache.h"
 #include "xfs_filestream.h"
 #include "xfs_trace.h"
fs/xfs/xfs_inode.c +278 -1

291 lines not on this page · raw message

fs/xfs/xfs_inode.h +7 -0
index 2a63470..4a91358 100644
@@ -360,6 +360,13 @@ void		xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
 
 xfs_extlen_t	xfs_get_extsz_hint(struct xfs_inode *ip);
 
+int		xfs_dir_ialloc(struct xfs_trans **, struct xfs_inode *, umode_t,
+			       xfs_nlink_t, xfs_dev_t, prid_t, int,
+			       struct xfs_inode **, int *);
+int		xfs_droplink(struct xfs_trans *, struct xfs_inode *);
+int		xfs_bumplink(struct xfs_trans *, struct xfs_inode *);
+void		xfs_bump_ino_vers2(struct xfs_trans *, struct xfs_inode *);
+
 /* from xfs_file.c */
 int		xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
 int		xfs_iozero(struct xfs_inode *, loff_t, size_t);
fs/xfs/xfs_inode_fork.c +0 -1
index 3f9ff99..123971b 100644
@@ -40,7 +40,6 @@
 #include "xfs_ialloc.h"
 #include "xfs_bmap.h"
 #include "xfs_error.h"
-#include "xfs_utils.h"
 #include "xfs_quota.h"
 #include "xfs_filestream.h"
 #include "xfs_cksum.h"
fs/xfs/xfs_ioctl.c +0 -1
index ce636bf..557c7b8 100644
@@ -35,7 +35,6 @@
 #include "xfs_bmap.h"
 #include "xfs_bmap_util.h"
 #include "xfs_buf_item.h"
-#include "xfs_utils.h"
 #include "xfs_dfrag.h"
 #include "xfs_fsops.h"
 #include "xfs_discard.h"
fs/xfs/xfs_iomap.c +0 -1
index b04a60f..cf8f744 100644
@@ -40,7 +40,6 @@
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
 #include "xfs_trans_space.h"
-#include "xfs_utils.h"
 #include "xfs_iomap.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
fs/xfs/xfs_iops.c +0 -1
index e0cefd4..24be68d 100644
@@ -36,7 +36,6 @@
 #include "xfs_itable.h"
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
-#include "xfs_utils.h"
 #include "xfs_inode_item.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
fs/xfs/xfs_log_recover.c +0 -1
index 62ddae3..81c04eb 100644
@@ -41,7 +41,6 @@
 #include "xfs_extfree_item.h"
 #include "xfs_trans_priv.h"
 #include "xfs_quota.h"
-#include "xfs_utils.h"
 #include "xfs_cksum.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
fs/xfs/xfs_mount.c +0 -1
index 3b6fe4f..7a9986d 100644
@@ -42,7 +42,6 @@
 #include "xfs_error.h"
 #include "xfs_quota.h"
 #include "xfs_fsops.h"
-#include "xfs_utils.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
 #include "xfs_cksum.h"
fs/xfs/xfs_qm.c +0 -1
index 92c36ac..35a6f56 100644
@@ -38,7 +38,6 @@
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
 #include "xfs_trans_space.h"
-#include "xfs_utils.h"
 #include "xfs_qm.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
fs/xfs/xfs_qm_syscalls.c +0 -1
index 1851939..6fdccc3 100644
@@ -38,7 +38,6 @@
 #include "xfs_error.h"
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
-#include "xfs_utils.h"
 #include "xfs_qm.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
fs/xfs/xfs_rtalloc.c +0 -1
index 7a445e6..4822806 100644
@@ -35,7 +35,6 @@
 #include "xfs_error.h"
 #include "xfs_inode_item.h"
 #include "xfs_trans_space.h"
-#include "xfs_utils.h"
 #include "xfs_trace.h"
 #include "xfs_buf.h"
 #include "xfs_icache.h"
fs/xfs/xfs_super.c +0 -1
index 978a284..979a77d 100644
@@ -40,7 +40,6 @@
 #include "xfs_fsops.h"
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
-#include "xfs_utils.h"
 #include "xfs_log_priv.h"
 #include "xfs_trans_priv.h"
 #include "xfs_filestream.h"
fs/xfs/xfs_symlink.c +0 -1
index 1ce2756..e6facbf 100644
@@ -38,7 +38,6 @@
 #include "xfs_bmap_util.h"
 #include "xfs_error.h"
 #include "xfs_quota.h"
-#include "xfs_utils.h"
 #include "xfs_trans_space.h"
 #include "xfs_trace.h"
 #include "xfs_symlink.h"
fs/xfs/xfs_utils.c deleted +0 -316

316 lines not on this page · raw message

fs/xfs/xfs_utils.h deleted +0 -27
deleted file mode 100644
index 5eeab46..0000000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef __XFS_UTILS_H__
-#define __XFS_UTILS_H__
-
-extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, umode_t, xfs_nlink_t,
-				xfs_dev_t, prid_t, int, xfs_inode_t **, int *);
-extern int xfs_droplink(xfs_trans_t *, xfs_inode_t *);
-extern int xfs_bumplink(xfs_trans_t *, xfs_inode_t *);
-extern void xfs_bump_ino_vers2(xfs_trans_t *, xfs_inode_t *);
-
-#endif	/* __XFS_UTILS_H__ */
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 35/50] xfs: Introduce a new structure to hold transaction reservation items

In reply to Dave Chinner

From: Jie Liu <[email protected]>

Introduce a new structure xfs_trans_res to hold transaction reservation item info per log ticket.

We also need to improve xfs_trans_resv_calc() by initializing the log count as well as log flags for permanent log reservation.

---
 fs/xfs/xfs_mount.h      |   2 +-
 fs/xfs/xfs_trans.c      |   2 +-
 fs/xfs/xfs_trans_resv.c | 121 +++++++++++++++++++++++++++++++++++-----------
 fs/xfs/xfs_trans_resv.h | 125 ++++++++++++++++++++++++++----------------------
 4 files changed, 163 insertions(+), 87 deletions(-)
fs/xfs/xfs_mount.h +1 -1
index 829035f6..1fa0584 100644
@@ -136,7 +136,7 @@ typedef struct xfs_mount {
 	int			m_ialloc_blks;	/* blocks in inode allocation */
 	int			m_inoalign_mask;/* mask sb_inoalignmt if used */
 	uint			m_qflags;	/* quota status flags */
-	struct xfs_trans_resv	m_reservations;	/* precomputed res values */
+	struct xfs_trans_resv	m_resv;		/* precomputed res values */
 	__uint64_t		m_maxicount;	/* maximum inode count */
 	__uint64_t		m_resblks;	/* total reserved blocks */
 	__uint64_t		m_resblks_avail;/* available reserved blocks */
fs/xfs/xfs_trans.c +1 -1
index cc824eff..e0f93f9 100644
@@ -56,7 +56,7 @@ void
 xfs_trans_init(
 	struct xfs_mount	*mp)
 {
-	xfs_trans_resv_calc(mp, &mp->m_reservations);
+	xfs_trans_resv_calc(mp, &mp->m_resv);
 }
 
 /*
fs/xfs/xfs_trans_resv.c +93 -28

125 lines not on this page · raw message

fs/xfs/xfs_trans_resv.h +68 -57

142 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 27/50] xfs: consolidate extent swap code

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

So we don't need xfs_dfrag.h in userspace anymore, move the extent swap ioctl structure definition to xfs_fs.h where most of the other ioctl structure definitions are.

Now that we don't need separate files for extent swapping, separate the basic file descriptor checking code to xfs_ioctl.c, and the code that does the extent swap operation to xfs_bmap_util.c. This cleanly separates the user interface code from the physical mechanism used to do the extent swap.

---
 fs/xfs/Makefile        |   1 -
 fs/xfs/xfs_bmap_util.c | 343 ++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_bmap_util.h |   3 +
 fs/xfs/xfs_dfrag.c     | 459 -------------------------------------------------
 fs/xfs/xfs_dfrag.h     |  53 ------
 fs/xfs/xfs_fs.h        |  15 ++
 fs/xfs/xfs_ioctl.c     |  72 +++++++-
 fs/xfs/xfs_ioctl.h     |   4 +
 fs/xfs/xfs_ioctl32.c   |   3 +-
 9 files changed, 436 insertions(+), 517 deletions(-)
 delete mode 100644 fs/xfs/xfs_dfrag.c
 delete mode 100644 fs/xfs/xfs_dfrag.h
fs/xfs/Makefile +0 -1
index 201c61d..d6ccf57 100644
@@ -32,7 +32,6 @@ xfs-y				+= xfs_aops.o \
 				   xfs_bit.o \
 				   xfs_bmap_util.o \
 				   xfs_buf.o \
-				   xfs_dfrag.o \
 				   xfs_dir2_readdir.o \
 				   xfs_discard.o \
 				   xfs_error.o \
fs/xfs/xfs_bmap_util.c +343 -0

346 lines not on this page · raw message

fs/xfs/xfs_bmap_util.h +3 -0
index a6d2077..0612609 100644
@@ -102,6 +102,9 @@ bool	xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
 int	xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
 			   bool need_iolock);
 
+int	xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
+			 struct xfs_swapext *sx);
+
 xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
 
 #endif	/* __XFS_BMAP_UTIL_H__ */
fs/xfs/xfs_dfrag.c deleted +0 -459

459 lines not on this page · raw message

fs/xfs/xfs_dfrag.h deleted +0 -53

53 lines not on this page · raw message

fs/xfs/xfs_fs.h +15 -0
index 68c2e18..74b24b2 100644
@@ -461,6 +461,21 @@ typedef struct xfs_handle {
 				 + (handle).ha_fid.fid_len)
 
 /*
+ * Structure passed to XFS_IOC_SWAPEXT
+ */
+typedef struct xfs_swapext
+{
+	__int64_t	sx_version;	/* version */
+#define XFS_SX_VERSION		0
+	__int64_t	sx_fdtarget;	/* fd of target file */
+	__int64_t	sx_fdtmp;	/* fd of tmp file */
+	xfs_off_t	sx_offset;	/* offset into file */
+	xfs_off_t	sx_length;	/* leng from offset */
+	char		sx_pad[16];	/* pad space, unused */
+	xfs_bstat_t	sx_stat;	/* stat of target b4 copy */
+} xfs_swapext_t;
+
+/*
  * Flags for going down operation
  */
 #define XFS_FSOP_GOING_FLAGS_DEFAULT		0x0	/* going down */
fs/xfs/xfs_ioctl.c +70 -2

90 lines not on this page · raw message

fs/xfs/xfs_ioctl.h +4 -0
index 1233dee..77c02c7 100644
@@ -27,6 +27,10 @@ xfs_ioc_space(
 	unsigned int		cmd,
 	xfs_flock64_t		*bf);
 
+int
+xfs_ioc_swapext(
+	xfs_swapext_t	*sxp);
+
 extern int
 xfs_find_handle(
 	unsigned int		cmd,
fs/xfs/xfs_ioctl32.c +1 -2
index 55a3072..d3ab953 100644
@@ -33,7 +33,6 @@
 #include "xfs_inode.h"
 #include "xfs_itable.h"
 #include "xfs_error.h"
-#include "xfs_dfrag.h"
 #include "xfs_fsops.h"
 #include "xfs_alloc.h"
 #include "xfs_rtalloc.h"
@@ -643,7 +642,7 @@ xfs_file_compat_ioctl(
 		error = mnt_want_write_file(filp);
 		if (error)
 			return error;
-		error = xfs_swapext(&sxp);
+		error = xfs_ioc_swapext(&sxp);
 		mnt_drop_write_file(filp);
 		return -error;
 	}
Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 17/50] xfs: split out attribute listing code into separate file

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The attribute listing code is not used by userspace, so like the directory readdir code, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.

---
 fs/xfs/Makefile        |   1 +
 fs/xfs/xfs_attr.c      | 317 +-----------------------
 fs/xfs/xfs_attr.h      |   1 +
 fs/xfs/xfs_attr_leaf.c | 300 ----------------------
 fs/xfs/xfs_attr_list.c | 655 +++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 658 insertions(+), 616 deletions(-)
 create mode 100644 fs/xfs/xfs_attr_list.c
fs/xfs/Makefile +1 -0
index b6158af..94df3ec 100644
@@ -27,6 +27,7 @@ xfs-y				+= xfs_trace.o
 
 # highlevel code
 xfs-y				+= xfs_aops.o \
+				   xfs_attr_list.o \
 				   xfs_bit.o \
 				   xfs_buf.o \
 				   xfs_dfrag.o \
fs/xfs/xfs_attr.c +1 -316

350 lines not on this page · raw message

fs/xfs/xfs_attr.h +1 -0
index de8dd58..cb604b5 100644
@@ -141,5 +141,6 @@ typedef struct xfs_attr_list_context {
  */
 int xfs_attr_inactive(struct xfs_inode *dp);
 int xfs_attr_list_int(struct xfs_attr_list_context *);
+int xfs_inode_hasattr(struct xfs_inode *ip);
 
 #endif	/* __XFS_ATTR_H__ */
fs/xfs/xfs_attr_leaf.c +0 -300

312 lines not on this page · raw message

fs/xfs/xfs_attr_list.c new file +655 -0

655 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

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

***** SUSPECTED SPAM ***** [PATCH 24/50] xfs: kill xfs_vnodeops.[ch]

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Now we have xfs_inode.c for holding kernel-only XFS inode operations, move all the inode operations from xfs_vnodeops.c to this new file as it holds another set of kernel-only inode operations. The name of this file traces back to the days of Irix and it's vnodes which we don't have anymore.

Essentially this move consolidates the inode locking functions and a bunch of XFS inode operations into the one file. Eventually the high level functions will be merged into the VFS interface functions in xfs_iops.c.

This leaves only internal preallocation, EOF block manipulation and hole punching functions in vnodeops.c. Move these to xfs_bmap_util.c where we are already consolidating various in-kernel physical extent manipulation and querying functions.

---
 fs/xfs/Makefile         |    1 -
 fs/xfs/xfs_acl.c        |    1 -
 fs/xfs/xfs_aops.c       |    1 -
 fs/xfs/xfs_attr.c       |    1 -
 fs/xfs/xfs_attr.h       |    8 +
 fs/xfs/xfs_bmap.c       |    1 -
 fs/xfs/xfs_bmap_util.c  |  861 ++++++++++++++++++++++
 fs/xfs/xfs_bmap_util.h  |   11 +
 fs/xfs/xfs_dfrag.c      |    1 -
 fs/xfs/xfs_dir2.c       |    1 -
 fs/xfs/xfs_dir2.h       |    6 -
 fs/xfs/xfs_dir2_priv.h  |    6 +
 fs/xfs/xfs_export.c     |    1 -
 fs/xfs/xfs_file.c       |    3 +-
 fs/xfs/xfs_icache.c     |    2 +-
 fs/xfs/xfs_inode.c      | 1004 ++++++++++++++++++++++++-
 fs/xfs/xfs_inode.h      |   23 +-
 fs/xfs/xfs_inode_buf.h  |    1 -
 fs/xfs/xfs_inode_fork.c |    1 -
 fs/xfs/xfs_ioctl.c      |   36 +-
 fs/xfs/xfs_ioctl.h      |    6 +
 fs/xfs/xfs_ioctl32.c    |    1 -
 fs/xfs/xfs_iops.c       |    2 +-
 fs/xfs/xfs_iops.h       |   13 +
 fs/xfs/xfs_rename.c     |    1 -
 fs/xfs/xfs_super.c      |    1 -
 fs/xfs/xfs_vnodeops.c   | 1872 -----------------------------------------------
 fs/xfs/xfs_vnodeops.h   |   55 --
 fs/xfs/xfs_xattr.c      |    1 -
 29 files changed, 1931 insertions(+), 1991 deletions(-)
 delete mode 100644 fs/xfs/xfs_vnodeops.c
 delete mode 100644 fs/xfs/xfs_vnodeops.h
fs/xfs/Makefile +0 -1
index dcd21b9..8691dba 100644
@@ -55,7 +55,6 @@ xfs-y				+= xfs_aops.o \
 				   xfs_symlink.o \
 				   xfs_trans.o \
 				   xfs_utils.o \
-				   xfs_vnodeops.o \
 				   xfs_xattr.o \
 				   kmem.o \
 				   uuid.o
fs/xfs/xfs_acl.c +0 -1
index 150c670..0c4368a 100644
@@ -22,7 +22,6 @@
 #include "xfs_attr.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_inode.h"
-#include "xfs_vnodeops.h"
 #include "xfs_sb.h"
 #include "xfs_mount.h"
 #include "xfs_trace.h"
fs/xfs/xfs_aops.c +0 -1
index 709347d..a82c837 100644
@@ -28,7 +28,6 @@
 #include "xfs_alloc.h"
 #include "xfs_error.h"
 #include "xfs_iomap.h"
-#include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 #include "xfs_bmap.h"
 #include "xfs_bmap_util.h"
fs/xfs/xfs_attr.c +0 -1
index 91acc38..046cf3d 100644
@@ -40,7 +40,6 @@
 #include "xfs_error.h"
 #include "xfs_quota.h"
 #include "xfs_trans_space.h"
-#include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
 /*
fs/xfs/xfs_attr.h +8 -0
index cb604b5..dd48245 100644
@@ -142,5 +142,13 @@ typedef struct xfs_attr_list_context {
 int xfs_attr_inactive(struct xfs_inode *dp);
 int xfs_attr_list_int(struct xfs_attr_list_context *);
 int xfs_inode_hasattr(struct xfs_inode *ip);
+int xfs_attr_get(struct xfs_inode *ip, const unsigned char *name,
+		 unsigned char *value, int *valuelenp, int flags);
+int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name,
+		 unsigned char *value, int valuelen, int flags);
+int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags);
+int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
+		  int flags, struct attrlist_cursor_kern *cursor);
+
 
 #endif	/* __XFS_ATTR_H__ */
fs/xfs/xfs_bmap.c +0 -1
index a9331a6..51e07e7 100644
@@ -48,7 +48,6 @@
 #include "xfs_trans_space.h"
 #include "xfs_buf_item.h"
 #include "xfs_filestream.h"
-#include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 #include "xfs_symlink.h"
 
fs/xfs/xfs_bmap_util.c +861 -0

875 lines not on this page · raw message

fs/xfs/xfs_bmap_util.h +11 -0
index 004fe4b..a6d2077 100644
@@ -21,6 +21,7 @@
 /* Kernel only BMAP related definitions and functions */
 
 struct xfs_bmbt_irec;
+struct xfs_bmap_free_item;
 struct xfs_ifork;
 struct xfs_inode;
 struct xfs_mount;
@@ -91,6 +92,16 @@ int	xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip,
 			     int whichfork, struct xfs_bmbt_irec *rec,
 			     int *is_empty);
 
+/* preallocation and hole punch interface */
+int	xfs_change_file_space(struct xfs_inode *ip, int cmd,
+			      xfs_flock64_t *bf, xfs_off_t offset,
+			      int attr_flags);
+
+/* EOF block manipulation functions */
+bool	xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
+int	xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
+			   bool need_iolock);
+
 xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
 
 #endif	/* __XFS_BMAP_UTIL_H__ */
fs/xfs/xfs_dfrag.c +0 -1
index 815dace..b83d45f 100644
@@ -35,7 +35,6 @@
 #include "xfs_itable.h"
 #include "xfs_dfrag.h"
 #include "xfs_error.h"
-#include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
 
fs/xfs/xfs_dir2.c +0 -1
index c3263a5..841933c 100644
@@ -35,7 +35,6 @@
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
-#include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
 struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2};
fs/xfs/xfs_dir2.h +0 -6
index 7ef6b0f..7fe2b8f 100644
@@ -63,12 +63,6 @@ extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
 extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
 
 /*
- * Direct call on directory open, before entering the readdir code.
- */
-extern int xfs_dir3_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp,
-		xfs_dablk_t bno, xfs_daddr_t mapped_bno);
-
-/*
  * Interface routines used by userspace utilities
  */
 extern xfs_ino_t xfs_dir2_sf_get_parent_ino(struct xfs_dir2_sf_hdr *sfp);
fs/xfs/xfs_dir2_priv.h +6 -0
index 807eb65..6d2a99c2 100644
@@ -45,6 +45,8 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
 extern int __xfs_dir3_data_check(struct xfs_inode *dp, struct xfs_buf *bp);
 extern int xfs_dir3_data_read(struct xfs_trans *tp, struct xfs_inode *dp,
 		xfs_dablk_t bno, xfs_daddr_t mapped_bno, struct xfs_buf **bpp);
+extern int xfs_dir3_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp,
+		xfs_dablk_t bno, xfs_daddr_t mapped_bno);
 
 extern struct xfs_dir2_data_free *
 xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr,
@@ -124,4 +126,8 @@ extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);
 extern int xfs_dir2_sf_removename(struct xfs_da_args *args);
 extern int xfs_dir2_sf_replace(struct xfs_da_args *args);
 
+/* xfs_dir2_readdir.c */
+extern int xfs_readdir(struct xfs_inode *dp, struct dir_context *ctx,
+		       size_t bufsize);
+
 #endif /* __XFS_DIR2_PRIV_H__ */
fs/xfs/xfs_export.c +0 -1
index 29c880f..066df42 100644
@@ -26,7 +26,6 @@
 #include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_export.h"
-#include "xfs_vnodeops.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
fs/xfs/xfs_file.c +2 -1
index 1ba3c79..4c749ab 100644
@@ -28,11 +28,12 @@
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
+#include "xfs_bmap_util.h"
 #include "xfs_error.h"
-#include "xfs_vnodeops.h"
 #include "xfs_da_btree.h"
 #include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
 #include "xfs_ioctl.h"
 #include "xfs_trace.h"
 
fs/xfs/xfs_icache.c +1 -1
index d9a4167..2abc945 100644
@@ -32,12 +32,12 @@
 #include "xfs_dinode.h"
 #include "xfs_error.h"
 #include "xfs_filestream.h"
-#include "xfs_vnodeops.h"
 #include "xfs_inode_item.h"
 #include "xfs_quota.h"
 #include "xfs_trace.h"
 #include "xfs_fsops.h"
 #include "xfs_icache.h"
+#include "xfs_bmap_util.h"
 
 #include <linux/kthread.h>
 #include <linux/freezer.h>
fs/xfs/xfs_inode.c +967 -37

1,060 lines not on this page · raw message

fs/xfs/xfs_inode.h +20 -3
index 8f775ed..2a63470 100644
@@ -315,9 +315,21 @@ static inline int xfs_isiflocked(struct xfs_inode *ip)
 	 ((pip)->i_d.di_mode & S_ISGID))
 
 
-/*
- * xfs_inode.c prototypes.
- */
+int		xfs_release(struct xfs_inode *ip);
+int		xfs_inactive(struct xfs_inode *ip);
+int		xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
+			   struct xfs_inode **ipp, struct xfs_name *ci_name);
+int		xfs_create(struct xfs_inode *dp, struct xfs_name *name,
+			   umode_t mode, xfs_dev_t rdev, struct xfs_inode **ipp);
+int		xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
+			   struct xfs_inode *ip);
+int		xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
+			 struct xfs_name *target_name);
+int		xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name,
+			   struct xfs_inode *src_ip, struct xfs_inode *target_dp,
+			   struct xfs_name *target_name,
+			   struct xfs_inode *target_ip);
+
 void		xfs_ilock(xfs_inode_t *, uint);
 int		xfs_ilock_nowait(xfs_inode_t *, uint);
 void		xfs_iunlock(xfs_inode_t *, uint);
@@ -348,6 +360,11 @@ void		xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
 
 xfs_extlen_t	xfs_get_extsz_hint(struct xfs_inode *ip);
 
+/* from xfs_file.c */
+int		xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
+int		xfs_iozero(struct xfs_inode *, loff_t, size_t);
+
+
 #define IHOLD(ip) \
 do { \
 	ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
fs/xfs/xfs_inode_buf.h +0 -1
index b5f1e22..aae9fc4 100644
@@ -40,7 +40,6 @@ int		xfs_iread(struct xfs_mount *, struct xfs_trans *,
 void		xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *);
 void		xfs_dinode_to_disk(struct xfs_dinode *,
 				   struct xfs_icdinode *);
-bool		xfs_can_free_eofblocks(struct xfs_inode *, bool);
 
 #if defined(DEBUG)
 void		xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
fs/xfs/xfs_inode_fork.c +0 -1
index f06570b..3f9ff99 100644
@@ -43,7 +43,6 @@
 #include "xfs_utils.h"
 #include "xfs_quota.h"
 #include "xfs_filestream.h"
-#include "xfs_vnodeops.h"
 #include "xfs_cksum.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
fs/xfs/xfs_ioctl.c +35 -1
index 7c27538..ce636bf 100644
@@ -38,13 +38,13 @@
 #include "xfs_utils.h"
 #include "xfs_dfrag.h"
 #include "xfs_fsops.h"
-#include "xfs_vnodeops.h"
 #include "xfs_discard.h"
 #include "xfs_quota.h"
 #include "xfs_inode_item.h"
 #include "xfs_export.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
+#include "xfs_symlink.h"
 
 #include <linux/capability.h>
 #include <linux/dcache.h>
@@ -352,6 +352,40 @@ xfs_readlink_by_handle(
 	return error;
 }
 
+int
+xfs_set_dmattrs(
+	xfs_inode_t     *ip,
+	u_int		evmask,
+	u_int16_t	state)
+{
+	xfs_mount_t	*mp = ip->i_mount;
+	xfs_trans_t	*tp;
+	int		error;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return XFS_ERROR(EPERM);
+
+	if (XFS_FORCED_SHUTDOWN(mp))
+		return XFS_ERROR(EIO);
+
+	tp = xfs_trans_alloc(mp, XFS_TRANS_SET_DMATTRS);
+	error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES (mp), 0, 0, 0);
+	if (error) {
+		xfs_trans_cancel(tp, 0);
+		return error;
+	}
+	xfs_ilock(ip, XFS_ILOCK_EXCL);
+	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
+
+	ip->i_d.di_dmevmask = evmask;
+	ip->i_d.di_dmstate  = state;
+
+	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+	error = xfs_trans_commit(tp, 0);
+
+	return error;
+}
+
 STATIC int
 xfs_fssetdm_by_handle(
 	struct file		*parfilp,
fs/xfs/xfs_ioctl.h +6 -0
index d56173b..1233dee 100644
@@ -82,4 +82,10 @@ xfs_file_compat_ioctl(
 	unsigned int		cmd,
 	unsigned long		arg);
 
+extern int
+xfs_set_dmattrs(
+	struct xfs_inode	*ip,
+	u_int			evmask,
+	u_int16_t		state);
+
 #endif
fs/xfs/xfs_ioctl32.c +0 -1
index c0c6625..55a3072 100644
@@ -34,7 +34,6 @@
 #include "xfs_itable.h"
 #include "xfs_error.h"
 #include "xfs_dfrag.h"
-#include "xfs_vnodeops.h"
 #include "xfs_fsops.h"
 #include "xfs_alloc.h"
 #include "xfs_rtalloc.h"
fs/xfs/xfs_iops.c +1 -1
index 17b70f0..e0cefd4 100644
@@ -37,10 +37,10 @@
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
 #include "xfs_utils.h"
-#include "xfs_vnodeops.h"
 #include "xfs_inode_item.h"
 #include "xfs_trace.h"
 #include "xfs_icache.h"
+#include "xfs_symlink.h"
 
 #include <linux/capability.h>
 #include <linux/xattr.h>
fs/xfs/xfs_iops.h +13 -0
index ef41c92..d81fb41 100644
@@ -27,4 +27,17 @@ extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size);
 
 extern void xfs_setup_inode(struct xfs_inode *);
 
+/*
+ * Internal setattr interfaces.
+ */
+#define	XFS_ATTR_DMI		0x01	/* invocation from a DMI function */
+#define	XFS_ATTR_NONBLOCK	0x02	/* return EAGAIN if op would block */
+#define XFS_ATTR_NOLOCK		0x04	/* Don't grab any conflicting locks */
+#define XFS_ATTR_NOACL		0x08	/* Don't call xfs_acl_chmod */
+#define XFS_ATTR_SYNC		0x10	/* synchronous operation required */
+
+extern int xfs_setattr_nonsize(struct xfs_inode *ip, struct iattr *vap,
+			       int flags);
+extern int xfs_setattr_size(struct xfs_inode *ip, struct iattr *vap, int flags);
+
 #endif /* __XFS_IOPS_H__ */
fs/xfs/xfs_rename.c +0 -1
index 68cb725..c15c6c5 100644
@@ -36,7 +36,6 @@
 #include "xfs_quota.h"
 #include "xfs_utils.h"
 #include "xfs_trans_space.h"
-#include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
 
fs/xfs/xfs_super.c +0 -1
index aefc004..978a284 100644
@@ -41,7 +41,6 @@
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
 #include "xfs_utils.h"
-#include "xfs_vnodeops.h"
 #include "xfs_log_priv.h"
 #include "xfs_trans_priv.h"
 #include "xfs_filestream.h"
fs/xfs/xfs_vnodeops.c deleted +0 -1872

757 lines not on this page · raw message

fs/xfs/xfs_vnodeops.h deleted +0 -55

55 lines not on this page · raw message

fs/xfs/xfs_xattr.c +0 -1
index b7311aa..e01f35e 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.8.3.2

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

Part of the diff is not shown here. View the raw message.

#64 lore raw

***** SUSPECTED SPAM ***** [PATCH 12/50] xfs: move inode fork definitions to a new header file

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from xfs_inode.h.

Do the same for the all the C code that currently resides in xfs_inode.c for the same reason.

---
 fs/xfs/Makefile         |    1 +
 fs/xfs/xfs_inode.c      | 1940 +----------------------------------------------
 fs/xfs/xfs_inode.h      |  134 +---
 fs/xfs/xfs_inode_fork.c | 1921 ++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_inode_fork.h |  171 +++++
 5 files changed, 2128 insertions(+), 2039 deletions(-)
 create mode 100644 fs/xfs/xfs_inode_fork.c
 create mode 100644 fs/xfs/xfs_inode_fork.h
fs/xfs/Makefile +1 -0
index dc72b6b..ce0b87e 100644
@@ -74,6 +74,7 @@ xfs-y				+= xfs_alloc.o \
 				   xfs_ialloc_btree.o \
 				   xfs_icreate_item.o \
 				   xfs_inode.o \
+				   xfs_inode_fork.o \
 				   xfs_log_recover.o \
 				   xfs_mount.o \
 				   xfs_symlink.o \
fs/xfs/xfs_inode.c +34 -1906

2,007 lines not on this page · raw message

fs/xfs/xfs_inode.h +1 -133

158 lines not on this page · raw message

fs/xfs/xfs_inode_fork.c new file +1921 -0

828 lines not on this page · raw message

fs/xfs/xfs_inode_fork.h new file +171 -0

171 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.8.3.2

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

Part of the diff is not shown here. View the raw message.

#65 lore raw
In reply to Dave Chinner
Quoted 17 lines · Dave Chinner

Hi folks,

This is a rebase of the reviewed series of kernel patches I recently posted here:

http://oss.sgi.com/pipermail/xfs/2013-July/028207.html

It addresses all the review comments except for one from Christoph about the IOP_SIZE removal - I'll send a followup patch in a couple of days to remove all the rest of IOP_ macros...

The log space problems from the optimisations have been fixed - the fix went into patch 44 of this series, and cascaded through 45 and 46 as well. Those patches will need reviewing. The problematic workload has been running for 16 hours here without failure on a small (10MB) log, so AFAICT the problem is fixed.

Quoted 3 lines

There is one new patch - the fix to the use-after-free of clean buffer items when a transaction is cancelled - and that is at the end of the series.

Pulled in patches 1 through 42.

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

#66 lore raw
Quoted 18 lines · Ben Myers
Quoted 17 lines · Dave Chinner

Hi folks,

This is a rebase of the reviewed series of kernel patches I recently posted here:

http://oss.sgi.com/pipermail/xfs/2013-July/028207.html

It addresses all the review comments except for one from Christoph about the IOP_SIZE removal - I'll send a followup patch in a couple of days to remove all the rest of IOP_ macros...

The log space problems from the optimisations have been fixed - the fix went into patch 44 of this series, and cascaded through 45 and 46 as well. Those patches will need reviewing. The problematic workload has been running for 16 hours here without failure on a small (10MB) log, so AFAICT the problem is fixed.

Quoted 5 lines
Quoted 3 lines

There is one new patch - the fix to the use-after-free of clean buffer items when a transaction is cancelled - and that is at the end of the series.

Pulled in patches 1 through 42.

Pulled in 43 through 47.

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

#67 lore raw

[PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

In reply to Dave Chinner

Add XFS 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.

---
 fs/xfs/xfs_sb.h |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
fs/xfs/xfs_sb.h +7 -3
Index: b/fs/xfs/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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#68 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

On 8/19/13 3:19 PM, Mark Tinguely wrote:

<an attachment that doesn't show up on reply, moving d_type support to v4 superblocks ;) >

Thanks, Mark!

Has you been able to test this at all?

I do still owe a promised xfstest - but for that, we'll need at least mkfs & xfs_repair support.

Did you patch up mkfs to do basic tests of your kernelspace patch?

Talking to Dave, he reminds me of a few things this needs, if it's going to be complete & compatible on V4:

* mkfs.xfs commandline option support & manpage updates
* xfs_db support (including version friendly-text output)
* XFS_IOC_FSGEOM support so that xfs_info can report the difference
* xfs_repair needs to know that it's a valid feature on V4

Some of that may overlap w/ things still needed on V5, but some is unique to allowing it on V4.

Mark, do you plan to do some of those unique-to-V4 parts, too?

As an aside: I would support getting this feature onto V4 superblocks, after we have confidence that all the bits are done, tested, and robust.

I still would really like to see it go forward in parallel on V5, and not be blocked by the extra work needed for proper V4 integration.

Thanks,
-Eric

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

#69 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Quoted 7 lines · Eric Sandeen

On 8/19/13 3:19 PM, Mark Tinguely wrote:

<an attachment that doesn't show up on reply, moving d_type support to v4 superblocks ;)>

Thanks, Mark!

Has you been able to test this at all?

There is no test for this feature. Yes I did my version of testing. First adding each type of inode type and verifying it. Then fsstress testing using the same seed for sb v4+feature, v4 plain, v5+feature. The resulting directory and checked with xfs_db. fsstress was chosen because how it manipulate directory items.

Quoted 4 lines

I do still owe a promised xfstest - but for that, we'll need at least mkfs & xfs_repair support.

Dave made changes so that xfs_repair will run (find the correct directory items) but the feature verification and repairs has not been done, so technically this is an incomplete feature.

Quoted 1 line

Did you patch up mkfs to do basic tests of your kernelspace patch?

yes. to the directory area in mkfs per suggestion.

The tests run the same on the v5 and v4 - ummm, it is the same directory code. see above.

Quoted 5 lines

Talking to Dave, he reminds me of a few things this needs, if it's going to be complete& compatible on V4:

* mkfs.xfs commandline option support& manpage updates

yes

Quoted 1 line

* xfs_db support (including version friendly-text output)

yes, xfsprogs v4/v5 uses the same directory code, Dave's patches support xfs_db. It works for v4/v5.

Quoted 2 lines

* XFS_IOC_FSGEOM support so that xfs_info can report the difference
* xfs_repair needs to know that it's a valid feature on V4

okay, it will run xfs_repair to the same level as v5. AND ...As pointed out, there is no xfs_repair support to verify/correct the feature in v5 and therefore v4 - (again it is the same directory code). As is, this feature is incomplete. That could keep the kernel portion from moving forward.

Quoted 4 lines

Some of that may overlap w/ things still needed on V5, but some is unique to allowing it on V4.

Mark, do you plan to do some of those unique-to-V4 parts, too?

Yes.

Quoted 7 lines

As an aside: I would support getting this feature onto V4 superblocks, after we have confidence that all the bits are done, tested, and robust.

I still would really like to see it go forward in parallel on V5, and not be blocked by the extra work needed for proper V4 integration.

understood - now documented. Hi Linus.

This feature uses shared directory code. It has to be turned on using a mkfs to be used. No one will accidentally get this feature.

The feature and implementation are good. The directory code is common - the feature added changes to that directory code. If the implementation is bad it will trash the v4/v5 directories the same - no matter if the feature is turned on or off. If you are so afraid of the common code may break any directories, then this feature should be held back for more testing.

All that I insist is this nice feature be added to the mainstream filesystem at the same time as the experimental filesystem. There is NO TECHNICAL reason that this feature is not supported mainstream filesystem.

I repeat, if you have technical concerns for the feature's implementation and its impact on v4 filesystems because it uses common directory code, then it should be held back for more testing.

Quoted 2 lines

Thanks,
-Eric

--Mark.

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

#70 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Quoted 9 lines · Mark Tinguely
Quoted 8 lines · Eric Sandeen

On 8/19/13 3:19 PM, Mark Tinguely wrote:

<an attachment that doesn't show up on reply, moving d_type support to v4 superblocks ;)>

Thanks, Mark!

Has you been able to test this at all?

Hi Mark -

Quoted 1 line

There is no test for this feature.

no xfstest, I know. :)

Quoted 7 lines

Yes I did my version of testing.
First adding each type of inode type and verifying it. Then fsstress testing using the same seed for sb v4+feature, v4 plain, v5+feature. The resulting directory and checked with xfs_db. fsstress was chosen because how it manipulate directory items.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I do still owe a promised xfstest - but for that, we'll need at least mkfs & xfs_repair support.

Dave made changes so that xfs_repair will run (find the correct directory items) but the feature verification and repairs has not been done, so technically this is an incomplete feature.

Right, but Dave's patches only recognize it as a valid feature on V5 superblocks; V4 will take a bit more logic, won't it? Won't repair see this as an invalid feature flag on V4 even with Dave's patches?

Quoted 11 lines
Quoted 1 line

Did you patch up mkfs to do basic tests of your kernelspace patch?

yes. to the directory area in mkfs per suggestion.

The tests run the same on the v5 and v4 - ummm, it is the same directory code. see above.

Quoted 4 lines

Talking to Dave, he reminds me of a few things this needs, if it's going to be complete& compatible on V4:

Quoted 8 lines
Quoted 1 line

* mkfs.xfs commandline option support& manpage updates

yes

Quoted 1 line

* xfs_db support (including version friendly-text output)

yes, xfsprogs v4/v5 uses the same directory code, Dave's patches support xfs_db. It works for v4/v5.

ok

Quoted 11 lines
Quoted 4 lines

* XFS_IOC_FSGEOM support so that xfs_info can report the difference * xfs_repair needs to know that it's a valid feature on V4

okay, it will run xfs_repair to the same level as v5. AND ...As pointed out, there is no xfs_repair support to verify/correct the feature in v5 and therefore v4 - (again it is the same directory code). As is, this feature is incomplete. That could keep the kernel portion from moving forward.

Quoted 6 lines
Quoted 4 lines

Some of that may overlap w/ things still needed on V5, but some is unique to allowing it on V4.

Mark, do you plan to do some of those unique-to-V4 parts, too?

Yes.

Ok, cool.

Quoted 11 lines
Quoted 9 lines

As an aside: I would support getting this feature onto V4 superblocks, after we have confidence that all the bits are done, tested, and robust.

I still would really like to see it go forward in parallel on V5, and not be blocked by the extra work needed for proper V4 integration.

understood - now documented. Hi Linus.

I'm Eric ;)

Quoted 9 lines

This feature uses shared directory code. It has to be turned on using a mkfs to be used. No one will accidentally get this feature.

The feature and implementation are good. The directory code is common
- the feature added changes to that directory code. If the implementation is bad it will trash the v4/v5 directories the same - no matter if the feature is turned on or off. If you are so afraid of the common code may break any directories, then this feature should be held back for more testing.

I'm not overly fearful...

Quoted 4 lines

All that I insist is this nice feature be added to the mainstream filesystem at the same time as the experimental filesystem. There is NO TECHNICAL reason that this feature is not supported mainstream filesystem.

No, not technical... (although, there is also no technical reason that V4 and V5 must go in at the same time, so we're into the realm of opinion & preference here)

One reason I'd argue for V5 potentially prior to V4 is that V4 requires a few more code changes over and above V5. If those V4 changes lag, it it might make sense to separate them. If they don't lag, great.

Quoted 3 lines

I repeat, if you have technical concerns for the feature's implementation and its impact on v4 filesystems because it uses common directory code, then it should be held back for more testing.

I'm not trying to pick a fight. I just want to make sure that all the new work unique to having it on V4 is identified & owned...

Thanks,
-Eric

Quoted 4 lines
Quoted 1 line

Thanks, -Eric

--Mark.

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

#71 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Eric,

Quoted 28 lines · Eric Sandeen
Quoted 9 lines · Mark Tinguely
Quoted 8 lines · Eric Sandeen

On 8/19/13 3:19 PM, Mark Tinguely wrote:

<an attachment that doesn't show up on reply, moving d_type support to v4 superblocks ;)>

Thanks, Mark!

Has you been able to test this at all?

Hi Mark -

Quoted 1 line

There is no test for this feature.

no xfstest, I know. :)

Quoted 11 lines

Yes I did my version of testing.
First adding each type of inode type and verifying it. Then fsstress testing using the same seed for sb v4+feature, v4 plain, v5+feature. The resulting directory and checked with xfs_db. fsstress was chosen because how it manipulate directory items.

Quoted 4 lines

I do still owe a promised xfstest - but for that, we'll need at least mkfs & xfs_repair support.

Quoted 8 lines
Quoted 3 lines

Dave made changes so that xfs_repair will run (find the correct directory items) but the feature verification and repairs has not been done, so technically this is an incomplete feature.

Right, but Dave's patches only recognize it as a valid feature on V5 superblocks; V4 will take a bit more logic, won't it? Won't repair see this as an invalid feature flag on V4 even with Dave's patches?

That's a good point. I have not looked at Mark's patch to see if this has been done. Mark?

Quoted 47 lines
Quoted 11 lines
Quoted 1 line

Did you patch up mkfs to do basic tests of your kernelspace patch?

yes. to the directory area in mkfs per suggestion.

The tests run the same on the v5 and v4 - ummm, it is the same directory code. see above.

Quoted 4 lines

Talking to Dave, he reminds me of a few things this needs, if it's going to be complete& compatible on V4:

Quoted 8 lines
Quoted 1 line

* mkfs.xfs commandline option support& manpage updates

yes

Quoted 1 line

* xfs_db support (including version friendly-text output)

yes, xfsprogs v4/v5 uses the same directory code, Dave's patches support xfs_db. It works for v4/v5.

ok

Quoted 11 lines
Quoted 4 lines

* XFS_IOC_FSGEOM support so that xfs_info can report the difference * xfs_repair needs to know that it's a valid feature on V4

okay, it will run xfs_repair to the same level as v5. AND ...As pointed out, there is no xfs_repair support to verify/correct the feature in v5 and therefore v4 - (again it is the same directory code). As is, this feature is incomplete. That could keep the kernel portion from moving forward.

Quoted 6 lines
Quoted 4 lines

Some of that may overlap w/ things still needed on V5, but some is unique to allowing it on V4.

Mark, do you plan to do some of those unique-to-V4 parts, too?

Yes.

Ok, cool.

Quoted 5 lines
Quoted 5 lines

As an aside: I would support getting this feature onto V4 superblocks, after we have confidence that all the bits are done, tested, and robust.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I still would really like to see it go forward in parallel on V5, and not be blocked by the extra work needed for proper V4 integration.

understood - now documented. Hi Linus.

I'm Eric ;)

;)

Quoted 12 lines
Quoted 9 lines

This feature uses shared directory code. It has to be turned on using a mkfs to be used. No one will accidentally get this feature.

The feature and implementation are good. The directory code is common
- the feature added changes to that directory code. If the implementation is bad it will trash the v4/v5 directories the same - no matter if the feature is turned on or off. If you are so afraid of the common code may break any directories, then this feature should be held back for more testing.

I'm not overly fearful...

Quoted 8 lines
Quoted 4 lines

All that I insist is this nice feature be added to the mainstream filesystem at the same time as the experimental filesystem. There is NO TECHNICAL reason that this feature is not supported mainstream filesystem.

No, not technical... (although, there is also no technical reason that V4 and V5 must go in at the same time, so we're into the realm of opinion & preference here)

IMO if this were clearly related to the v5 super block features we could soften the line regarding whether it must be finished before it goes in. But it seems not to be directly related.

Quoted 3 lines

One reason I'd argue for V5 potentially prior to V4 is that V4 requires a few more code changes over and above V5. If those V4 changes lag, it it might make sense to separate them. If they don't lag, great.

As I mentioned on the call last week, I am sympathetic to this viewpoint. Having said that... I also think Mark and Geoffrey also have a good point in saying that since this isn't a v5 feature it's not experimental code, and it needs to be completed before we pull it in, and this should include the v4 implementation.

Seems like we haven't seen the completion of the v5 version of this code at this point, so the argument of whether v4 should gate it for 3.12 is kind of moot. I do prefer that they go in together, not being an experimental feature... and it would be nice if we can make that happen in 3.12.

Quoted 5 lines
Quoted 3 lines

I repeat, if you have technical concerns for the feature's implementation and its impact on v4 filesystems because it uses common directory code, then it should be held back for more testing.

I'm not trying to pick a fight.

Thanks. If we can have such minor disagreements without resorting to badmouthing myself as maintainer and the rest of the SGI team on the list I really do appreciate it. Our people are well intentioned, want to help, and they deserve better. As do the rest of the contributors.

Quoted 2 lines

I just want to make sure that all
the new work unique to having it on V4 is identified & owned...

Good plan. I think Mark needs to look at the xfs_repair issue you mentioned. Sounds like xfs_db already works.

Thanks,
Ben

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

#72 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Quoted 35 lines · Ben Myers

Eric,

Quoted 32 lines · Eric Sandeen
Quoted 9 lines · Mark Tinguely
Quoted 8 lines · Eric Sandeen

On 8/19/13 3:19 PM, Mark Tinguely wrote:

<an attachment that doesn't show up on reply, moving d_type support to v4 superblocks ;)>

Thanks, Mark!

Has you been able to test this at all?

Hi Mark -

Quoted 1 line

There is no test for this feature.

no xfstest, I know. :)

Quoted 14 lines

Yes I did my version of testing.
First adding each type of inode type and verifying it. Then fsstress testing using the same seed for sb v4+feature, v4 plain, v5+feature. The resulting directory and checked with xfs_db. fsstress was chosen because how it manipulate directory items.

Quoted 4 lines

I do still owe a promised xfstest - but for that, we'll need at
least mkfs& xfs_repair support.

Dave made changes so that xfs_repair will run (find the correct directory items) but the feature verification and repairs has not been done, so technically this is an incomplete feature.

Quoted 7 lines
Quoted 4 lines

Right, but Dave's patches only recognize it as a valid feature on V5 superblocks; V4 will take a bit more logic, won't it? Won't repair see this as an invalid feature flag on V4 even with Dave's patches?

That's a good point. I have not looked at Mark's patch to see if this has been done. Mark?

The user and kernel space share the code for feature compatibility check code. Does the code support the feature ....

... Yes, Dave made the changes so that xfs_repair works with feature turned off or on.

Are you sure...

... Yes, the repair xfstests work the same for v4 feature on or off.

Quoted 103 lines
Quoted 48 lines
Quoted 12 lines
Quoted 2 lines

Did you patch up mkfs to do basic tests of your kernelspace patch?

yes. to the directory area in mkfs per suggestion.

The tests run the same on the v5 and v4 - ummm, it is the same directory code. see above.

Quoted 4 lines

Talking to Dave, he reminds me of a few things this needs, if it's
going to be complete& compatible on V4:

Quoted 8 lines
Quoted 1 line

* mkfs.xfs commandline option support& manpage updates

yes

Quoted 1 line

* xfs_db support (including version friendly-text output)

yes, xfsprogs v4/v5 uses the same directory code, Dave's patches support xfs_db. It works for v4/v5.

ok

Quoted 11 lines
Quoted 4 lines

* XFS_IOC_FSGEOM support so that xfs_info can report the difference * xfs_repair needs to know that it's a valid feature on V4

okay, it will run xfs_repair to the same level as v5. AND ...As pointed out, there is no xfs_repair support to verify/correct the feature in v5 and therefore v4 - (again it is the same directory code). As is, this feature is incomplete. That could keep the kernel portion from moving forward.

Quoted 6 lines
Quoted 4 lines

Some of that may overlap w/ things still needed on V5, but some is unique to allowing it on V4.

Mark, do you plan to do some of those unique-to-V4 parts, too?

Yes.

Ok, cool.

Quoted 5 lines
Quoted 5 lines

As an aside: I would support getting this feature onto V4 superblocks, after we have confidence that all the bits are done, tested, and robust.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I still would really like to see it go forward in parallel on V5, and not be blocked by the extra work needed for proper V4 integration.

understood - now documented. Hi Linus.

I'm Eric ;)

;)

Quoted 12 lines
Quoted 9 lines

This feature uses shared directory code. It has to be turned on using a mkfs to be used. No one will accidentally get this feature.

The feature and implementation are good. The directory code is common
- the feature added changes to that directory code. If the implementation is bad it will trash the v4/v5 directories the same - no matter if the feature is turned on or off. If you are so afraid of the common code may break any directories, then this feature should be held back for more testing.

I'm not overly fearful...

Quoted 8 lines
Quoted 4 lines

All that I insist is this nice feature be added to the mainstream filesystem at the same time as the experimental filesystem. There is NO TECHNICAL reason that this feature is not supported mainstream filesystem.

No, not technical... (although, there is also no technical reason that V4 and V5 must go in at the same time, so we're into the realm of opinion& preference here)

IMO if this were clearly related to the v5 super block features we could soften the line regarding whether it must be finished before it goes in. But it seems not to be directly related.

Quoted 3 lines

One reason I'd argue for V5 potentially prior to V4 is that V4 requires a few more code changes over and above V5. If those V4 changes lag, it it might make sense to separate them. If they don't lag, great.

As I mentioned on the call last week, I am sympathetic to this viewpoint. Having said that... I also think Mark and Geoffrey also have a good point in saying that since this isn't a v5 feature it's not experimental code, and it needs to be completed before we pull it in, and this should include the v4 implementation.

Seems like we haven't seen the completion of the v5 version of this code at this point, so the argument of whether v4 should gate it for 3.12 is kind of moot. I do prefer that they go in together, not being an experimental feature... and it would be nice if we can make that happen in 3.12.

Quoted 4 lines
Quoted 3 lines

I repeat, if you have technical concerns for the feature's implementation and its impact on v4 filesystems because it uses common directory code, then it should be held back for more testing.

Quoted 6 lines
Quoted 1 line

I'm not trying to pick a fight.

Thanks. If we can have such minor disagreements without resorting to badmouthing myself as maintainer and the rest of the SGI team on the list I really do appreciate it. Our people are well intentioned, want to help, and they deserve better. As do the rest of the contributors.

oops, I already delivered my badmouthing in person....I (literally) told him in a whiny voice, with arms flailing in the air, to R-T-F-Patches already.

Quoted 7 lines
Quoted 3 lines

I just want to make sure that all
the new work unique to having it on V4 is identified& owned...

Good plan. I think Mark needs to look at the xfs_repair issue you mentioned. Sounds like xfs_db already works.

done.

Quoted 3 lines

Thanks,
Ben

--Mark.

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

#73 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Quoted 3 lines · Mark Tinguely

oops, I already delivered my badmouthing in person....I (literally) told him in a whiny voice, with arms flailing in the air, to R-T-F-Patches already.

Yeah. My bad. I should have read the patch before commenting upon what it might or might not do. What a loser.

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

#74 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

In reply to Mark Tinguely
Quoted 5 lines · Mark Tinguely
Quoted 4 lines · Eric Sandeen

On 8/19/13 3:19 PM, Mark Tinguely wrote:

<an attachment that doesn't show up on reply, moving d_type support to v4 superblocks ;)>

Quoted 8 lines
Quoted 3 lines

Thanks, Mark!

Has you been able to test this at all?

There is no test for this feature. Yes I did my version of testing. First adding each type of inode type and verifying it. Then fsstress testing using the same seed for sb v4+feature, v4 plain, v5+feature. The resulting directory and checked with xfs_db. fsstress was chosen

You would have had to have modified xfs_db to do this - can you send the patches out for review?

Quoted 1 line

because how it manipulate directory items.

But fsstress doesn't build large directories, so I don't think you've done anywhere near enough testing to say that you'd done anything more than smoke tested it.

Indeed, in testing the dirent code on v5 superblocks, Michael Semon triggered a corner case failure in the v5 directory code that I haven't ever triggered in all my testin.

Run this on a v5 filesystem:

# seq 200000 | xargs touch

And watch it fail when splitting a leaf in a node format directory. It's taken several months of testing to uncover this problem, and it is almost certain to be a bug that causes directory corruption. fsstress doesn't get anywhere near the per-directory file count necessary to exercise these sorts of directory operations.

The moral of the story: the XFS directory code is *very hard to validate*.

This is an clear demonstration of why I want to be extremely conservative in bringing this feature to v4 filesystems. The risk of there being an undiscovered corruption bug in the dtype code, or it exposes a pre-existing corruption bug in the directory code is still significant.

Quoted 7 lines
Quoted 3 lines

I do still owe a promised xfstest - but for that, we'll need at least mkfs & xfs_repair support.

Dave made changes so that xfs_repair will run (find the correct directory items) but the feature verification and repairs has not been done, so technically this is an incomplete feature.

The patches I sent won't support a new v4 superblock feature bit, so you had had to write code to do that. Can you post your userspace patches at well?

Quoted 8 lines
Quoted 2 lines

* XFS_IOC_FSGEOM support so that xfs_info can report the difference
* xfs_repair needs to know that it's a valid feature on V4

okay, it will run xfs_repair to the same level as v5. AND ...As pointed out, there is no xfs_repair support to verify/correct the feature in v5 and therefore v4 - (again it is the same directory code). As is, this feature is incomplete. That could keep the kernel portion from moving forward.

That's not what XFS_IOC_FSGEOM is for. Adding the feature bit to the XFS_IOC_FSGEOM ioctl is to allow us to find out if the user has enabled the feature via xfs_info....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

In reply to Mark Tinguely
Quoted 3 lines · Mark Tinguely

I repeat, if you have technical concerns for the feature's implementation and its impact on v4 filesystems because it uses common directory code, then it should be held back for more testing.

I missed this comment. Mark, I'm really concerned that SGI is taking the stance that the dtype code is fully working unless otherwise proven to have problems. That is a dangerous approach to take for new code and new on-disk formats - it should be considered with suspicion and paranoia until enough testing has been done to negate those concerns.

The reason I only proposed this for v5 superblocks is to enable wider testing and get us to the point where we are not concerned anymore about it before we say it is ready for production deployment.

I have technical concerns that arise once the feature bit it enabled, not when it is disabled. Those technical concerns center around off-by-one and alignment issues as a result of increasing the dirent size when the feature bit is enabled - they pack differently into the directory structure and hence will exercise allocation, freespace and logging differently.

See my previous comments about how hard the directory code is to test and validate - that's why I want to enable in V5 first so we can shake out problems over a wider (but still constrained) user base that understand that EXPERIMENTAL means that they might still be corruption bugs lurking.

Again, as I've said all along - enabling the feature on v4 filesystems is not a technical problem - it's a process and support problem. If I thought that this code was ready for widespread production deployment then I would have no hesitation to add v4 support, but it's simply not at that stage yet. We need wider test and deployment coverage to get the new feature to that stage.

Which leads to the "then it should be held back for more testing" comment. We've discussed this before - almost a year ago now - when SGI stated that they wouldn't accept any new code in the xfsdev tree unless it was proven to be regression free. That was unacceptable then and to apply it to the v5 dirent code is no different.

We need wider testing of these changes before it is production ready, and so holding it back until it's proven to be OK for production deployment in v4 filesystems is placing us in a catch-22 and as such is a similarly an unacceptable outcome.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Hi Dave,

Quoted 24 lines · Dave Chinner
Quoted 3 lines · Mark Tinguely

I repeat, if you have technical concerns for the feature's implementation and its impact on v4 filesystems because it uses common directory code, then it should be held back for more testing.

I missed this comment. Mark, I'm really concerned that SGI is taking the stance that the dtype code is fully working unless otherwise proven to have problems. That is a dangerous approach to take for new code and new on-disk formats - it should be considered with suspicion and paranoia until enough testing has been done to negate those concerns.

The reason I only proposed this for v5 superblocks is to enable wider testing and get us to the point where we are not concerned anymore about it before we say it is ready for production deployment.

I have technical concerns that arise once the feature bit it enabled, not when it is disabled. Those technical concerns center around off-by-one and alignment issues as a result of increasing the dirent size when the feature bit is enabled - they pack differently into the directory structure and hence will exercise allocation, freespace and logging differently.

Quoted 5 lines

See my previous comments about how hard the directory code is to test and validate - that's why I want to enable in V5 first so we can shake out problems over a wider (but still constrained) user base that understand that EXPERIMENTAL means that they might still be corruption bugs lurking.

I understand the sentiment that it would be nice to get this into v5 for some early initial testing. However, we agreed to take in the crc work as experimental on the condition that it does not regress v4 superblocks, and with the knowledge that it might take awhile to be completed. It's still unfinished and that's ok. We knew that was coming. But this was an agreement made for one feature only. We did not agree that the v5 superblock would become a dumping ground for unrelated and incomplete features to get early testing.

Quoted 13 lines

Again, as I've said all along - enabling the feature on v4 filesystems is not a technical problem - it's a process and support problem. If I thought that this code was ready for widespread production deployment then I would have no hesitation to add v4 support, but it's simply not at that stage yet. We need wider test and deployment coverage to get the new feature to that stage.

Which leads to the "then it should be held back for more testing" comment. We've discussed this before - almost a year ago now - when SGI stated that they wouldn't accept any new code in the xfsdev tree unless it was proven to be regression free. That was unacceptable then and to apply it to the v5 dirent code is no different.

Quoted 4 lines

We need wider testing of these changes before it is production ready, and so holding it back until it's proven to be OK for production deployment in v4 filesystems is placing us in a catch-22 and as such is a similarly an unacceptable outcome.

If this needs more testing I'm all for it. We should make it a Kconfig option marked as experimental in it's own right, finish the userspace work, and then set about pulling it in. Marking the feature bit as experimental in mkfs with a warning also seems like an good idea to me... And if you're that concerned about it then I'd really like to see them both. But marking it experimental doesn't magically mean that we'll pull in another incomplete feature. My impression is we're likely to go to -rc7, so I think chances are good this work can be finished in time for 3.12.

Regards,
Ben

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

#77 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Quoted 33 lines · Ben Myers

Hi Dave,

Quoted 24 lines · Dave Chinner
Quoted 3 lines · Mark Tinguely

I repeat, if you have technical concerns for the feature's implementation and its impact on v4 filesystems because it uses common directory code, then it should be held back for more testing.

I missed this comment. Mark, I'm really concerned that SGI is taking the stance that the dtype code is fully working unless otherwise proven to have problems. That is a dangerous approach to take for new code and new on-disk formats - it should be considered with suspicion and paranoia until enough testing has been done to negate those concerns.

The reason I only proposed this for v5 superblocks is to enable wider testing and get us to the point where we are not concerned anymore about it before we say it is ready for production deployment.

I have technical concerns that arise once the feature bit it enabled, not when it is disabled. Those technical concerns center around off-by-one and alignment issues as a result of increasing the dirent size when the feature bit is enabled - they pack differently into the directory structure and hence will exercise allocation, freespace and logging differently.

Quoted 5 lines

See my previous comments about how hard the directory code is to test and validate - that's why I want to enable in V5 first so we can shake out problems over a wider (but still constrained) user base that understand that EXPERIMENTAL means that they might still be corruption bugs lurking.

Quoted 6 lines

I understand the sentiment that it would be nice to get this into v5 for some early initial testing. However, we agreed to take in the crc work as experimental on the condition that it does not regress v4 superblocks, and with the knowledge that it might take awhile to be completed. It's still unfinished and that's ok. We knew that was coming. But this was an agreement made for one feature only.

No, it was made for all the on-disk changes that were proposed for the new v5 format. The dirent changes were part of that - that's been the POR for the past couple of years, I was clear and up front about this and mentioned it several times during the weekly con calls. I even specifically said at one point that if I don't get it done for the initial merge that I'd need use an incompat feature bit for it. At no time during those discussions did SGI say *anything* about needing it on v4.

No, that didn't happen until I posted the patches for review with performance numbers attached. And here we are....

Further, I'm seriously concerned that the maintainer is claiming to be unaware of the the public POR for this feature, especially as this very feature has specifically talked about and mentioned in the conctext of CRCs and features in discussions over the past few months.

Quoted 2 lines

We did not agree that the v5 superblock would become a
dumping ground for unrelated and incomplete features to get early testing.

I am not using v5 superblocks as a "dumping ground". This feature was *always* planned solely for v5 superblocks.

Quoted 15 lines
Quoted 15 lines

Again, as I've said all along - enabling the feature on v4 filesystems is not a technical problem - it's a process and support problem. If I thought that this code was ready for widespread production deployment then I would have no hesitation to add v4 support, but it's simply not at that stage yet. We need wider test and deployment coverage to get the new feature to that stage.

Which leads to the "then it should be held back for more testing" comment. We've discussed this before - almost a year ago now - when SGI stated that they wouldn't accept any new code in the xfsdev tree unless it was proven to be regression free. That was unacceptable then and to apply it to the v5 dirent code is no different.

Quoted 7 lines
Quoted 4 lines

We need wider testing of these changes before it is production ready, and so holding it back until it's proven to be OK for production deployment in v4 filesystems is placing us in a catch-22 and as such is a similarly an unacceptable outcome.

If this needs more testing I'm all for it. We should make it a Kconfig option marked as experimental in it's own right,

I don't follow you - what feature do you want to make a compile time conditional?

Quoted 3 lines

finish the userspace work, and then
set about pulling it in. Marking the feature bit as experimental in mkfs with a warning also seems like an good idea to me...

What does that acheive that we don't already have?

And, indeed, ext4 proved this a bad idea with their ext4dev flag and all problems that produced in userspace...

Quoted 4 lines

And
if you're that concerned about it then I'd really like to see them both. But marking it experimental doesn't magically mean that we'll pull in another incomplete feature.

dtype support for v5 is a complete feature from the kernel code perspective. There's no more kernel code that needs to be written for it.

Quoted 2 lines

My impression is we're likely to go to -rc7, so I think chances are good this work can be finished in time for 3.12.

v4 support is not going to be ready for 3.12. We don't rush new on-disk format changes, and the v4 code support is nowhere near complete yet. Ignoring the code that still needs to be written, there's a lot more verification needed before it gets merged....

The compromise I have suggested of review and merge v5 now and work to get v4 support for v3.13 is not at all unreasonable. It's a simple plan, we end up in the same place, we don't delay merging of code, it gives the dirent code wider exposure immediately to early adopters and testers, it gives us time to ensure that the v4 code is robust and complete before a merge occurs and we split the release validation test matrix for the feature over 2 releases rather than having to validate them both in the one -rc series. It's a clear win for everyone if we take that route.

The thing that I don't understand is why SGI is in such a *rush* to get this feature on v4 superblocks? What's driving SGIs requirement that v4 and v5 support be merged *at the same time*? Nobody from SGI has actually explained why this is needed and AFICT there is no technical reason why it is necessary.

Ben, given that you have decided to try to merge them both for 3.12, then someone must have made a convincing argument to you that it is absolutely necessary that they must be supported at the same time, in the same release, and that it needs to be rushed into 3.12. You're not normally this reckless - you have tended to err on the conservative side, so I can only conclude that you know something that SGI has not told anyone outside of SGI about.

If there is no reason for v4 support in 3.12 other than "it's in v5", then why the rush regardless of the obvious risks that this entails? Further, if there is no rush, then why is SGI so stridently opposed to the plan I've been stating above?

Quoted 1 line

From my perspective (as the author of the dtype code and that of the

XFS developer most intimately familiar with the complexity of the directory code), if the only way the v5 dtype support is going to be merged is when the v4 code is ready to go, then the only decision that can be made is to slip dtype support to 3.13 so as to give us time to properly review and validate the dtype code on v4 filesystems befor merging it.

I'm not happy at be forced to compromise further and have this code miss 3.12, but SGI is really holding my new code hostage and asking for a ransom to be paid before the code can be merged. I can't force you to merge it, but if you don't, or you do something exceedingly risky instead, then *I want to know why* the maintainer has made those decisions.

I'm very, very, very unhappy about how this situation is unfolding.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

On Thu, Aug 22, 2013 at 12:02:26PM +1000, Dave Chinner wrote:

| On Wed, Aug 21, 2013 at 12:03:36PM -0500, Ben Myers wrote:
| > Hi Dave,
| > 
| > On Wed, Aug 21, 2013 at 10:06:24AM +1000, Dave Chinner wrote:
| > > On Tue, Aug 20, 2013 at 09:29:17AM -0500, Mark Tinguely wrote:
| > > > I repeat, if you have technical concerns for the feature's
| > > > implementation and its impact on v4 filesystems because it uses
| > > > common directory code, then it should be held back for more testing.
| > > 
| > > I missed this comment. Mark, I'm really concerned that SGI is taking
| > > the stance that the dtype code is fully working unless otherwise
| > > proven to have problems.  That is a dangerous approach to take for
| > > new code and new on-disk formats - it should be considered with
| > > suspicion and paranoia until enough testing has been done to negate
| > > those concerns.
| > > 
| > > The reason I only proposed this for v5 superblocks is to enable
| > > wider testing and get us to the point where we are not concerned
| > > anymore about it before we say it is ready for production
| > > deployment.
| > > 
| > > I have technical concerns that arise once the feature bit it
| > > enabled, not when it is disabled. Those technical concerns center
| > > around off-by-one and alignment issues as a result of increasing the
| > > dirent size when the feature bit is enabled - they pack differently
| > > into the directory structure and hence will exercise allocation,
| > > freespace and logging differently.
| > > 
| > > See my previous comments about how hard the directory code is to
| > > test and validate - that's why I want to enable in V5 first so we
| > > can shake out problems over a wider (but still constrained) user
| > > base that understand that EXPERIMENTAL means that they might still
| > > be corruption bugs lurking.
| > 
| > I understand the sentiment that it would be nice to get this into v5 for some
| > early initial testing.  However, we agreed to take in the crc work as
| > experimental on the condition that it does not regress v4 superblocks, and with
| > the knowledge that it might take awhile to be completed.  It's still unfinished
| > and that's ok.  We knew that was coming.  But this was an agreement made for
| > one feature only.
| 
| No, it was made for all the on-disk changes that were proposed for
| the new v5 format. The dirent changes were part of that - that's
| been the POR for the past couple of years, I was clear and up front
| about this and mentioned it several times during the weekly con
| calls. I even specifically said at one point that if I don't get it
| done for the initial merge that I'd need use an incompat feature bit
| for it. At no time during those discussions did SGI say *anything*
| about needing it on v4.
| 
| No, that didn't happen until I posted the patches for review with
| performance numbers attached. And here we are....
| 
| Further, I'm seriously concerned that the maintainer is claiming to
| be unaware of the the public POR for this feature, especially as
| this very feature has specifically talked about and mentioned in the
| context of CRCs and features in discussions over the past few
| months.

I am claiming to be unaware of the POR for this feature.
I have finally found a reference on February 25 of this year.
[http://oss.sgi.com/archives/xfs/2013-02/msg00451.html] As this feature was lumped in with the CRC work, I never noticed it. It is my fault that I don't read the list more carefully. However, what was posted did not provide any design information, or code. Even if I had noticed your references to the feature, I would have had no clue as to how the feature would be implemented. It wasn't until you posted the patch on July 19 that there was any type of indication as to how the feature is implemented. [http://oss.sgi.com/archives/xfs/2013-07/msg00422.html]
Had I been aware of the design and implementation details earlier, I would have had an opportunity to raise my concerns earlier.

When I did finally notice this feature, it is clear that this feature really does not belong with the CRC work. It is completely unrelated other than the fact there is an on-disk format change. The only dependency I can find is that your implementation is using code introduced by the dir3 code, but that is the case whether or not the dirent filetype feature is enabled.

| > We did not agree that the v5 superblock would become a
| > dumping ground for unrelated and incomplete features to get early testing.
| 
| I am not using v5 superblocks as a "dumping ground". This feature
| was *always* planned solely for v5 superblocks.

Why? This feature has no dependency on v5 superblocks. It has no dependency on CRCs. It has no dependency on self-describing metadata. It could be implemented without the dir3 code. What is your justification for planning this feature solely for v5 superblocks. That is what I do not understand.

| > > Again, as I've said all along - enabling the feature on v4
| > > filesystems is not a technical problem - it's a process and
| > > support problem. If I thought that this code was ready for
| > > widespread production deployment then I would have no hesitation
| > > to add v4 support, but it's simply not at that stage yet. We
| > > need wider test and deployment coverage to get the new feature
| > > to that stage.

Process and support? Mark and I have stepped up to provide the support for this feature in v4 superblocks. I will take responsibility for ensuring that the feature is thoroughly tested. Mark is already testing the feature on v4 superblock filesystems. If the feature is introduced in the 3.12 merge window, there will be additional time to test the feature before 3.12 is released. What other process is there for adding a feature?

| > > Which leads to the "then it should be held back for more
| > > testing" comment. We've discussed this before - almost a year
| > > ago now - when SGI stated that they wouldn't accept any new code
| > > in the xfsdev tree unless it was proven to be regression free.
| > > That was unacceptable then and to apply it to the v5 dirent code
| > > is no different.
| > > 
| > > We need wider testing of these changes before it is production
| > > ready, and so holding it back until it's proven to be OK for
| > > production deployment in v4 filesystems is placing us in a
| > > catch-22 and as such is a similarly an unacceptable outcome.

The common code path changes in your code will be active even if the feature is not ported to v4 filesystems. So no difference there. Testing on the v4 changes is already underway, and no issues have been found. Please quantify the level of testing you expect. Do you want to see actual test results published? I have never seen such a requirement in the past.

| > If this needs more testing I'm all for it.  We should make it a
| > Kconfig option marked as experimental in it's own right,
| 
| I don't follow you - what feature do you want to make a compile time
| conditional?

I think Ben is suggesting making the dirent filetype feature a compile time conditional. I do not agree.

| > finish the userspace work, and then
| > set about pulling it in.  Marking the feature bit as experimental
| > in mkfs with a warning also seems like an good idea to me...
| 
| What does that achieve that we don't already have?
| 
| And, indeed, ext4 proved this a bad idea with their ext4dev flag
| and all problems that produced in userspace...
| 
| > And
| > if you're that concerned about it then I'd really like to see them
| > both.  But marking it experimental doesn't magically mean that
| > we'll pull in another incomplete feature.
| 
| dtype support for v5 is a complete feature from the kernel code
| perspective. There's no more kernel code that needs to be written
| for it.

Same for v4. Mark has posted the code.

| > My impression is we're likely to go to -rc7, so I think chances
| > are good this work can be finished in time for 3.12.
| 
| v4 support is not going to be ready for 3.12. We don't rush new
| on-disk format changes, and the v4 code support is nowhere near
| complete yet. Ignoring the code that still needs to be written,
| there's a lot more verification needed before it gets merged....

Please explain what is missing? If you are referring to the user space code, you are correct in that there has not been any code posted for review. The kernel code can still go in though as without the user space code, the feature cannot be enabled. A modified mkfs is required to enable the feature bit for v4, or the superblock must be hacked.

| The compromise I have suggested of review and merge v5 now and work
| to get v4 support for v3.13 is not at all unreasonable.  It's a
| simple plan, we end up in the same place, we don't delay merging of
| code, it gives the dirent code wider exposure immediately to early
| adopters and testers, it gives us time to ensure that the v4 code is
| robust and complete before a merge occurs and we split the release
| validation test matrix for the feature over 2 releases rather than
| having to validate them both in the one -rc series. It's a clear win
| for everyone if we take that route.
| 
| The thing that I don't understand is why SGI is in such a *rush* to
| get this feature on v4 superblocks? What's driving SGIs requirement
| that v4 and v5 support be merged *at the same time*? Nobody from SGI
| has actually explained why this is needed and AFICT there is no
| technical reason why it is necessary.

I still don't understand why you are trying to block this feature for v4 superblocks. I've attempted to explain the technical reasons why the feature should go in to 3.12 for v4 superblocks. The common code is shared by both v4 and v5 superblocks. The feature is not enabled by default on v4 superblocks. It can only be enabled by a modified mkfs or by hacking the superblock. Adding the v4 feature kernel code in 3.12 will allow developers and early adopters to start testing the new feature in 3.12 kernels when the mkfs patch is available. There is no plan or requirement to rush the user space support into the next release.

There is no technical reason at this time to exclude the feature from v4 superblocks. The only reason given has been vague "process and testing" requirements, which as far as I can tell are invalid given the fact that the feature cannot be enabled with the mkfs binaries currently available. Adding the feature to v4 superblocks adds no additional risk over adding the feature to v5 superblocks.

| Ben, given that you have decided to try to merge them both for 3.12,
| then someone must have made a convincing argument to you that it is
| absolutely necessary that they must be supported at the same time,
| in the same release, and that it needs to be rushed into 3.12.
| You're not normally this reckless - you have tended to err on the
| conservative side, so I can only conclude that you know something
| that SGI has not told anyone outside of SGI about.
| 
| If there is no reason for v4 support in 3.12 other than "it's in
| v5", then why the rush regardless of the obvious risks that this
| entails? Further, if there is no rush, then why is SGI so stridently
| opposed to the plan I've been stating above?

The v4 and v5 code share common code. The v4 code has a feature bit to enable the feature. The v4 code cannot be enabled with the currently available userspace binaries. If that isn't convincing, I don't think I can convince you that the sky is blue.

| >From my perspective (as the author of the dtype code and that of the
| XFS developer most intimately familiar with the complexity of the
| directory code), if the only way the v5 dtype support is going to be
| merged is when the v4 code is ready to go, then the only decision
| that can be made is to slip dtype support to 3.13 so as to give us
| time to properly review and validate the dtype code on v4
| filesystems before merging it.
| 
| I'm not happy at be forced to compromise further and have this code
| miss 3.12, but SGI is really holding my new code hostage and asking
| for a ransom to be paid before the code can be merged. I can't force
| you to merge it, but if you don't, or you do something exceedingly
| risky instead, then *I want to know why* the maintainer has made
| those decisions.
| 
| I'm very, very, very unhappy about how this situation is unfolding.

As am I.

Signature · 7 lines
Geoffrey Wehrman
[email protected]

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

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Gents,

Quoted 4 lines · Geoffrey Wehrman

On Thu, Aug 22, 2013 at 12:02:26PM +1000, Dave Chinner wrote:
| I'm very, very, very unhappy about how this situation is unfolding.

As am I.

Mark provided some mkfs code to test the v4 feature bit with, and it worked fine for me.

Given that we are protected by a feature bit, I feel that pulling in the v4 feature is considerably less risky than what we did in 3.10, with Dave still cleaning up his mess in -rc6, so go ahead and call me
reckless: I've pulled in both v4 and v5 versions of this code.

Mark, please post your mkfs code ASAP, even though Dave hasn't reposted his userspace series yet.

Everybody gets his code in and nobody is happy.

-Ben

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

#80 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Quoted 16 lines · Ben Myers

Gents,

Quoted 4 lines · Geoffrey Wehrman

On Thu, Aug 22, 2013 at 12:02:26PM +1000, Dave Chinner wrote:
| I'm very, very, very unhappy about how this situation is unfolding.

As am I.

Mark provided some mkfs code to test the v4 feature bit with, and it worked fine for me.

Given that we are protected by a feature bit, I feel that pulling in the v4 feature is considerably less risky than what we did in 3.10, with Dave still cleaning up his mess in -rc6, so go ahead and call me
reckless: I've pulled in both v4 and v5 versions of this code.

Quoted 6 lines

Mark, please post your mkfs code ASAP, even though Dave hasn't reposted his userspace series yet.

Everybody gets his code in and nobody is happy.

-Ben

Mark's v4 dirent patches seem to work on 32-bit x86. I happen to agree 100% with Dave on this issue. However, lacking a dirent test and xfs_db skills, I threw everything else and the kitchen sink at v4-dirent XFS and did not find any evidence to back up Dave's argument. So I'll tip my cap to Mark for his insight on the matter, hoping that his testing skills are fine as always.

Thanks!

Michael

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

#81 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

Quoted 31 lines · Michael L. Semon
Quoted 16 lines · Ben Myers

Gents,

Quoted 4 lines · Geoffrey Wehrman

On Thu, Aug 22, 2013 at 12:02:26PM +1000, Dave Chinner wrote:
| I'm very, very, very unhappy about how this situation is unfolding.

As am I.

Mark provided some mkfs code to test the v4 feature bit with, and it worked fine for me.

Given that we are protected by a feature bit, I feel that pulling in the v4 feature is considerably less risky than what we did in 3.10, with Dave still cleaning up his mess in -rc6, so go ahead and call me
reckless: I've pulled in both v4 and v5 versions of this code.

Quoted 6 lines

Mark, please post your mkfs code ASAP, even though Dave hasn't reposted his userspace series yet.

Everybody gets his code in and nobody is happy.

-Ben

Mark's v4 dirent patches seem to work on 32-bit x86. I happen to agree 100% with Dave on this issue. However, lacking a dirent test and xfs_db skills, I threw everything else and the kitchen sink at v4-dirent XFS and did not find any evidence to back up Dave's argument. So I'll tip my cap to Mark for his insight on the matter, hoping that his testing skills are fine as always.

Quoted 4 lines

Thanks!

Michael

BTW, are there any xfstests results times for dirent vs. non-dirent code? For whatever reason, generic/068 is posting noticeably worse numbers for v4-dirent XFS than for both v4 XFS and v5-dirent CRC XFS.

I'm running the tests myself as well, but it will take a while to run them for v4 XFS, v4-dirent XFS, v4-dirent-512b-inode XFS, and v5-dirent-CRC XFS...which kinda speaks to Dave's point about supporting a matrix of filesystems, but I wasn't meaning it that way...

Thanks again!

Michael

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

#82 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

In reply to Michael L. Semon
Quoted 31 lines · Michael L. Semon
Quoted 16 lines · Ben Myers

Gents,

Quoted 4 lines · Geoffrey Wehrman

On Thu, Aug 22, 2013 at 12:02:26PM +1000, Dave Chinner wrote:
| I'm very, very, very unhappy about how this situation is unfolding.

As am I.

Mark provided some mkfs code to test the v4 feature bit with, and it worked fine for me.

Given that we are protected by a feature bit, I feel that pulling in the v4 feature is considerably less risky than what we did in 3.10, with Dave still cleaning up his mess in -rc6, so go ahead and call me
reckless: I've pulled in both v4 and v5 versions of this code.

Quoted 6 lines

Mark, please post your mkfs code ASAP, even though Dave hasn't reposted his userspace series yet.

Everybody gets his code in and nobody is happy.

-Ben

Mark's v4 dirent patches seem to work on 32-bit x86. I happen to agree 100% with Dave on this issue. However, lacking a dirent test and xfs_db skills, I threw everything else and the kitchen sink at v4-dirent XFS and did not find any evidence to back up Dave's argument. So I'll tip my cap to Mark for his insight on the matter, hoping that his testing skills are fine as always.

Quoted 4 lines

Thanks!

Michael

Thanks for your thoughts on the subject and tests. In the end, we all want XFS to continue to succeed.

--Mark.

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

#83 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

In reply to Mark Tinguely
Quoted 31 lines · Mark Tinguely

Add XFS 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.

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

Index: b/fs/xfs/xfs_sb.h
===================================================================

fs/xfs/xfs_sb.h +3 -1
@@ -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	\

fs/xfs/xfs_sb.h static inline int xfs_sb_version_has_pqu · line 640

Quoted 10 lines
fs/xfs/xfs_sb.h +4 -2
@@ -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));
 }

Ok, that's the 5 lines of kernel code I mentioned it would take to enable it. Like I said, the code to enable it is the simple part.

There's a fair bit more to getting it into releaseable state, though:

- XFS_IOC_FSGEOM support to export the feature bit to userspace. It needs to be consistent across v4/v5 filesystems, too.
- xfs_db support:
- needs to understand the feature bit in the version command
- both v4/v5 need to output the new feature bit text to say it's enabled
- all the dtype stuff is plumbed directly into the v3 directory decoding, not the v2 directory decoding. New display fields will have to be added to the v2 directory decoding and display made conditional on the XFS_SB_VERSION2_FTYPE bit being set.
- xfs_info needs to output the state of support, consistent for v4/v5
- mkfs.xfs needs a new command line option to turn the feature on, new output to indicate it's state. output needs to be consistent for v4/v5, but the command line option is only valid for v4 superblock filesystems

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by
#84 lore raw

Re: [PATCH 51/50] xfs: add xfs sb v4 support for dirent filetype field

In reply to Mark Tinguely

On Mon, Aug 19, 2013 at 03:19:36PM -0500, Mark Tinguely wrote:

| Add XFS 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 <[email protected]>
Signature · 6 lines
Geoffrey Wehrman  651-683-5496  [email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#85 lore raw
In reply to Dave Chinner
Quoted 17 lines · Dave Chinner

Hi folks,

This is a rebase of the reviewed series of kernel patches I recently posted here:

http://oss.sgi.com/pipermail/xfs/2013-July/028207.html

It addresses all the review comments except for one from Christoph about the IOP_SIZE removal - I'll send a followup patch in a couple of days to remove all the rest of IOP_ macros...

The log space problems from the optimisations have been fixed - the fix went into patch 44 of this series, and cascaded through 45 and 46 as well. Those patches will need reviewing. The problematic workload has been running for 16 hours here without failure on a small (10MB) log, so AFAICT the problem is fixed.

Quoted 3 lines

There is one new patch - the fix to the use-after-free of clean buffer items when a transaction is cancelled - and that is at the end of the series.

Applied 48, 49, and 51.

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