Skip to contentSkip to conversation

xfs_io: detect the '-R' option in getopt

PATCH Superseded Darrick J. Wong 4 participants 23 messages Jan 23, 2016 – Feb 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 xfs_io: detect the '-R' option in getopt

Configure getopt to accept the -R argument to pwrite.

---
 io/pwrite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/pwrite.c +1 -1
index fd9114d..c6efee9 100644
@@ -259,7 +259,7 @@ pwrite_f(
 	init_cvtnum(&fsblocksize, &fssectsize);
 	bsize = fsblocksize;
 
-	while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
+	while ((c = getopt(argc, argv, "b:Cdf:i:qRs:S:uV:wWZ:")) != EOF) {
 		switch (c) {
 		case 'b':
 			tmp = cvtnum(fsblocksize, fssectsize, optarg);

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

#1 lore raw

PATCH 2/5 libxfs: refactor the btree size calculator code

Create a macro to generate btree height calculator functions. This will be used (much) later when we get to the refcount btree.

---
 libxfs/xfs_bmap.c       |   18 +-----------------
 libxfs/xfs_bmap_btree.c |    9 +++++++++
 libxfs/xfs_bmap_btree.h |    3 +++
 libxfs/xfs_btree.c      |   28 ++++++++++++++++++++++++++++
 libxfs/xfs_btree.h      |    3 +++
 5 files changed, 44 insertions(+), 17 deletions(-)
libxfs/xfs_bmap.c +1 -17
index aef7cf3..c134765 100644
@@ -172,25 +172,9 @@ xfs_bmap_worst_indlen(
 	xfs_inode_t	*ip,		/* incore inode pointer */
 	xfs_filblks_t	len)		/* delayed extent length */
 {
-	int		level;		/* btree level number */
-	int		maxrecs;	/* maximum record count at this level */
-	xfs_mount_t	*mp;		/* mount structure */
 	xfs_filblks_t	rval;		/* return value */
 
-	mp = ip->i_mount;
-	maxrecs = mp->m_bmap_dmxr[0];
-	for (level = 0, rval = 0;
-	     level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
-	     level++) {
-		len += maxrecs - 1;
-		do_div(len, maxrecs);
-		rval += len;
-		if (len == 1)
-			return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
-				level - 1;
-		if (level == 0)
-			maxrecs = mp->m_bmap_dmxr[1];
-	}
+	rval = xfs_bmbt_calc_size(ip->i_mount, len);
 	return rval;
 }
 
libxfs/xfs_bmap_btree.c +9 -0
index 2ef1836..3c595e2 100644
@@ -880,3 +880,12 @@ xfs_bmbt_change_owner(
 	xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
 	return error;
 }
+
+xfs_filblks_t
+xfs_bmbt_calc_size(
+	struct xfs_mount	*mp,
+	unsigned long		len)
+{
+	return xfs_btree_calc_size(mp, mp->m_bmap_dmxr,
+			XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), len);
+}
libxfs/xfs_bmap_btree.h +3 -0
index 819a8a4..04bc6e2 100644
@@ -140,4 +140,7 @@ extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
 extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
 		struct xfs_trans *, struct xfs_inode *, int);
 
+extern xfs_filblks_t xfs_bmbt_calc_size(struct xfs_mount *mp,
+		unsigned long len);
+
 #endif	/* __XFS_BMAP_BTREE_H__ */
libxfs/xfs_btree.c +28 -0
index 658f27e..d5f16c5 100644
@@ -4081,6 +4081,34 @@ xfs_btree_change_owner(
 	return 0;
 }
 
+/*
+ * xfs_btree_calc_size() -- Calculate the number of blocks needed to store
+ *			    a given number of records.
+ */
+xfs_filblks_t
+xfs_btree_calc_size(
+	struct xfs_mount	*mp,
+	uint			*limits,
+	int			maxlevels,
+	unsigned long		len)
+{
+	int			level;
+	int			maxrecs;
+	xfs_filblks_t		rval;
+
+	maxrecs = limits[0];
+	for (level = 0, rval = 0; level < maxlevels; level++) {
+		len += maxrecs - 1;
+		do_div(len, maxrecs);
+		rval += len;
+		if (len == 1)
+			return rval + maxlevels - level - 1;
+		if (level == 0)
+			maxrecs = limits[1];
+	}
+	return rval;
+}
+
 /**
  * xfs_btree_sblock_v5hdr_verify() -- verify the v5 fields of a short-format
  *				      btree block
libxfs/xfs_btree.h +3 -0
index 48cb251..b25ffd3 100644
@@ -465,6 +465,9 @@ static inline int xfs_btree_get_level(struct xfs_btree_block *block)
 #define XFS_BTREE_TRACE_ARGR(c, r)
 #define	XFS_BTREE_TRACE_CURSOR(c, t)
 
+xfs_filblks_t xfs_btree_calc_size(struct xfs_mount *mp, uint *limits,
+		int maxlevels, unsigned long len);
+
 bool xfs_btree_sblock_v5hdr_verify(struct xfs_buf *bp);
 bool xfs_btree_sblock_verify(struct xfs_buf *bp, unsigned int max_recs);
 

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

#2 lore raw

Re: [PATCH 2/5] libxfs: refactor the btree size calculator code

Quoted 6 lines · Darrick J. Wong

Create a macro to generate btree height calculator functions. This will be used (much) later when we get to the refcount btree.

---

The refactoring looks fine to me... though shouldn't this head into the kernel first and get backported to xfsprogs (or did I miss that somewhere)?

That and one question below...

Quoted 26 lines
 libxfs/xfs_bmap.c       |   18 +-----------------
 libxfs/xfs_bmap_btree.c |    9 +++++++++
 libxfs/xfs_bmap_btree.h |    3 +++
 libxfs/xfs_btree.c      |   28 ++++++++++++++++++++++++++++
 libxfs/xfs_btree.h      |    3 +++
 5 files changed, 44 insertions(+), 17 deletions(-)
libxfs/xfs_bmap.c +0 -8
index aef7cf3..c134765 100644
@@ -172,25 +172,9 @@ xfs_bmap_worst_indlen(
 	xfs_inode_t	*ip,		/* incore inode pointer */
 	xfs_filblks_t	len)		/* delayed extent length */
 {
-	int		level;		/* btree level number */
-	int		maxrecs;	/* maximum record count at this level */
-	xfs_mount_t	*mp;		/* mount structure */
 	xfs_filblks_t	rval;		/* return value */
 
-	mp = ip->i_mount;
-	maxrecs = mp->m_bmap_dmxr[0];
-	for (level = 0, rval = 0;
-	     level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
-	     level++) {

libxfs/xfs_bmap.c xfs_bmap_worst_indlen( · line 177

Quoted 10 lines
libxfs/xfs_bmap.c +1 -9
-		len += maxrecs - 1;
-		do_div(len, maxrecs);
-		rval += len;
-		if (len == 1)
-			return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
-				level - 1;
-		if (level == 0)
-			maxrecs = mp->m_bmap_dmxr[1];
-	}
+	rval = xfs_bmbt_calc_size(ip->i_mount, len);

We go from xfs_filblks_t to unsigned long here. Isn't the latter 4 bytes on 32-bit systems? Was that intentional?

Brian

Quoted 86 lines
libxfs/xfs_bmap.c +0 -0
 	return rval;
 }
 
libxfs/xfs_bmap_btree.c +9 -0
index 2ef1836..3c595e2 100644
@@ -880,3 +880,12 @@ xfs_bmbt_change_owner(
 	xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
 	return error;
 }
+
+xfs_filblks_t
+xfs_bmbt_calc_size(
+	struct xfs_mount	*mp,
+	unsigned long		len)
+{
+	return xfs_btree_calc_size(mp, mp->m_bmap_dmxr,
+			XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), len);
+}
libxfs/xfs_bmap_btree.h +3 -0
index 819a8a4..04bc6e2 100644
@@ -140,4 +140,7 @@ extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
 extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
 		struct xfs_trans *, struct xfs_inode *, int);
 
+extern xfs_filblks_t xfs_bmbt_calc_size(struct xfs_mount *mp,
+		unsigned long len);
+
 #endif	/* __XFS_BMAP_BTREE_H__ */
libxfs/xfs_btree.c +28 -0
index 658f27e..d5f16c5 100644
@@ -4081,6 +4081,34 @@ xfs_btree_change_owner(
 	return 0;
 }
 
+/*
+ * xfs_btree_calc_size() -- Calculate the number of blocks needed to store
+ *			    a given number of records.
+ */
+xfs_filblks_t
+xfs_btree_calc_size(
+	struct xfs_mount	*mp,
+	uint			*limits,
+	int			maxlevels,
+	unsigned long		len)
+{
+	int			level;
+	int			maxrecs;
+	xfs_filblks_t		rval;
+
+	maxrecs = limits[0];
+	for (level = 0, rval = 0; level < maxlevels; level++) {
+		len += maxrecs - 1;
+		do_div(len, maxrecs);
+		rval += len;
+		if (len == 1)
+			return rval + maxlevels - level - 1;
+		if (level == 0)
+			maxrecs = limits[1];
+	}
+	return rval;
+}
+
 /**
  * xfs_btree_sblock_v5hdr_verify() -- verify the v5 fields of a short-format
  *				      btree block
libxfs/xfs_btree.h +3 -0
index 48cb251..b25ffd3 100644
@@ -465,6 +465,9 @@ static inline int xfs_btree_get_level(struct xfs_btree_block *block)
 #define XFS_BTREE_TRACE_ARGR(c, r)
 #define	XFS_BTREE_TRACE_CURSOR(c, t)
 
+xfs_filblks_t xfs_btree_calc_size(struct xfs_mount *mp, uint *limits,
+		int maxlevels, unsigned long len);
+
 bool xfs_btree_sblock_v5hdr_verify(struct xfs_buf *bp);
 bool xfs_btree_sblock_verify(struct xfs_buf *bp, unsigned int max_recs);
 
Quoted 4 lines

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

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

#3 lore raw

Re: [PATCH 2/5] libxfs: refactor the btree size calculator code

Quoted 11 lines · Brian Foster
Quoted 6 lines · Darrick J. Wong

Create a macro to generate btree height calculator functions. This will be used (much) later when we get to the refcount btree.

---

The refactoring looks fine to me... though shouldn't this head into the kernel first and get backported to xfsprogs (or did I miss that somewhere)?

I think I've posted the kernelside version of this patch, though I suppose it doesn't really become important until one starts adding the rmap/reflink stuff.

Quoted 33 lines

That and one question below...

Quoted 31 lines
 libxfs/xfs_bmap.c       |   18 +-----------------
 libxfs/xfs_bmap_btree.c |    9 +++++++++
 libxfs/xfs_bmap_btree.h |    3 +++
 libxfs/xfs_btree.c      |   28 ++++++++++++++++++++++++++++
 libxfs/xfs_btree.h      |    3 +++
 5 files changed, 44 insertions(+), 17 deletions(-)
libxfs/xfs_bmap.c +0 -13
index aef7cf3..c134765 100644
@@ -172,25 +172,9 @@ xfs_bmap_worst_indlen(
 	xfs_inode_t	*ip,		/* incore inode pointer */
 	xfs_filblks_t	len)		/* delayed extent length */
 {
-	int		level;		/* btree level number */
-	int		maxrecs;	/* maximum record count at this level */
-	xfs_mount_t	*mp;		/* mount structure */
 	xfs_filblks_t	rval;		/* return value */
 
-	mp = ip->i_mount;
-	maxrecs = mp->m_bmap_dmxr[0];
-	for (level = 0, rval = 0;
-	     level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
-	     level++) {
-		len += maxrecs - 1;
-		do_div(len, maxrecs);
-		rval += len;
-		if (len == 1)
-			return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
Quoted 8 lines

libxfs/xfs_bmap.c xfs_bmap_worst_indlen( · line 177

Quoted 5 lines
libxfs/xfs_bmap.c +1 -4
-				level - 1;
-		if (level == 0)
-			maxrecs = mp->m_bmap_dmxr[1];
-	}
+	rval = xfs_bmbt_calc_size(ip->i_mount, len);

We go from xfs_filblks_t to unsigned long here. Isn't the latter 4 bytes on 32-bit systems? Was that intentional?

Semi-intentional. The 'len' argument is the number of records you want to store in the btree. For a bmbt, we're capped by di_nextents/di_anextents, which limit us to 2^32 records and I think the methods in xfs_bmap.c won't create an extent longer than MAXEXTLEN (2^21) blocks anyway.

OTOH I suppose the rmap btree can store more than 2^32 records when reflink is turned on (not that you'd want to) so this could be widened to ULL.

--D

Quoted 89 lines

Brian

Quoted 86 lines
libxfs/xfs_bmap.c +0 -0
 	return rval;
 }
 
libxfs/xfs_bmap_btree.c +9 -0
index 2ef1836..3c595e2 100644
@@ -880,3 +880,12 @@ xfs_bmbt_change_owner(
 	xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
 	return error;
 }
+
+xfs_filblks_t
+xfs_bmbt_calc_size(
+	struct xfs_mount	*mp,
+	unsigned long		len)
+{
+	return xfs_btree_calc_size(mp, mp->m_bmap_dmxr,
+			XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), len);
+}
libxfs/xfs_bmap_btree.h +3 -0
index 819a8a4..04bc6e2 100644
@@ -140,4 +140,7 @@ extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
 extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
 		struct xfs_trans *, struct xfs_inode *, int);
 
+extern xfs_filblks_t xfs_bmbt_calc_size(struct xfs_mount *mp,
+		unsigned long len);
+
 #endif	/* __XFS_BMAP_BTREE_H__ */
libxfs/xfs_btree.c +28 -0
index 658f27e..d5f16c5 100644
@@ -4081,6 +4081,34 @@ xfs_btree_change_owner(
 	return 0;
 }
 
+/*
+ * xfs_btree_calc_size() -- Calculate the number of blocks needed to store
+ *			    a given number of records.
+ */
+xfs_filblks_t
+xfs_btree_calc_size(
+	struct xfs_mount	*mp,
+	uint			*limits,
+	int			maxlevels,
+	unsigned long		len)
+{
+	int			level;
+	int			maxrecs;
+	xfs_filblks_t		rval;
+
+	maxrecs = limits[0];
+	for (level = 0, rval = 0; level < maxlevels; level++) {
+		len += maxrecs - 1;
+		do_div(len, maxrecs);
+		rval += len;
+		if (len == 1)
+			return rval + maxlevels - level - 1;
+		if (level == 0)
+			maxrecs = limits[1];
+	}
+	return rval;
+}
+
 /**
  * xfs_btree_sblock_v5hdr_verify() -- verify the v5 fields of a short-format
  *				      btree block
libxfs/xfs_btree.h +3 -0
index 48cb251..b25ffd3 100644
@@ -465,6 +465,9 @@ static inline int xfs_btree_get_level(struct xfs_btree_block *block)
 #define XFS_BTREE_TRACE_ARGR(c, r)
 #define	XFS_BTREE_TRACE_CURSOR(c, t)
 
+xfs_filblks_t xfs_btree_calc_size(struct xfs_mount *mp, uint *limits,
+		int maxlevels, unsigned long len);
+
 bool xfs_btree_sblock_v5hdr_verify(struct xfs_buf *bp);
 bool xfs_btree_sblock_verify(struct xfs_buf *bp, unsigned int max_recs);
 
Quoted 9 lines
Quoted 4 lines

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

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

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

#4 lore raw

Re: [PATCH 2/5] libxfs: refactor the btree size calculator code

In reply to Darrick J. Wong
Quoted 32 lines · Darrick J. Wong

Create a macro to generate btree height calculator functions. This will be used (much) later when we get to the refcount btree.

---
 libxfs/xfs_bmap.c       |   18 +-----------------
 libxfs/xfs_bmap_btree.c |    9 +++++++++
 libxfs/xfs_bmap_btree.h |    3 +++
 libxfs/xfs_btree.c      |   28 ++++++++++++++++++++++++++++
 libxfs/xfs_btree.h      |    3 +++
 5 files changed, 44 insertions(+), 17 deletions(-)
libxfs/xfs_bmap.c +0 -8
index aef7cf3..c134765 100644
@@ -172,25 +172,9 @@ xfs_bmap_worst_indlen(
 	xfs_inode_t	*ip,		/* incore inode pointer */
 	xfs_filblks_t	len)		/* delayed extent length */
 {
-	int		level;		/* btree level number */
-	int		maxrecs;	/* maximum record count at this level */
-	xfs_mount_t	*mp;		/* mount structure */
 	xfs_filblks_t	rval;		/* return value */
 
-	mp = ip->i_mount;
-	maxrecs = mp->m_bmap_dmxr[0];
-	for (level = 0, rval = 0;
-	     level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
-	     level++) {

libxfs/xfs_bmap.c xfs_bmap_worst_indlen( · line 177

Quoted 10 lines
libxfs/xfs_bmap.c +1 -9
-		len += maxrecs - 1;
-		do_div(len, maxrecs);
-		rval += len;
-		if (len == 1)
-			return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
-				level - 1;
-		if (level == 0)
-			maxrecs = mp->m_bmap_dmxr[1];
-	}
+	rval = xfs_bmbt_calc_size(ip->i_mount, len);

NAK. This function figures out how many blocks could be required to handle adding (worst-case one-extent-per-block) extents to the bmbt and btree splits all the way up the tree, whereas xfs_btree_calc_size() merely calculates the number of blocks needed to create a tree with some number of records. When I start using the AG reservation code and counting the number of blocks in use at mount time, using the below xfs_btree_calc_size() to calculate the resevation size leads to undersized reservations, which (I think?) explains why I still occasionally run out of blocks when expanding the refcount tree, which is supposed to reserve /all/ the blocks it'll ever need.

This function should go back to the way it was, and the xfs_btree_calc_size() function will get fixed to calculate tree size correctly.

Also NAK on the kernelside version of this patch.

--D

Quoted 86 lines
libxfs/xfs_bmap.c +0 -0
 	return rval;
 }
 
libxfs/xfs_bmap_btree.c +9 -0
index 2ef1836..3c595e2 100644
@@ -880,3 +880,12 @@ xfs_bmbt_change_owner(
 	xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
 	return error;
 }
+
+xfs_filblks_t
+xfs_bmbt_calc_size(
+	struct xfs_mount	*mp,
+	unsigned long		len)
+{
+	return xfs_btree_calc_size(mp, mp->m_bmap_dmxr,
+			XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), len);
+}
libxfs/xfs_bmap_btree.h +3 -0
index 819a8a4..04bc6e2 100644
@@ -140,4 +140,7 @@ extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
 extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
 		struct xfs_trans *, struct xfs_inode *, int);
 
+extern xfs_filblks_t xfs_bmbt_calc_size(struct xfs_mount *mp,
+		unsigned long len);
+
 #endif	/* __XFS_BMAP_BTREE_H__ */
libxfs/xfs_btree.c +28 -0
index 658f27e..d5f16c5 100644
@@ -4081,6 +4081,34 @@ xfs_btree_change_owner(
 	return 0;
 }
 
+/*
+ * xfs_btree_calc_size() -- Calculate the number of blocks needed to store
+ *			    a given number of records.
+ */
+xfs_filblks_t
+xfs_btree_calc_size(
+	struct xfs_mount	*mp,
+	uint			*limits,
+	int			maxlevels,
+	unsigned long		len)
+{
+	int			level;
+	int			maxrecs;
+	xfs_filblks_t		rval;
+
+	maxrecs = limits[0];
+	for (level = 0, rval = 0; level < maxlevels; level++) {
+		len += maxrecs - 1;
+		do_div(len, maxrecs);
+		rval += len;
+		if (len == 1)
+			return rval + maxlevels - level - 1;
+		if (level == 0)
+			maxrecs = limits[1];
+	}
+	return rval;
+}
+
 /**
  * xfs_btree_sblock_v5hdr_verify() -- verify the v5 fields of a short-format
  *				      btree block
libxfs/xfs_btree.h +3 -0
index 48cb251..b25ffd3 100644
@@ -465,6 +465,9 @@ static inline int xfs_btree_get_level(struct xfs_btree_block *block)
 #define XFS_BTREE_TRACE_ARGR(c, r)
 #define	XFS_BTREE_TRACE_CURSOR(c, t)
 
+xfs_filblks_t xfs_btree_calc_size(struct xfs_mount *mp, uint *limits,
+		int maxlevels, unsigned long len);
+
 bool xfs_btree_sblock_v5hdr_verify(struct xfs_buf *bp);
 bool xfs_btree_sblock_verify(struct xfs_buf *bp, unsigned int max_recs);
 
Quoted 4 lines

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

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

#5 lore raw

Re: [PATCH 2/5] libxfs: refactor the btree size calculator code

Quoted 54 lines · Darrick J. Wong
Quoted 32 lines · Darrick J. Wong

Create a macro to generate btree height calculator functions. This will be used (much) later when we get to the refcount btree.

---
 libxfs/xfs_bmap.c       |   18 +-----------------
 libxfs/xfs_bmap_btree.c |    9 +++++++++
 libxfs/xfs_bmap_btree.h |    3 +++
 libxfs/xfs_btree.c      |   28 ++++++++++++++++++++++++++++
 libxfs/xfs_btree.h      |    3 +++
 5 files changed, 44 insertions(+), 17 deletions(-)
libxfs/xfs_bmap.c +0 -8
index aef7cf3..c134765 100644
@@ -172,25 +172,9 @@ xfs_bmap_worst_indlen(
 	xfs_inode_t	*ip,		/* incore inode pointer */
 	xfs_filblks_t	len)		/* delayed extent length */
 {
-	int		level;		/* btree level number */
-	int		maxrecs;	/* maximum record count at this level */
-	xfs_mount_t	*mp;		/* mount structure */
 	xfs_filblks_t	rval;		/* return value */
 
-	mp = ip->i_mount;
-	maxrecs = mp->m_bmap_dmxr[0];
-	for (level = 0, rval = 0;
-	     level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
-	     level++) {

libxfs/xfs_bmap.c xfs_bmap_worst_indlen( · line 177

Quoted 10 lines
libxfs/xfs_bmap.c +1 -9
-		len += maxrecs - 1;
-		do_div(len, maxrecs);
-		rval += len;
-		if (len == 1)
-			return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
-				level - 1;
-		if (level == 0)
-			maxrecs = mp->m_bmap_dmxr[1];
-	}
+	rval = xfs_bmbt_calc_size(ip->i_mount, len);

NAK. This function figures out how many blocks could be required to handle adding (worst-case one-extent-per-block) extents to the bmbt and btree splits all the way up the tree, whereas xfs_btree_calc_size() merely calculates the number of blocks needed to create a tree with some number of records. When I start using the AG reservation code and counting the number of blocks in use at mount time, using the below xfs_btree_calc_size() to calculate the resevation size leads to undersized reservations, which (I think?) explains why I still occasionally run out of blocks when expanding the refcount tree, which is supposed to reserve /all/ the blocks it'll ever need.

Quoted 4 lines

This function should go back to the way it was, and the xfs_btree_calc_size() function will get fixed to calculate tree size correctly.

Also NAK on the kernelside version of this patch.

Thanks for the heads-up, Darrick. I hadn't pulled this in to either tree yet, because it hadn't got a reviewed-by. I guess that's a sign that the process is working as it should. :P

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 2/5] libxfs: refactor the btree size calculator code

Quoted 55 lines · Dave Chinner
Quoted 54 lines · Darrick J. Wong
Quoted 32 lines · Darrick J. Wong

Create a macro to generate btree height calculator functions. This will be used (much) later when we get to the refcount btree.

---
 libxfs/xfs_bmap.c       |   18 +-----------------
 libxfs/xfs_bmap_btree.c |    9 +++++++++
 libxfs/xfs_bmap_btree.h |    3 +++
 libxfs/xfs_btree.c      |   28 ++++++++++++++++++++++++++++
 libxfs/xfs_btree.h      |    3 +++
 5 files changed, 44 insertions(+), 17 deletions(-)
libxfs/xfs_bmap.c +0 -8
index aef7cf3..c134765 100644
@@ -172,25 +172,9 @@ xfs_bmap_worst_indlen(
 	xfs_inode_t	*ip,		/* incore inode pointer */
 	xfs_filblks_t	len)		/* delayed extent length */
 {
-	int		level;		/* btree level number */
-	int		maxrecs;	/* maximum record count at this level */
-	xfs_mount_t	*mp;		/* mount structure */
 	xfs_filblks_t	rval;		/* return value */
 
-	mp = ip->i_mount;
-	maxrecs = mp->m_bmap_dmxr[0];
-	for (level = 0, rval = 0;
-	     level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
-	     level++) {

libxfs/xfs_bmap.c xfs_bmap_worst_indlen( · line 177

Quoted 10 lines
libxfs/xfs_bmap.c +1 -9
-		len += maxrecs - 1;
-		do_div(len, maxrecs);
-		rval += len;
-		if (len == 1)
-			return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
-				level - 1;
-		if (level == 0)
-			maxrecs = mp->m_bmap_dmxr[1];
-	}
+	rval = xfs_bmbt_calc_size(ip->i_mount, len);

NAK. This function figures out how many blocks could be required to handle adding (worst-case one-extent-per-block) extents to the bmbt and btree splits all the way up the tree, whereas xfs_btree_calc_size() merely calculates the number of blocks needed to create a tree with some number of records. When I start using the AG reservation code and counting the number of blocks in use at mount time, using the below xfs_btree_calc_size() to calculate the resevation size leads to undersized reservations, which (I think?) explains why I still occasionally run out of blocks when expanding the refcount tree, which is supposed to reserve /all/ the blocks it'll ever need.

Quoted 8 lines
Quoted 4 lines

This function should go back to the way it was, and the xfs_btree_calc_size() function will get fixed to calculate tree size correctly.

Also NAK on the kernelside version of this patch.

Thanks for the heads-up, Darrick. I hadn't pulled this in to either tree yet, because it hadn't got a reviewed-by. I guess that's a sign that the process is working as it should. :P

lol. :)

I'll post a branch off of your for-next 4.6 branch soon; it'll have all the fixes that have been accumulating since the last RFC posting.

--D

Quoted 7 lines

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]

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

#7 lore raw

PATCH 3/5 libxfs: move struct xfs_attr_shortform to xfs_da_format.h

In reply to Darrick J. Wong

Move the shortform attr structure definition to the same place as the other attribute structure definitions for consistency and also so that xfs/122 verifies the structure size.

---
 libxfs/xfs_attr_sf.h    |   16 ----------------
 libxfs/xfs_da_format.h  |   16 ++++++++++++++++
 libxfs/xfs_inode_fork.c |    1 +
 3 files changed, 17 insertions(+), 16 deletions(-)
libxfs/xfs_attr_sf.h +0 -16
index 919756e..90928bb 100644
@@ -24,22 +24,6 @@
  * Small attribute lists are packed as tightly as possible so as
  * to fit into the literal area of the inode.
  */
-
-/*
- * Entries are packed toward the top as tight as possible.
- */
-typedef struct xfs_attr_shortform {
-	struct xfs_attr_sf_hdr {	/* constant-structure header block */
-		__be16	totsize;	/* total bytes in shortform list */
-		__u8	count;	/* count of active entries */
-	} hdr;
-	struct xfs_attr_sf_entry {
-		__uint8_t namelen;	/* actual length of name (no NULL) */
-		__uint8_t valuelen;	/* actual length of value (no NULL) */
-		__uint8_t flags;	/* flags bits (see xfs_attr_leaf.h) */
-		__uint8_t nameval[1];	/* name & value bytes concatenated */
-	} list[1];			/* variable sized array */
-} xfs_attr_shortform_t;
 typedef struct xfs_attr_sf_hdr xfs_attr_sf_hdr_t;
 typedef struct xfs_attr_sf_entry xfs_attr_sf_entry_t;
 
libxfs/xfs_da_format.h +16 -0
index b14bbd6..8d4d8bc 100644
@@ -641,6 +641,22 @@ xfs_dir2_block_leaf_p(struct xfs_dir2_block_tail *btp)
  */
 #define XFS_ATTR_LEAF_MAPSIZE	3	/* how many freespace slots */
 
+/*
+ * Entries are packed toward the top as tight as possible.
+ */
+typedef struct xfs_attr_shortform {
+	struct xfs_attr_sf_hdr {	/* constant-structure header block */
+		__be16	totsize;	/* total bytes in shortform list */
+		__u8	count;	/* count of active entries */
+	} hdr;
+	struct xfs_attr_sf_entry {
+		__uint8_t namelen;	/* actual length of name (no NULL) */
+		__uint8_t valuelen;	/* actual length of value (no NULL) */
+		__uint8_t flags;	/* flags bits (see xfs_attr_leaf.h) */
+		__uint8_t nameval[1];	/* name & value bytes concatenated */
+	} list[1];			/* variable sized array */
+} xfs_attr_shortform_t;
+
 typedef struct xfs_attr_leaf_map {	/* RLE map of free bytes */
 	__be16	base;			  /* base of free region */
 	__be16	size;			  /* length of free region */
libxfs/xfs_inode_fork.c +1 -0
index e1968b4..f40649e 100644
@@ -27,6 +27,7 @@
 #include "xfs_bmap.h"
 #include "xfs_trace.h"
 #include "xfs_attr_sf.h"
+#include "xfs_da_format.h"
 
 kmem_zone_t *xfs_ifork_zone;
 

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

Reviewed-by on v1 3/5
#8 lore raw

Re: [PATCH 3/5] libxfs: move struct xfs_attr_shortform to xfs_da_format.h

Quoted 5 lines · Darrick J. Wong

Move the shortform attr structure definition to the same place as the other attribute structure definitions for consistency and also so that xfs/122 verifies the structure size.

Quoted 74 lines
---
 libxfs/xfs_attr_sf.h    |   16 ----------------
 libxfs/xfs_da_format.h  |   16 ++++++++++++++++
 libxfs/xfs_inode_fork.c |    1 +
 3 files changed, 17 insertions(+), 16 deletions(-)
libxfs/xfs_attr_sf.h +0 -16
index 919756e..90928bb 100644
@@ -24,22 +24,6 @@
  * Small attribute lists are packed as tightly as possible so as
  * to fit into the literal area of the inode.
  */
-
-/*
- * Entries are packed toward the top as tight as possible.
- */
-typedef struct xfs_attr_shortform {
-	struct xfs_attr_sf_hdr {	/* constant-structure header block */
-		__be16	totsize;	/* total bytes in shortform list */
-		__u8	count;	/* count of active entries */
-	} hdr;
-	struct xfs_attr_sf_entry {
-		__uint8_t namelen;	/* actual length of name (no NULL) */
-		__uint8_t valuelen;	/* actual length of value (no NULL) */
-		__uint8_t flags;	/* flags bits (see xfs_attr_leaf.h) */
-		__uint8_t nameval[1];	/* name & value bytes concatenated */
-	} list[1];			/* variable sized array */
-} xfs_attr_shortform_t;
 typedef struct xfs_attr_sf_hdr xfs_attr_sf_hdr_t;
 typedef struct xfs_attr_sf_entry xfs_attr_sf_entry_t;
 
libxfs/xfs_da_format.h +16 -0
index b14bbd6..8d4d8bc 100644
@@ -641,6 +641,22 @@ xfs_dir2_block_leaf_p(struct xfs_dir2_block_tail *btp)
  */
 #define XFS_ATTR_LEAF_MAPSIZE	3	/* how many freespace slots */
 
+/*
+ * Entries are packed toward the top as tight as possible.
+ */
+typedef struct xfs_attr_shortform {
+	struct xfs_attr_sf_hdr {	/* constant-structure header block */
+		__be16	totsize;	/* total bytes in shortform list */
+		__u8	count;	/* count of active entries */
+	} hdr;
+	struct xfs_attr_sf_entry {
+		__uint8_t namelen;	/* actual length of name (no NULL) */
+		__uint8_t valuelen;	/* actual length of value (no NULL) */
+		__uint8_t flags;	/* flags bits (see xfs_attr_leaf.h) */
+		__uint8_t nameval[1];	/* name & value bytes concatenated */
+	} list[1];			/* variable sized array */
+} xfs_attr_shortform_t;
+
 typedef struct xfs_attr_leaf_map {	/* RLE map of free bytes */
 	__be16	base;			  /* base of free region */
 	__be16	size;			  /* length of free region */
libxfs/xfs_inode_fork.c +1 -0
index e1968b4..f40649e 100644
@@ -27,6 +27,7 @@
 #include "xfs_bmap.h"
 #include "xfs_trace.h"
 #include "xfs_attr_sf.h"
+#include "xfs_da_format.h"
 
 kmem_zone_t *xfs_ifork_zone;
 
Quoted 5 lines

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

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

#9 lore raw

PATCH 4/5 xfs_db: don't error out when blocksize > 64 * inodesize

In reply to Darrick J. Wong

When the block size is large enough that multiple inode chunks can fit in a single block (e.g. 64k blocks, 512 byte inodes) we must calculate the per-chunk block size and the buffer offset correctly so that check actually examines the correct metadata.

---
 db/check.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
db/check.c +9 -4
index 838db53..4e2768e 100644
@@ -4386,6 +4386,7 @@ scanfunc_ino(
 	__u16			holemask;
 	xfs_agino_t		rino;
 	xfs_extlen_t		cblocks;
+	int			bufoff;
 
 	if (be32_to_cpu(block->bb_magic) != XFS_IBT_MAGIC &&
 	    be32_to_cpu(block->bb_magic) != XFS_IBT_CRC_MAGIC) {
@@ -4455,6 +4456,8 @@ scanfunc_ino(
 				rino = agino + startidx;
 				cblocks = (endidx - startidx) >>
 						mp->m_sb.sb_inopblog;
+				if (cblocks == 0)
+					cblocks = 1;
 
 				/* Check the sparse chunk alignment */
 				if (sparse &&
@@ -4468,8 +4471,9 @@ scanfunc_ino(
 				}
 
 				/* Check the block map */
-				set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, rino),
-					cblocks, DBM_INODE, seqno, bno);
+				if (XFS_AGINO_TO_OFFSET(mp, rino) == 0)
+					set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, rino),
+						cblocks, DBM_INODE, seqno, bno);
 
 				push_cur();
 				set_cur(&typtab[TYP_INODE],
@@ -4489,14 +4493,15 @@ scanfunc_ino(
 				}
 
 				/* Examine each inode in this chunk */
-				for (j = startidx; j < endidx; j++) {
+				bufoff = ((XFS_AGINO_TO_OFFSET(mp, rino) - startidx) << mp->m_sb.sb_inodelog);
+				for (j = startidx; j < endidx; j++, bufoff += (1 << mp->m_sb.sb_inodelog)) {
 					if (ino_issparse(&rp[i], j))
 						continue;
 					isfree = XFS_INOBT_IS_FREE_DISK(&rp[i], j);
 					if (isfree)
 						nfree++;
 					process_inode(agf, agino + j,
-						(xfs_dinode_t *)((char *)iocur_top->data + ((j - startidx) << mp->m_sb.sb_inodelog)),
+						(xfs_dinode_t *)((char *)iocur_top->data + bufoff),
 							isfree);
 				}
 				pop_cur();

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

#10 lore raw

Re: [PATCH 4/5] xfs_db: don't error out when blocksize > 64 * inodesize

Quoted 24 lines · Darrick J. Wong

When the block size is large enough that multiple inode chunks can fit in a single block (e.g. 64k blocks, 512 byte inodes) we must calculate the per-chunk block size and the buffer offset correctly so that check actually examines the correct metadata.

---
 db/check.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
db/check.c +1 -0
index 838db53..4e2768e 100644
@@ -4386,6 +4386,7 @@ scanfunc_ino(
 	__u16			holemask;
 	xfs_agino_t		rino;
 	xfs_extlen_t		cblocks;
+	int			bufoff;
 
 	if (be32_to_cpu(block->bb_magic) != XFS_IBT_MAGIC &&
 	    be32_to_cpu(block->bb_magic) != XFS_IBT_CRC_MAGIC) {

db/check.c scanfunc_ino( · line 4460

Quoted 5 lines
db/check.c +2 -0
@@ -4455,6 +4456,8 @@ scanfunc_ino(
 				rino = agino + startidx;
 				cblocks = (endidx - startidx) >>
 						mp->m_sb.sb_inopblog;
+				if (cblocks == 0)
+					cblocks = 1;

A comment would be nice here (i.e., "handle the case where the entire chunk is in a single block").

Quoted 16 lines
db/check.c +3 -2
 				/* Check the sparse chunk alignment */
 				if (sparse &&
@@ -4468,8 +4471,9 @@ scanfunc_ino(
 				}
 
 				/* Check the block map */
-				set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, rino),
-					cblocks, DBM_INODE, seqno, bno);
+				if (XFS_AGINO_TO_OFFSET(mp, rino) == 0)
+					set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, rino),
+						cblocks, DBM_INODE, seqno, bno);
 
 				push_cur();
 				set_cur(&typtab[TYP_INODE],

db/check.c scanfunc_ino( · line 4497

Quoted 6 lines
db/check.c +2 -1
@@ -4489,14 +4493,15 @@ scanfunc_ino(
 				}
 
 				/* Examine each inode in this chunk */
-				for (j = startidx; j < endidx; j++) {
+				bufoff = ((XFS_AGINO_TO_OFFSET(mp, rino) - startidx) << mp->m_sb.sb_inodelog);
+				for (j = startidx; j < endidx; j++, bufoff += (1 << mp->m_sb.sb_inodelog)) {

Here as well.

Though, does this work for sparse inodes? Suppose we start halfway into a sparse inode record. So XFS_AGINO_TO_OFFSET(mp, rino) is 0 since we're at the first inode of the fs block; and say startidx is 32 as that could be the first real inode index in the record. It looks like we could go off the rails in that case..?

Brian

Quoted 12 lines
db/check.c +1 -1
 					if (ino_issparse(&rp[i], j))
 						continue;
 					isfree = XFS_INOBT_IS_FREE_DISK(&rp[i], j);
 					if (isfree)
 						nfree++;
 					process_inode(agf, agino + j,
-						(xfs_dinode_t *)((char *)iocur_top->data + ((j - startidx) << mp->m_sb.sb_inodelog)),
+						(xfs_dinode_t *)((char *)iocur_top->data + bufoff),
 							isfree);
 				}
 				pop_cur();
Quoted 4 lines

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

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

#11 lore raw

PATCH 5/5 xfs_io: print dedupe errors to stderr, not stdout

In reply to Darrick J. Wong
---
 io/reflink.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
io/reflink.c +4 -2
index def01be..a09e82d 100644
@@ -78,11 +78,13 @@ dedupe_ioctl(
 			goto done;
 		}
 		if (info->status < 0) {
-			printf("dedupe: %s\n", _(strerror(-info->status)));
+			fprintf(stderr, "dedupe: %s\n",
+					_(strerror(-info->status)));
 			goto done;
 		}
 		if (info->status == XFS_EXTENT_DATA_DIFFERS) {
-			printf(_("Extents did not match.\n"));
+			fprintf(stderr, "dedupe: %s\n",
+					_("Extents did not match."));
 			goto done;
 		}
 		if (args->length != 0 &&

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

#12 lore raw

Re: [PATCH 5/5] xfs_io: print dedupe errors to stderr, not stdout

Quoted 16 lines · Darrick J. Wong
---
 io/reflink.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
io/reflink.c +1 -1
index def01be..a09e82d 100644
@@ -78,11 +78,13 @@ dedupe_ioctl(
 			goto done;
 		}
 		if (info->status < 0) {
-			printf("dedupe: %s\n", _(strerror(-info->status)));
+			fprintf(stderr, "dedupe: %s\n",

io/reflink.c dedupe_ioctl( · line 90

Quoted 10 lines
io/reflink.c +3 -1
+					_(strerror(-info->status)));
 			goto done;
 		}
 		if (info->status == XFS_EXTENT_DATA_DIFFERS) {
-			printf(_("Extents did not match.\n"));
+			fprintf(stderr, "dedupe: %s\n",
+					_("Extents did not match."));
 			goto done;
 		}
 		if (args->length != 0 &&

I think this patch breaks dedupe detection in xfstests. I see the dedupe tests running instead of being detected as not supported, and all the diffs from test failures contain:

+dedupe: Invalid argument

This is on 4.5-rc2, so I suspect it's not returning the expected "not supported" error to xfstests from the ioctl.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 5/5] xfs_io: print dedupe errors to stderr, not stdout

Quoted 32 lines · Dave Chinner
Quoted 16 lines · Darrick J. Wong
---
 io/reflink.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
io/reflink.c +1 -1
index def01be..a09e82d 100644
@@ -78,11 +78,13 @@ dedupe_ioctl(
 			goto done;
 		}
 		if (info->status < 0) {
-			printf("dedupe: %s\n", _(strerror(-info->status)));
+			fprintf(stderr, "dedupe: %s\n",

io/reflink.c dedupe_ioctl( · line 90

Quoted 10 lines
io/reflink.c +3 -1
+					_(strerror(-info->status)));
 			goto done;
 		}
 		if (info->status == XFS_EXTENT_DATA_DIFFERS) {
-			printf(_("Extents did not match.\n"));
+			fprintf(stderr, "dedupe: %s\n",
+					_("Extents did not match."));
 			goto done;
 		}
 		if (args->length != 0 &&

I think this patch breaks dedupe detection in xfstests. I see the dedupe tests running instead of being detected as not supported, and all the diffs from test failures contain:

Quoted 4 lines

+dedupe: Invalid argument

This is on 4.5-rc2, so I suspect it's not returning the expected "not supported" error to xfstests from the ioctl.

Christoph sent a patch "[PATCH 3/4] xfstests: also treat EINVAL as reflink/dedup not supported" to take care of that.

--D

Quoted 7 lines

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]

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

#14 lore raw

Re: [PATCH 5/5] xfs_io: print dedupe errors to stderr, not stdout

In reply to Dave Chinner
Quoted 32 lines · Dave Chinner
Quoted 16 lines · Darrick J. Wong
---
 io/reflink.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
io/reflink.c +1 -1
index def01be..a09e82d 100644
@@ -78,11 +78,13 @@ dedupe_ioctl(
 			goto done;
 		}
 		if (info->status < 0) {
-			printf("dedupe: %s\n", _(strerror(-info->status)));
+			fprintf(stderr, "dedupe: %s\n",

io/reflink.c dedupe_ioctl( · line 90

Quoted 10 lines
io/reflink.c +3 -1
+					_(strerror(-info->status)));
 			goto done;
 		}
 		if (info->status == XFS_EXTENT_DATA_DIFFERS) {
-			printf(_("Extents did not match.\n"));
+			fprintf(stderr, "dedupe: %s\n",
+					_("Extents did not match."));
 			goto done;
 		}
 		if (args->length != 0 &&

I think this patch breaks dedupe detection in xfstests. I see the dedupe tests running instead of being detected as not supported, and all the diffs from test failures contain:

Quoted 4 lines

+dedupe: Invalid argument

This is on 4.5-rc2, so I suspect it's not returning the expected "not supported" error to xfstests from the ioctl.

Oh, never mind. I just found the xfstests patches Christoph sent to the wrong list that will fix this.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#15 lore raw
In reply to Darrick J. Wong
Quoted 1 line · Darrick J. Wong

Configure getopt to accept the -R argument to pwrite.

Did you have anything against "F" and "B"? :)

(They're missing too but in the case statements & help)

-Eric

Quoted 20 lines
---
 io/pwrite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/pwrite.c +1 -1
index fd9114d..c6efee9 100644
@@ -259,7 +259,7 @@ pwrite_f(
 	init_cvtnum(&fsblocksize, &fssectsize);
 	bsize = fsblocksize;
 
-	while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
+	while ((c = getopt(argc, argv, "b:Cdf:i:qRs:S:uV:wWZ:")) != EOF) {
 		switch (c) {
 		case 'b':
 			tmp = cvtnum(fsblocksize, fssectsize, optarg);
Quoted 5 lines

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

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

#16 lore raw
Quoted 6 lines · Eric Sandeen
Quoted 1 line · Darrick J. Wong

Configure getopt to accept the -R argument to pwrite.

Did you have anything against "F" and "B"? :)

(They're missing too but in the case statements & help)

No, but I /was/ wondering if the omission was deliberate?

--D

Quoted 23 lines

-Eric

Quoted 20 lines
---
 io/pwrite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/pwrite.c +1 -1
index fd9114d..c6efee9 100644
@@ -259,7 +259,7 @@ pwrite_f(
 	init_cvtnum(&fsblocksize, &fssectsize);
 	bsize = fsblocksize;
 
-	while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
+	while ((c = getopt(argc, argv, "b:Cdf:i:qRs:S:uV:wWZ:")) != EOF) {
 		switch (c) {
 		case 'b':
 			tmp = cvtnum(fsblocksize, fssectsize, optarg);
Quoted 10 lines
Quoted 5 lines

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

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

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

#17 lore raw
Quoted 9 lines · Darrick J. Wong
Quoted 6 lines · Eric Sandeen
Quoted 1 line · Darrick J. Wong

Configure getopt to accept the -R argument to pwrite.

Did you have anything against "F" and "B"? :)

(They're missing too but in the case statements & help)

No, but I /was/ wondering if the omission was deliberate?

I don't think so; the commit that added it (8fb2237) seemed to do everything but add the getopt chars.

Oh, and however much gets fixed up, probably needs a man page update too.

Thanks,
-Eric

Quoted 36 lines

--D

Quoted 23 lines

-Eric

Quoted 20 lines
---
 io/pwrite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/pwrite.c +1 -1
index fd9114d..c6efee9 100644
@@ -259,7 +259,7 @@ pwrite_f(
 	init_cvtnum(&fsblocksize, &fssectsize);
 	bsize = fsblocksize;
 
-	while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
+	while ((c = getopt(argc, argv, "b:Cdf:i:qRs:S:uV:wWZ:")) != EOF) {
 		switch (c) {
 		case 'b':
 			tmp = cvtnum(fsblocksize, fssectsize, optarg);
Quoted 10 lines
Quoted 5 lines

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

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

Quoted 5 lines

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

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

#18 lore raw
Quoted 11 lines · Eric Sandeen
Quoted 8 lines · Darrick J. Wong
Quoted 6 lines · Eric Sandeen
Quoted 1 line · Darrick J. Wong

Configure getopt to accept the -R argument to pwrite.

Did you have anything against "F" and "B"? :)

(They're missing too but in the case statements & help)

Quoted 7 lines
Quoted 1 line

No, but I /was/ wondering if the omission was deliberate?

I don't think so; the commit that added it (8fb2237) seemed to do everything but add the getopt chars.

Oh, and however much gets fixed up, probably needs a man page update too.

The manpage already has -F/-B/-R, but you're right that I should add -F and -B to getopt.

--D

Quoted 46 lines

Thanks,
-Eric

Quoted 36 lines

--D

Quoted 23 lines

-Eric

Quoted 20 lines
---
 io/pwrite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/pwrite.c +1 -1
index fd9114d..c6efee9 100644
@@ -259,7 +259,7 @@ pwrite_f(
 	init_cvtnum(&fsblocksize, &fssectsize);
 	bsize = fsblocksize;
 
-	while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
+	while ((c = getopt(argc, argv, "b:Cdf:i:qRs:S:uV:wWZ:")) != EOF) {
 		switch (c) {
 		case 'b':
 			tmp = cvtnum(fsblocksize, fssectsize, optarg);
Quoted 10 lines
Quoted 5 lines

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

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

Quoted 5 lines

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

Quoted 4 lines

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

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

#19 lore raw

PATCH v2 1/5 xfs_io: detect the '-R' option in getopt

In reply to Darrick J. Wong

Configure getopt to accept the -R argument to pwrite.

v2: Accept -F and -B while we're at it.

---
 io/pwrite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/pwrite.c +1 -1
index fd9114d..4fc8de6 100644
@@ -259,7 +259,7 @@ pwrite_f(
 	init_cvtnum(&fsblocksize, &fssectsize);
 	bsize = fsblocksize;
 
-	while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
+	while ((c = getopt(argc, argv, "b:BCdf:Fi:qRs:S:uV:wWZ:")) != EOF) {
 		switch (c) {
 		case 'b':
 			tmp = cvtnum(fsblocksize, fssectsize, optarg);

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

Reviewed-by on v2 1/5
#20 lore raw

Rockin!

Quoted 23 lines · Darrick J. Wong

Configure getopt to accept the -R argument to pwrite.

v2: Accept -F and -B while we're at it.

---
 io/pwrite.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io/pwrite.c +1 -1
index fd9114d..4fc8de6 100644
@@ -259,7 +259,7 @@ pwrite_f(
 	init_cvtnum(&fsblocksize, &fssectsize);
 	bsize = fsblocksize;
 
-	while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
+	while ((c = getopt(argc, argv, "b:BCdf:Fi:qRs:S:uV:wWZ:")) != EOF) {
 		switch (c) {
 		case 'b':
 			tmp = cvtnum(fsblocksize, fssectsize, optarg);
Quoted 5 lines

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

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

#21 lore raw

[PATCH 6/5] mkfs: factor finobt changes into min log size when formatting

In reply to Darrick J. Wong

Since the finobt affects the size of the log reservations, we need to be able to include its effects in the calculation of the minimum log size.

(Not really a problem now, but adding rmapbt will give this one some bite.)

---
 mkfs/maxtrres.c |    5 ++++-
 mkfs/xfs_mkfs.c |    2 +-
 mkfs/xfs_mkfs.h |    2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
mkfs/maxtrres.c +4 -1
index e1d5ee9..b97d020 100644
@@ -36,7 +36,8 @@ max_trans_res(
 	int		inodelog,
 	int		dirblocklog,
 	int		logversion,
-	int		log_sunit)
+	int		log_sunit,
+	int		finobt)
 {
 	xfs_sb_t	*sbp;
 	xfs_mount_t	mount;
@@ -68,6 +69,8 @@ max_trans_res(
 			(dirversion == 2 ? XFS_SB_VERSION_DIRV2BIT : 0) |
 			(logversion > 1 ? XFS_SB_VERSION_LOGV2BIT : 0) |
 			XFS_DFL_SB_VERSION_BITS;
+	if (finobt)
+		sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_FINOBT;
 
 	libxfs_mount(&mount, sbp, 0,0,0,0);
 	maxfsb = xfs_log_calc_minimum_size(&mount);
mkfs/xfs_mkfs.c +1 -1
index 700d12c..4c3a802 100644
@@ -2406,7 +2406,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
 
 	min_logblocks = max_trans_res(crcs_enabled, dirversion,
 				   sectorlog, blocklog, inodelog, dirblocklog,
-				   logversion, lsunit);
+				   logversion, lsunit, finobt);
 	ASSERT(min_logblocks);
 	min_logblocks = MAX(XFS_MIN_LOG_BLOCKS, min_logblocks);
 	if (!logsize && dblocks >= (1024*1024*1024) >> blocklog)
mkfs/xfs_mkfs.h +1 -1
index 9df5f37..128068e 100644
@@ -84,6 +84,6 @@ extern void res_failed (int err);
 /* maxtrres.c */
 extern int max_trans_res (int crcs_enabled, int dirversion,
 		int sectorlog, int blocklog, int inodelog, int dirblocklog,
-		int logversion, int log_sunit);
+		int logversion, int log_sunit, int finobt);
 
 #endif	/* __XFS_MKFS_H__ */

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

Reviewed-by
#22 lore raw

Re: [PATCH 6/5] mkfs: factor finobt changes into min log size when formatting

Quoted 9 lines · Darrick J. Wong

Since the finobt affects the size of the log reservations, we need to be able to include its effects in the calculation of the minimum log size.

(Not really a problem now, but adding rmapbt will give this one some bite.)

---

Quoted 54 lines
 mkfs/maxtrres.c |    5 ++++-
 mkfs/xfs_mkfs.c |    2 +-
 mkfs/xfs_mkfs.h |    2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
mkfs/maxtrres.c +4 -1
index e1d5ee9..b97d020 100644
@@ -36,7 +36,8 @@ max_trans_res(
 	int		inodelog,
 	int		dirblocklog,
 	int		logversion,
-	int		log_sunit)
+	int		log_sunit,
+	int		finobt)
 {
 	xfs_sb_t	*sbp;
 	xfs_mount_t	mount;
@@ -68,6 +69,8 @@ max_trans_res(
 			(dirversion == 2 ? XFS_SB_VERSION_DIRV2BIT : 0) |
 			(logversion > 1 ? XFS_SB_VERSION_LOGV2BIT : 0) |
 			XFS_DFL_SB_VERSION_BITS;
+	if (finobt)
+		sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_FINOBT;
 
 	libxfs_mount(&mount, sbp, 0,0,0,0);
 	maxfsb = xfs_log_calc_minimum_size(&mount);
mkfs/xfs_mkfs.c +1 -1
index 700d12c..4c3a802 100644
@@ -2406,7 +2406,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
 
 	min_logblocks = max_trans_res(crcs_enabled, dirversion,
 				   sectorlog, blocklog, inodelog, dirblocklog,
-				   logversion, lsunit);
+				   logversion, lsunit, finobt);
 	ASSERT(min_logblocks);
 	min_logblocks = MAX(XFS_MIN_LOG_BLOCKS, min_logblocks);
 	if (!logsize && dblocks >= (1024*1024*1024) >> blocklog)
mkfs/xfs_mkfs.h +1 -1
index 9df5f37..128068e 100644
@@ -84,6 +84,6 @@ extern void res_failed (int err);
 /* maxtrres.c */
 extern int max_trans_res (int crcs_enabled, int dirversion,
 		int sectorlog, int blocklog, int inodelog, int dirblocklog,
-		int logversion, int log_sunit);
+		int logversion, int log_sunit, int finobt);
 
 #endif	/* __XFS_MKFS_H__ */
Quoted 4 lines

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

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