All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] xfsprogs: fixes and updates
@ 2022-04-26 23:44 Dave Chinner
  2022-04-26 23:44 ` [PATCH 1/4] metadump: handle corruption errors without aborting Dave Chinner
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Dave Chinner @ 2022-04-26 23:44 UTC (permalink / raw)
  To: linux-xfs

Hi folks,

A handful of patches I have lying around for xfsprogs. The first two
are fixes for metadump when handling corrupt filesystems with bad
inode fork layouts. The third is a patch I've used for testing
bulkstat scalability to minimise userspace CPU overhead so I can
drive the kernel code as hard as possible. The last is an autoconf
updates to silence a bunch of build warnings I now get with the
latest and greatest autoconf releases.

Applies against v5.15.0.

Cheers,

Dave.



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

* [PATCH 1/4] metadump: handle corruption errors without aborting
  2022-04-26 23:44 [PATCH 0/4] xfsprogs: fixes and updates Dave Chinner
@ 2022-04-26 23:44 ` Dave Chinner
  2022-04-27  0:45   ` Darrick J. Wong
  2022-04-26 23:44 ` [PATCH 2/4] metadump: be careful zeroing corrupt inode forks Dave Chinner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: Dave Chinner @ 2022-04-26 23:44 UTC (permalink / raw)
  To: linux-xfs

From: Dave Chinner <dchinner@redhat.com>

Sean Caron reported that a metadump terminated after givin gthis
warning:

xfs_metadump: inode 2216156864 has unexpected extents

Metadump is supposed to ignore corruptions and continue dumping the
filesystem as best it can. Whilst it warns about many situations
where it can't fully dump structures, it should stop processing that
structure and continue with the next one until the entire filesystem
has been processed.

Unfortunately, some warning conditions also return an "abort" error
status, causing metadump to abort if that condition is hit. Most of
these abort conditions should really be "continue on next object"
conditions so that the we attempt to dump the rest of the
filesystem.

Fix the returns for warnings that incorrectly cause aborts
such that the only abort conditions are read errors when
"stop-on-read-error" semantics are specified. Also make the return
values consistently mean abort/continue rather than returning -errno
to mean "stop because read error" and then trying to infer what
the error means in callers without the context it occurred in.

Reported-and-tested-by: Sean Caron <scaron@umich.edu>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 db/metadump.c | 94 +++++++++++++++++++++++++--------------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/db/metadump.c b/db/metadump.c
index 48cda88a3ea5..a21baa2070d9 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1645,7 +1645,7 @@ process_symlink_block(
 {
 	struct bbmap	map;
 	char		*link;
-	int		ret = 0;
+	int		rval = 1;
 
 	push_cur();
 	map.nmaps = 1;
@@ -1658,8 +1658,7 @@ process_symlink_block(
 
 		print_warning("cannot read %s block %u/%u (%llu)",
 				typtab[btype].name, agno, agbno, s);
-		if (stop_on_read_error)
-			ret = -1;
+		rval = !stop_on_read_error;
 		goto out_pop;
 	}
 	link = iocur_top->data;
@@ -1682,10 +1681,11 @@ process_symlink_block(
 	}
 
 	iocur_top->need_crc = 1;
-	ret = write_buf(iocur_top);
+	if (write_buf(iocur_top))
+		rval = 0;
 out_pop:
 	pop_cur();
-	return ret;
+	return rval;
 }
 
 #define MAX_REMOTE_VALS		4095
@@ -1843,8 +1843,8 @@ process_single_fsb_objects(
 	typnm_t		btype,
 	xfs_fileoff_t	last)
 {
+	int		rval = 1;
 	char		*dp;
-	int		ret = 0;
 	int		i;
 
 	for (i = 0; i < c; i++) {
@@ -1858,8 +1858,7 @@ process_single_fsb_objects(
 
 			print_warning("cannot read %s block %u/%u (%llu)",
 					typtab[btype].name, agno, agbno, s);
-			if (stop_on_read_error)
-				ret = -EIO;
+			rval = !stop_on_read_error;
 			goto out_pop;
 
 		}
@@ -1925,16 +1924,17 @@ process_single_fsb_objects(
 		}
 
 write:
-		ret = write_buf(iocur_top);
+		if (write_buf(iocur_top))
+			rval = 0;
 out_pop:
 		pop_cur();
-		if (ret)
+		if (!rval)
 			break;
 		o++;
 		s++;
 	}
 
-	return ret;
+	return rval;
 }
 
 /*
@@ -1952,7 +1952,7 @@ process_multi_fsb_dir(
 	xfs_fileoff_t	last)
 {
 	char		*dp;
-	int		ret = 0;
+	int		rval = 1;
 
 	while (c > 0) {
 		unsigned int	bm_len;
@@ -1978,8 +1978,7 @@ process_multi_fsb_dir(
 
 				print_warning("cannot read %s block %u/%u (%llu)",
 						typtab[btype].name, agno, agbno, s);
-				if (stop_on_read_error)
-					ret = -1;
+				rval = !stop_on_read_error;
 				goto out_pop;
 
 			}
@@ -1998,18 +1997,19 @@ process_multi_fsb_dir(
 			}
 			iocur_top->need_crc = 1;
 write:
-			ret = write_buf(iocur_top);
+			if (write_buf(iocur_top))
+				rval = 0;
 out_pop:
 			pop_cur();
 			mfsb_map.nmaps = 0;
-			if (ret)
+			if (!rval)
 				break;
 		}
 		c -= bm_len;
 		s += bm_len;
 	}
 
-	return ret;
+	return rval;
 }
 
 static bool
@@ -2039,15 +2039,15 @@ process_multi_fsb_objects(
 		return process_symlink_block(o, s, c, btype, last);
 	default:
 		print_warning("bad type for multi-fsb object %d", btype);
-		return -EINVAL;
+		return 1;
 	}
 }
 
 /* inode copy routines */
 static int
 process_bmbt_reclist(
-	xfs_bmbt_rec_t 		*rp,
-	int 			numrecs,
+	xfs_bmbt_rec_t		*rp,
+	int			numrecs,
 	typnm_t			btype)
 {
 	int			i;
@@ -2059,7 +2059,7 @@ process_bmbt_reclist(
 	xfs_agnumber_t		agno;
 	xfs_agblock_t		agbno;
 	bool			is_multi_fsb = is_multi_fsb_object(mp, btype);
-	int			error;
+	int			rval = 1;
 
 	if (btype == TYP_DATA)
 		return 1;
@@ -2123,16 +2123,16 @@ process_bmbt_reclist(
 
 		/* multi-extent blocks require special handling */
 		if (is_multi_fsb)
-			error = process_multi_fsb_objects(o, s, c, btype,
+			rval = process_multi_fsb_objects(o, s, c, btype,
 					last);
 		else
-			error = process_single_fsb_objects(o, s, c, btype,
+			rval = process_single_fsb_objects(o, s, c, btype,
 					last);
-		if (error)
-			return 0;
+		if (!rval)
+			break;
 	}
 
-	return 1;
+	return rval;
 }
 
 static int
@@ -2331,7 +2331,7 @@ process_inode_data(
 	return 1;
 }
 
-static int
+static void
 process_dev_inode(
 	xfs_dinode_t		*dip)
 {
@@ -2339,15 +2339,13 @@ process_dev_inode(
 		if (show_warnings)
 			print_warning("inode %llu has unexpected extents",
 				      (unsigned long long)cur_ino);
-		return 0;
-	} else {
-		if (zero_stale_data) {
-			unsigned int	size = sizeof(xfs_dev_t);
+		return;
+	}
+	if (zero_stale_data) {
+		unsigned int	size = sizeof(xfs_dev_t);
 
-			memset(XFS_DFORK_DPTR(dip) + size, 0,
-					XFS_DFORK_DSIZE(dip, mp) - size);
-		}
-		return 1;
+		memset(XFS_DFORK_DPTR(dip) + size, 0,
+				XFS_DFORK_DSIZE(dip, mp) - size);
 	}
 }
 
@@ -2365,11 +2363,10 @@ process_inode(
 	xfs_dinode_t 		*dip,
 	bool			free_inode)
 {
-	int			success;
+	int			rval = 1;
 	bool			crc_was_ok = false; /* no recalc by default */
 	bool			need_new_crc = false;
 
-	success = 1;
 	cur_ino = XFS_AGINO_TO_INO(mp, agno, agino);
 
 	/* we only care about crc recalculation if we will modify the inode. */
@@ -2390,32 +2387,34 @@ process_inode(
 	/* copy appropriate data fork metadata */
 	switch (be16_to_cpu(dip->di_mode) & S_IFMT) {
 		case S_IFDIR:
-			success = process_inode_data(dip, TYP_DIR2);
+			rval = process_inode_data(dip, TYP_DIR2);
 			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
 				need_new_crc = 1;
 			break;
 		case S_IFLNK:
-			success = process_inode_data(dip, TYP_SYMLINK);
+			rval = process_inode_data(dip, TYP_SYMLINK);
 			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
 				need_new_crc = 1;
 			break;
 		case S_IFREG:
-			success = process_inode_data(dip, TYP_DATA);
+			rval = process_inode_data(dip, TYP_DATA);
 			break;
 		case S_IFIFO:
 		case S_IFCHR:
 		case S_IFBLK:
 		case S_IFSOCK:
-			success = process_dev_inode(dip);
+			process_dev_inode(dip);
 			need_new_crc = 1;
 			break;
 		default:
 			break;
 	}
 	nametable_clear();
+	if (!rval)
+		goto done;
 
 	/* copy extended attributes if they exist and forkoff is valid */
-	if (success && XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
+	if (XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
 		attr_data.remote_val_count = 0;
 		switch (dip->di_aformat) {
 			case XFS_DINODE_FMT_LOCAL:
@@ -2425,11 +2424,11 @@ process_inode(
 				break;
 
 			case XFS_DINODE_FMT_EXTENTS:
-				success = process_exinode(dip, TYP_ATTR);
+				rval = process_exinode(dip, TYP_ATTR);
 				break;
 
 			case XFS_DINODE_FMT_BTREE:
-				success = process_btinode(dip, TYP_ATTR);
+				rval = process_btinode(dip, TYP_ATTR);
 				break;
 		}
 		nametable_clear();
@@ -2442,7 +2441,8 @@ done:
 
 	if (crc_was_ok && need_new_crc)
 		libxfs_dinode_calc_crc(mp, dip);
-	return success;
+
+	return rval;
 }
 
 static uint32_t	inodes_copied;
@@ -2541,7 +2541,7 @@ copy_inode_chunk(
 
 			/* process_inode handles free inodes, too */
 			if (!process_inode(agno, agino + ioff + i, dip,
-			    XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
+					XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
 				goto pop_out;
 
 			inodes_copied++;
@@ -2800,7 +2800,7 @@ copy_ino(
 	xfs_agblock_t		agbno;
 	xfs_agino_t		agino;
 	int			offset;
-	int			rval = 0;
+	int			rval = 1;
 
 	if (ino == 0 || ino == NULLFSINO)
 		return 1;
-- 
2.35.1


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

* [PATCH 2/4] metadump: be careful zeroing corrupt inode forks
  2022-04-26 23:44 [PATCH 0/4] xfsprogs: fixes and updates Dave Chinner
  2022-04-26 23:44 ` [PATCH 1/4] metadump: handle corruption errors without aborting Dave Chinner
@ 2022-04-26 23:44 ` Dave Chinner
  2022-04-27  0:40   ` Darrick J. Wong
  2022-04-26 23:44 ` [PATCH 3/4] xfs_io: add a quiet option to bulkstat Dave Chinner
  2022-04-26 23:44 ` [PATCH 4/4] xfsprogs: autoconf modernisation Dave Chinner
  3 siblings, 1 reply; 17+ messages in thread
From: Dave Chinner @ 2022-04-26 23:44 UTC (permalink / raw)
  To: linux-xfs

From: Dave Chinner <dchinner@redhat.com>

When a corrupt inode fork is encountered, we can zero beyond the end
of the inode if the fork pointers are sufficiently trashed. We
should not trust the fork pointers when corruption is detected and
skip the zeroing in this case. We want metadump to capture the
corruption and so skipping the zeroing will give us the best chance
of preserving the corruption in a meaningful state for diagnosis.

Reported-by: Sean Caron <scaron@umich.edu>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 db/metadump.c | 49 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 10 deletions(-)

diff --git a/db/metadump.c b/db/metadump.c
index a21baa2070d9..3948d36e4d5c 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -2308,18 +2308,34 @@ process_inode_data(
 {
 	switch (dip->di_format) {
 		case XFS_DINODE_FMT_LOCAL:
-			if (obfuscate || zero_stale_data)
-				switch (itype) {
-					case TYP_DIR2:
-						process_sf_dir(dip);
-						break;
+			if (!(obfuscate || zero_stale_data))
+				break;
+
+			/*
+			 * If the fork size is invalid, we can't safely do
+			 * anything with this fork. Leave it alone to preserve
+			 * the information for diagnostic purposes.
+			 */
+			if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
+				print_warning(
+"Invalid data fork size (%d) in inode %llu, preserving contents!",
+						XFS_DFORK_DSIZE(dip, mp),
+						(long long)cur_ino);
+				break;
+			}
 
-					case TYP_SYMLINK:
-						process_sf_symlink(dip);
-						break;
+			switch (itype) {
+				case TYP_DIR2:
+					process_sf_dir(dip);
+					break;
 
-					default: ;
-				}
+				case TYP_SYMLINK:
+					process_sf_symlink(dip);
+					break;
+
+				default:
+					break;
+			}
 			break;
 
 		case XFS_DINODE_FMT_EXTENTS:
@@ -2341,6 +2357,19 @@ process_dev_inode(
 				      (unsigned long long)cur_ino);
 		return;
 	}
+
+	/*
+	 * If the fork size is invalid, we can't safely do anything with
+	 * this fork. Leave it alone to preserve the information for diagnostic
+	 * purposes.
+	 */
+	if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
+		print_warning(
+"Invalid data fork size (%d) in inode %llu, preserving contents!",
+				XFS_DFORK_DSIZE(dip, mp), (long long)cur_ino);
+		return;
+	}
+
 	if (zero_stale_data) {
 		unsigned int	size = sizeof(xfs_dev_t);
 
-- 
2.35.1


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

* [PATCH 3/4] xfs_io: add a quiet option to bulkstat
  2022-04-26 23:44 [PATCH 0/4] xfsprogs: fixes and updates Dave Chinner
  2022-04-26 23:44 ` [PATCH 1/4] metadump: handle corruption errors without aborting Dave Chinner
  2022-04-26 23:44 ` [PATCH 2/4] metadump: be careful zeroing corrupt inode forks Dave Chinner
@ 2022-04-26 23:44 ` Dave Chinner
  2022-04-27  0:38   ` Darrick J. Wong
  2022-04-26 23:44 ` [PATCH 4/4] xfsprogs: autoconf modernisation Dave Chinner
  3 siblings, 1 reply; 17+ messages in thread
From: Dave Chinner @ 2022-04-26 23:44 UTC (permalink / raw)
  To: linux-xfs

From: Dave Chinner <dchinner@redhat.com>

This is purely for driving the kernel bulkstat operations as hard
as userspace can drive them - we don't care about the actual output,
just want to drive maximum IO rates through the inode cache.

Bulkstat at 3.4 million inodes a second via xfs_io currently burns
about 30% of CPU time just formatting and outputting the stat
information to stdout and dumping it to /dev/null.

		wall time	rate	IOPS	bandwidth
unpatched	17.823s		3.4M/s	70k	1.9GB/s
with -q		15.682		6.1M/s  150k	3.5GB/s

The disks are at about 30% of max bandwidth and only at 70kiops, so
this CPU can be used to drive the kernel and IO subsystem harder.

Wall time doesn't really go down on this specific test because the
increase in inode cache turn-over (about 10GB/s of cached metadata
(in-core inodes and buffers) is being cycled through memory on a
machine with 16GB of RAM) and that hammers memory reclaim into a
utter mess that often takes seconds for it to recover from...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 io/bulkstat.c     | 9 ++++++++-
 man/man8/xfs_io.8 | 6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/io/bulkstat.c b/io/bulkstat.c
index 201470b29223..411942006591 100644
--- a/io/bulkstat.c
+++ b/io/bulkstat.c
@@ -67,6 +67,7 @@ bulkstat_help(void)
 "\n"
 "   -a <agno>  Only iterate this AG.\n"
 "   -d         Print debugging output.\n"
+"   -q         Be quiet, no output.\n"
 "   -e <ino>   Stop after this inode.\n"
 "   -n <nr>    Ask for this many results at once.\n"
 "   -s <ino>   Inode to start with.\n"
@@ -104,11 +105,12 @@ bulkstat_f(
 	uint32_t		ver = 0;
 	bool			has_agno = false;
 	bool			debug = false;
+	bool			quiet = false;
 	unsigned int		i;
 	int			c;
 	int			ret;
 
-	while ((c = getopt(argc, argv, "a:de:n:s:v:")) != -1) {
+	while ((c = getopt(argc, argv, "a:de:n:qs:v:")) != -1) {
 		switch (c) {
 		case 'a':
 			agno = cvt_u32(optarg, 10);
@@ -135,6 +137,9 @@ bulkstat_f(
 				return 1;
 			}
 			break;
+		case 'q':
+			quiet = true;
+			break;
 		case 's':
 			startino = cvt_u64(optarg, 10);
 			if (errno) {
@@ -198,6 +203,8 @@ _("bulkstat: startino=%lld flags=0x%x agno=%u ret=%d icount=%u ocount=%u\n"),
 		for (i = 0; i < breq->hdr.ocount; i++) {
 			if (breq->bulkstat[i].bs_ino > endino)
 				break;
+			if (quiet)
+				continue;
 			dump_bulkstat(&breq->bulkstat[i]);
 		}
 	}
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index e3c5d3ea99dd..d876490bf65d 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -1143,7 +1143,7 @@ for the current memory mapping.
 
 .SH FILESYSTEM COMMANDS
 .TP
-.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-s " startino " ] [ \-v " version" ]
+.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-q ] [ \-s " startino " ] [ \-v " version" ]
 Display raw stat information about a bunch of inodes in an XFS filesystem.
 Options are as follows:
 .RS 1.0i
@@ -1164,6 +1164,10 @@ Defaults to stopping when the system call stops returning results.
 Retrieve at most this many records per call.
 Defaults to 4,096.
 .TP
+.BI \-q
+Run quietly.
+Does not parse or output retrieved bulkstat information.
+.TP
 .BI \-s " startino"
 Display inode allocation records starting with this inode.
 Defaults to the first inode in the filesystem.
-- 
2.35.1


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

* [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-04-26 23:44 [PATCH 0/4] xfsprogs: fixes and updates Dave Chinner
                   ` (2 preceding siblings ...)
  2022-04-26 23:44 ` [PATCH 3/4] xfs_io: add a quiet option to bulkstat Dave Chinner
@ 2022-04-26 23:44 ` Dave Chinner
  2022-04-27  0:42   ` Darrick J. Wong
                     ` (2 more replies)
  3 siblings, 3 replies; 17+ messages in thread
From: Dave Chinner @ 2022-04-26 23:44 UTC (permalink / raw)
  To: linux-xfs

From: Dave Chinner <dchinner@redhat.com>

Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been
deprecated and made obsolete.

.....
configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:164: You should run autoupdate.
./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from...
configure.ac:164: the top level
configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:165: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from...
configure.ac:165: the top level
.....

But "autoupdate" does nothing to fix this, so I have to manually do
these conversions:

	- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
	- AC_TRY_LINK -> AC_LINK_IFELSE

because I have nothing better to do than fix currently working
code.

Also, running autoupdate forces the minimum pre-req to be autoconf
2.71 because it replaces other stuff...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 configure.ac          |   8 +--
 m4/package_attr.m4    |   8 ++-
 m4/package_libcdev.m4 | 158 ++++++++++++++++++++++++++----------------
 m4/package_types.m4   |   8 ++-
 m4/package_urcu.m4    |  18 +++--
 5 files changed, 123 insertions(+), 77 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4278145fe74b..36e42394a9df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,13 +1,13 @@
-AC_INIT([xfsprogs], [5.15.0], [linux-xfs@vger.kernel.org])
-AC_PREREQ(2.50)
+AC_INIT([xfsprogs],[5.15.0],[linux-xfs@vger.kernel.org])
+AC_PREREQ([2.71])
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([include/libxfs.h])
-AC_CONFIG_HEADER(include/platform_defs.h)
+AC_CONFIG_HEADERS([include/platform_defs.h])
 AC_PREFIX_DEFAULT(/usr)
 
 AC_PROG_INSTALL
-AC_PROG_LIBTOOL
+LT_INIT
 
 AC_PROG_CC
 AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
diff --git a/m4/package_attr.m4 b/m4/package_attr.m4
index 432492311d18..05e02b38fb5a 100644
--- a/m4/package_attr.m4
+++ b/m4/package_attr.m4
@@ -8,15 +8,17 @@ AC_DEFUN([AC_PACKAGE_WANT_ATTRIBUTES_H],
 #
 AC_DEFUN([AC_HAVE_LIBATTR],
   [ AC_MSG_CHECKING([for struct attrlist_cursor])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <attr/attributes.h>
-       ], [
+	]], [[
 struct attrlist_cursor *cur;
 struct attrlist *list;
 struct attrlist_ent *ent;
 int flags = ATTR_ROOT;
-       ], have_libattr=yes
+	]])
+    ], have_libattr=yes
           AC_MSG_RESULT(yes),
           AC_MSG_RESULT(no))
     AC_SUBST(have_libattr)
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index adab9bb9773a..94d76c7b3a19 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -3,11 +3,13 @@
 #
 AC_DEFUN([AC_HAVE_FADVISE],
   [ AC_MSG_CHECKING([for fadvise ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
-    ], [
-	posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
+	]], [[
+posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
+	]])
     ],	have_fadvise=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -19,11 +21,13 @@ AC_DEFUN([AC_HAVE_FADVISE],
 #
 AC_DEFUN([AC_HAVE_MADVISE],
   [ AC_MSG_CHECKING([for madvise ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/mman.h>
-    ], [
-	posix_madvise(0, 0, MADV_NORMAL);
+	]], [[
+posix_madvise(0, 0, MADV_NORMAL);
+	]])
     ],	have_madvise=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -35,11 +39,13 @@ AC_DEFUN([AC_HAVE_MADVISE],
 #
 AC_DEFUN([AC_HAVE_MINCORE],
   [ AC_MSG_CHECKING([for mincore ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/mman.h>
-    ], [
-	mincore(0, 0, 0);
+	]], [[
+mincore(0, 0, 0);
+	]])
     ],	have_mincore=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -51,11 +57,13 @@ AC_DEFUN([AC_HAVE_MINCORE],
 #
 AC_DEFUN([AC_HAVE_SENDFILE],
   [ AC_MSG_CHECKING([for sendfile ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/sendfile.h>
-    ], [
-         sendfile(0, 0, 0, 0);
+	]], [[
+sendfile(0, 0, 0, 0);
+	]])
     ],	have_sendfile=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -67,11 +75,13 @@ AC_DEFUN([AC_HAVE_SENDFILE],
 #
 AC_DEFUN([AC_HAVE_GETMNTENT],
   [ AC_MSG_CHECKING([for getmntent ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <mntent.h>
-    ], [
-         getmntent(0);
+	]], [[
+getmntent(0);
+	]])
     ], have_getmntent=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -83,12 +93,14 @@ AC_DEFUN([AC_HAVE_GETMNTENT],
 #
 AC_DEFUN([AC_HAVE_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
 #include <linux/falloc.h>
-    ], [
-         fallocate(0, 0, 0, 0);
+	]], [[
+fallocate(0, 0, 0, 0);
+	]])
     ], have_fallocate=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -100,13 +112,15 @@ AC_DEFUN([AC_HAVE_FALLOCATE],
 #
 AC_DEFUN([AC_HAVE_FIEMAP],
   [ AC_MSG_CHECKING([for fiemap])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <linux/fs.h>
 #include <linux/fiemap.h>
-    ], [
-         struct fiemap *fiemap;
-         ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	]], [[
+struct fiemap *fiemap;
+ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	]])
     ], have_fiemap=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -118,12 +132,14 @@ AC_DEFUN([AC_HAVE_FIEMAP],
 #
 AC_DEFUN([AC_HAVE_PREADV],
   [ AC_MSG_CHECKING([for preadv])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _BSD_SOURCE
 #define _DEFAULT_SOURCE
 #include <sys/uio.h>
-    ], [
-         preadv(0, 0, 0, 0);
+	]], [[
+preadv(0, 0, 0, 0);
+	]])
     ], have_preadv=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -135,11 +151,13 @@ AC_DEFUN([AC_HAVE_PREADV],
 #
 AC_DEFUN([AC_HAVE_PWRITEV2],
   [ AC_MSG_CHECKING([for pwritev2])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _BSD_SOURCE
 #include <sys/uio.h>
-    ], [
-         pwritev2(0, 0, 0, 0, 0);
+	]], [[
+pwritev2(0, 0, 0, 0, 0);
+	]])
     ], have_pwritev2=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -151,12 +169,14 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
 #
 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
   [ AC_MSG_CHECKING([for copy_file_range])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <unistd.h>
-    ], [
-         syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
+	]], [[
+syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
+	]])
     ], have_copy_file_range=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -168,11 +188,13 @@ AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
 #
 AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
   [ AC_MSG_CHECKING([for sync_file_range])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
-    ], [
-         sync_file_range(0, 0, 0, 0);
+	]], [[
+sync_file_range(0, 0, 0, 0);
+	]])
     ], have_sync_file_range=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -184,11 +206,13 @@ AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
 #
 AC_DEFUN([AC_HAVE_SYNCFS],
   [ AC_MSG_CHECKING([for syncfs])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <unistd.h>
-    ], [
-         syncfs(0);
+	]], [[
+syncfs(0);
+	]])
     ], have_syncfs=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -200,10 +224,12 @@ AC_DEFUN([AC_HAVE_SYNCFS],
 #
 AC_DEFUN([AC_HAVE_READDIR],
   [ AC_MSG_CHECKING([for readdir])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <dirent.h>
-    ], [
-         readdir(0);
+	]], [[
+readdir(0);
+	]])
     ], have_readdir=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -304,15 +330,17 @@ AC_DEFUN([AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG],
 #
 AC_DEFUN([AC_HAVE_GETFSMAP],
   [ AC_MSG_CHECKING([for GETFSMAP])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <unistd.h>
 #include <linux/fs.h>
 #include <linux/fsmap.h>
-    ], [
-         unsigned long x = FS_IOC_GETFSMAP;
-         struct fsmap_head fh;
+	]], [[
+unsigned long x = FS_IOC_GETFSMAP;
+struct fsmap_head fh;
+	]])
     ], have_getfsmap=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -338,11 +366,13 @@ AC_DEFUN([AC_HAVE_STATFS_FLAGS],
 #
 AC_DEFUN([AC_HAVE_MAP_SYNC],
   [ AC_MSG_CHECKING([for MAP_SYNC])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <asm-generic/mman.h>
 #include <asm-generic/mman-common.h>
-    ], [
-        int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+	]], [[
+int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+	]])
     ], have_map_sync=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -354,13 +384,15 @@ AC_DEFUN([AC_HAVE_MAP_SYNC],
 #
 AC_DEFUN([AC_HAVE_MALLINFO],
   [ AC_MSG_CHECKING([for mallinfo ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <malloc.h>
-    ], [
-         struct mallinfo test;
+	]], [[
+struct mallinfo test;
 
-         test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
-         test = mallinfo();
+test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
+test = mallinfo();
+	]])
     ], have_mallinfo=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -400,10 +432,13 @@ AC_DEFUN([AC_HAVE_FSTATAT],
 #
 AC_DEFUN([AC_HAVE_SG_IO],
   [ AC_MSG_CHECKING([for struct sg_io_hdr ])
-    AC_TRY_COMPILE([#include <scsi/sg.h>],
-    [
-         struct sg_io_hdr hdr;
-         ioctl(0, SG_IO, &hdr);
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
+#include <scsi/sg.h>
+	]], [[
+struct sg_io_hdr hdr;
+ioctl(0, SG_IO, &hdr);
+	]])
     ], have_sg_io=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -415,10 +450,13 @@ AC_DEFUN([AC_HAVE_SG_IO],
 #
 AC_DEFUN([AC_HAVE_HDIO_GETGEO],
   [ AC_MSG_CHECKING([for struct hd_geometry ])
-    AC_TRY_COMPILE([#include <linux/hdreg.h>],
-    [
-         struct hd_geometry hdr;
-         ioctl(0, HDIO_GETGEO, &hdr);
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
+#include <linux/hdreg.h>,
+	]], [[
+struct hd_geometry hdr;
+ioctl(0, HDIO_GETGEO, &hdr);
+	]])
     ], have_hdio_getgeo=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
diff --git a/m4/package_types.m4 b/m4/package_types.m4
index 1c35839319d6..6e817a310f79 100644
--- a/m4/package_types.m4
+++ b/m4/package_types.m4
@@ -4,9 +4,11 @@
 AH_TEMPLATE([HAVE_UMODE_T], [Whether you have umode_t])
 AC_DEFUN([AC_TYPE_UMODE_T],
   [ AC_MSG_CHECKING([for umode_t])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <asm/types.h>
-    ], [
-         umode_t umode;
+	]], [[
+umode_t umode;
+	]])
     ], AC_DEFINE(HAVE_UMODE_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
   ])
diff --git a/m4/package_urcu.m4 b/m4/package_urcu.m4
index f8e798b66136..ef116e0cda76 100644
--- a/m4/package_urcu.m4
+++ b/m4/package_urcu.m4
@@ -10,11 +10,13 @@ AC_DEFUN([AC_PACKAGE_NEED_URCU_H],
 
 AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
   [ AC_MSG_CHECKING([for liburcu])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       rcu_init();
+	]], [[
+rcu_init();
+	]])
     ], liburcu=-lurcu
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -28,12 +30,14 @@ AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
 #
 AC_DEFUN([AC_HAVE_LIBURCU_ATOMIC64],
   [ AC_MSG_CHECKING([for atomic64_t support in liburcu])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       long long f = 3;
-       uatomic_inc(&f);
+	]], [[
+long long f = 3;
+uatomic_inc(&f);
+	]])
     ], have_liburcu_atomic64=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
-- 
2.35.1


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

* Re: [PATCH 3/4] xfs_io: add a quiet option to bulkstat
  2022-04-26 23:44 ` [PATCH 3/4] xfs_io: add a quiet option to bulkstat Dave Chinner
@ 2022-04-27  0:38   ` Darrick J. Wong
  0 siblings, 0 replies; 17+ messages in thread
From: Darrick J. Wong @ 2022-04-27  0:38 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs

On Wed, Apr 27, 2022 at 09:44:52AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> This is purely for driving the kernel bulkstat operations as hard
> as userspace can drive them - we don't care about the actual output,
> just want to drive maximum IO rates through the inode cache.
> 
> Bulkstat at 3.4 million inodes a second via xfs_io currently burns
> about 30% of CPU time just formatting and outputting the stat
> information to stdout and dumping it to /dev/null.
> 
> 		wall time	rate	IOPS	bandwidth
> unpatched	17.823s		3.4M/s	70k	1.9GB/s
> with -q		15.682		6.1M/s  150k	3.5GB/s
> 
> The disks are at about 30% of max bandwidth and only at 70kiops, so
> this CPU can be used to drive the kernel and IO subsystem harder.
> 
> Wall time doesn't really go down on this specific test because the
> increase in inode cache turn-over (about 10GB/s of cached metadata
> (in-core inodes and buffers) is being cycled through memory on a
> machine with 16GB of RAM) and that hammers memory reclaim into a
> utter mess that often takes seconds for it to recover from...
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Heh, moar bulkstat.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  io/bulkstat.c     | 9 ++++++++-
>  man/man8/xfs_io.8 | 6 +++++-
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/io/bulkstat.c b/io/bulkstat.c
> index 201470b29223..411942006591 100644
> --- a/io/bulkstat.c
> +++ b/io/bulkstat.c
> @@ -67,6 +67,7 @@ bulkstat_help(void)
>  "\n"
>  "   -a <agno>  Only iterate this AG.\n"
>  "   -d         Print debugging output.\n"
> +"   -q         Be quiet, no output.\n"
>  "   -e <ino>   Stop after this inode.\n"
>  "   -n <nr>    Ask for this many results at once.\n"
>  "   -s <ino>   Inode to start with.\n"
> @@ -104,11 +105,12 @@ bulkstat_f(
>  	uint32_t		ver = 0;
>  	bool			has_agno = false;
>  	bool			debug = false;
> +	bool			quiet = false;
>  	unsigned int		i;
>  	int			c;
>  	int			ret;
>  
> -	while ((c = getopt(argc, argv, "a:de:n:s:v:")) != -1) {
> +	while ((c = getopt(argc, argv, "a:de:n:qs:v:")) != -1) {
>  		switch (c) {
>  		case 'a':
>  			agno = cvt_u32(optarg, 10);
> @@ -135,6 +137,9 @@ bulkstat_f(
>  				return 1;
>  			}
>  			break;
> +		case 'q':
> +			quiet = true;
> +			break;
>  		case 's':
>  			startino = cvt_u64(optarg, 10);
>  			if (errno) {
> @@ -198,6 +203,8 @@ _("bulkstat: startino=%lld flags=0x%x agno=%u ret=%d icount=%u ocount=%u\n"),
>  		for (i = 0; i < breq->hdr.ocount; i++) {
>  			if (breq->bulkstat[i].bs_ino > endino)
>  				break;
> +			if (quiet)
> +				continue;
>  			dump_bulkstat(&breq->bulkstat[i]);
>  		}
>  	}
> diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
> index e3c5d3ea99dd..d876490bf65d 100644
> --- a/man/man8/xfs_io.8
> +++ b/man/man8/xfs_io.8
> @@ -1143,7 +1143,7 @@ for the current memory mapping.
>  
>  .SH FILESYSTEM COMMANDS
>  .TP
> -.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-s " startino " ] [ \-v " version" ]
> +.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-q ] [ \-s " startino " ] [ \-v " version" ]
>  Display raw stat information about a bunch of inodes in an XFS filesystem.
>  Options are as follows:
>  .RS 1.0i
> @@ -1164,6 +1164,10 @@ Defaults to stopping when the system call stops returning results.
>  Retrieve at most this many records per call.
>  Defaults to 4,096.
>  .TP
> +.BI \-q
> +Run quietly.
> +Does not parse or output retrieved bulkstat information.
> +.TP
>  .BI \-s " startino"
>  Display inode allocation records starting with this inode.
>  Defaults to the first inode in the filesystem.
> -- 
> 2.35.1
> 

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

* Re: [PATCH 2/4] metadump: be careful zeroing corrupt inode forks
  2022-04-26 23:44 ` [PATCH 2/4] metadump: be careful zeroing corrupt inode forks Dave Chinner
@ 2022-04-27  0:40   ` Darrick J. Wong
  2022-04-27  1:27     ` Dave Chinner
  0 siblings, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2022-04-27  0:40 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs

On Wed, Apr 27, 2022 at 09:44:51AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> When a corrupt inode fork is encountered, we can zero beyond the end
> of the inode if the fork pointers are sufficiently trashed. We
> should not trust the fork pointers when corruption is detected and
> skip the zeroing in this case. We want metadump to capture the
> corruption and so skipping the zeroing will give us the best chance
> of preserving the corruption in a meaningful state for diagnosis.
> 
> Reported-by: Sean Caron <scaron@umich.edu>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Hmm.  I /think/ the only real change here is the addition of the
DFORK_DSIZE > LITINO warning, right?  The rest is just reindenting the
loop body?

If so, LGTM.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  db/metadump.c | 49 +++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 39 insertions(+), 10 deletions(-)
> 
> diff --git a/db/metadump.c b/db/metadump.c
> index a21baa2070d9..3948d36e4d5c 100644
> --- a/db/metadump.c
> +++ b/db/metadump.c
> @@ -2308,18 +2308,34 @@ process_inode_data(
>  {
>  	switch (dip->di_format) {
>  		case XFS_DINODE_FMT_LOCAL:
> -			if (obfuscate || zero_stale_data)
> -				switch (itype) {
> -					case TYP_DIR2:
> -						process_sf_dir(dip);
> -						break;
> +			if (!(obfuscate || zero_stale_data))
> +				break;
> +
> +			/*
> +			 * If the fork size is invalid, we can't safely do
> +			 * anything with this fork. Leave it alone to preserve
> +			 * the information for diagnostic purposes.
> +			 */
> +			if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
> +				print_warning(
> +"Invalid data fork size (%d) in inode %llu, preserving contents!",
> +						XFS_DFORK_DSIZE(dip, mp),
> +						(long long)cur_ino);
> +				break;
> +			}
>  
> -					case TYP_SYMLINK:
> -						process_sf_symlink(dip);
> -						break;
> +			switch (itype) {
> +				case TYP_DIR2:
> +					process_sf_dir(dip);
> +					break;
>  
> -					default: ;
> -				}
> +				case TYP_SYMLINK:
> +					process_sf_symlink(dip);
> +					break;
> +
> +				default:
> +					break;
> +			}
>  			break;
>  
>  		case XFS_DINODE_FMT_EXTENTS:
> @@ -2341,6 +2357,19 @@ process_dev_inode(
>  				      (unsigned long long)cur_ino);
>  		return;
>  	}
> +
> +	/*
> +	 * If the fork size is invalid, we can't safely do anything with
> +	 * this fork. Leave it alone to preserve the information for diagnostic
> +	 * purposes.
> +	 */
> +	if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
> +		print_warning(
> +"Invalid data fork size (%d) in inode %llu, preserving contents!",
> +				XFS_DFORK_DSIZE(dip, mp), (long long)cur_ino);
> +		return;
> +	}
> +
>  	if (zero_stale_data) {
>  		unsigned int	size = sizeof(xfs_dev_t);
>  
> -- 
> 2.35.1
> 

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

* Re: [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-04-26 23:44 ` [PATCH 4/4] xfsprogs: autoconf modernisation Dave Chinner
@ 2022-04-27  0:42   ` Darrick J. Wong
  2022-04-27  1:33     ` Dave Chinner
  2022-05-26 18:49   ` Eric Sandeen
  2022-05-27 17:04   ` Darrick J. Wong
  2 siblings, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2022-04-27  0:42 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs

On Wed, Apr 27, 2022 at 09:44:53AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been
> deprecated and made obsolete.
> 
> .....
> configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete.
> configure.ac:164: You should run autoupdate.
> ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
> m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from...
> configure.ac:164: the top level
> configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete.
> configure.ac:165: You should run autoupdate.
> ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
> m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from...
> configure.ac:165: the top level
> .....
> 
> But "autoupdate" does nothing to fix this, so I have to manually do
> these conversions:
> 
> 	- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
> 	- AC_TRY_LINK -> AC_LINK_IFELSE
> 
> because I have nothing better to do than fix currently working
> code.
> 
> Also, running autoupdate forces the minimum pre-req to be autoconf
> 2.71 because it replaces other stuff...
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

I hate autoconf, and this seems like stupid pedantry on their part...

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  configure.ac          |   8 +--
>  m4/package_attr.m4    |   8 ++-
>  m4/package_libcdev.m4 | 158 ++++++++++++++++++++++++++----------------
>  m4/package_types.m4   |   8 ++-
>  m4/package_urcu.m4    |  18 +++--
>  5 files changed, 123 insertions(+), 77 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 4278145fe74b..36e42394a9df 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,13 +1,13 @@
> -AC_INIT([xfsprogs], [5.15.0], [linux-xfs@vger.kernel.org])
> -AC_PREREQ(2.50)
> +AC_INIT([xfsprogs],[5.15.0],[linux-xfs@vger.kernel.org])
> +AC_PREREQ([2.71])
>  AC_CONFIG_AUX_DIR([.])
>  AC_CONFIG_MACRO_DIR([m4])
>  AC_CONFIG_SRCDIR([include/libxfs.h])
> -AC_CONFIG_HEADER(include/platform_defs.h)
> +AC_CONFIG_HEADERS([include/platform_defs.h])
>  AC_PREFIX_DEFAULT(/usr)
>  
>  AC_PROG_INSTALL
> -AC_PROG_LIBTOOL
> +LT_INIT
>  
>  AC_PROG_CC
>  AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
> diff --git a/m4/package_attr.m4 b/m4/package_attr.m4
> index 432492311d18..05e02b38fb5a 100644
> --- a/m4/package_attr.m4
> +++ b/m4/package_attr.m4
> @@ -8,15 +8,17 @@ AC_DEFUN([AC_PACKAGE_WANT_ATTRIBUTES_H],
>  #
>  AC_DEFUN([AC_HAVE_LIBATTR],
>    [ AC_MSG_CHECKING([for struct attrlist_cursor])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <sys/types.h>
>  #include <attr/attributes.h>
> -       ], [
> +	]], [[
>  struct attrlist_cursor *cur;
>  struct attrlist *list;
>  struct attrlist_ent *ent;
>  int flags = ATTR_ROOT;
> -       ], have_libattr=yes
> +	]])
> +    ], have_libattr=yes
>            AC_MSG_RESULT(yes),
>            AC_MSG_RESULT(no))
>      AC_SUBST(have_libattr)
> diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
> index adab9bb9773a..94d76c7b3a19 100644
> --- a/m4/package_libcdev.m4
> +++ b/m4/package_libcdev.m4
> @@ -3,11 +3,13 @@
>  #
>  AC_DEFUN([AC_HAVE_FADVISE],
>    [ AC_MSG_CHECKING([for fadvise ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <fcntl.h>
> -    ], [
> -	posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
> +	]], [[
> +posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
> +	]])
>      ],	have_fadvise=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -19,11 +21,13 @@ AC_DEFUN([AC_HAVE_FADVISE],
>  #
>  AC_DEFUN([AC_HAVE_MADVISE],
>    [ AC_MSG_CHECKING([for madvise ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/mman.h>
> -    ], [
> -	posix_madvise(0, 0, MADV_NORMAL);
> +	]], [[
> +posix_madvise(0, 0, MADV_NORMAL);
> +	]])
>      ],	have_madvise=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -35,11 +39,13 @@ AC_DEFUN([AC_HAVE_MADVISE],
>  #
>  AC_DEFUN([AC_HAVE_MINCORE],
>    [ AC_MSG_CHECKING([for mincore ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/mman.h>
> -    ], [
> -	mincore(0, 0, 0);
> +	]], [[
> +mincore(0, 0, 0);
> +	]])
>      ],	have_mincore=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -51,11 +57,13 @@ AC_DEFUN([AC_HAVE_MINCORE],
>  #
>  AC_DEFUN([AC_HAVE_SENDFILE],
>    [ AC_MSG_CHECKING([for sendfile ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/sendfile.h>
> -    ], [
> -         sendfile(0, 0, 0, 0);
> +	]], [[
> +sendfile(0, 0, 0, 0);
> +	]])
>      ],	have_sendfile=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -67,11 +75,13 @@ AC_DEFUN([AC_HAVE_SENDFILE],
>  #
>  AC_DEFUN([AC_HAVE_GETMNTENT],
>    [ AC_MSG_CHECKING([for getmntent ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <stdio.h>
>  #include <mntent.h>
> -    ], [
> -         getmntent(0);
> +	]], [[
> +getmntent(0);
> +	]])
>      ], have_getmntent=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -83,12 +93,14 @@ AC_DEFUN([AC_HAVE_GETMNTENT],
>  #
>  AC_DEFUN([AC_HAVE_FALLOCATE],
>    [ AC_MSG_CHECKING([for fallocate])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <fcntl.h>
>  #include <linux/falloc.h>
> -    ], [
> -         fallocate(0, 0, 0, 0);
> +	]], [[
> +fallocate(0, 0, 0, 0);
> +	]])
>      ], have_fallocate=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -100,13 +112,15 @@ AC_DEFUN([AC_HAVE_FALLOCATE],
>  #
>  AC_DEFUN([AC_HAVE_FIEMAP],
>    [ AC_MSG_CHECKING([for fiemap])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <linux/fs.h>
>  #include <linux/fiemap.h>
> -    ], [
> -         struct fiemap *fiemap;
> -         ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
> +	]], [[
> +struct fiemap *fiemap;
> +ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
> +	]])
>      ], have_fiemap=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -118,12 +132,14 @@ AC_DEFUN([AC_HAVE_FIEMAP],
>  #
>  AC_DEFUN([AC_HAVE_PREADV],
>    [ AC_MSG_CHECKING([for preadv])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _BSD_SOURCE
>  #define _DEFAULT_SOURCE
>  #include <sys/uio.h>
> -    ], [
> -         preadv(0, 0, 0, 0);
> +	]], [[
> +preadv(0, 0, 0, 0);
> +	]])
>      ], have_preadv=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -135,11 +151,13 @@ AC_DEFUN([AC_HAVE_PREADV],
>  #
>  AC_DEFUN([AC_HAVE_PWRITEV2],
>    [ AC_MSG_CHECKING([for pwritev2])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _BSD_SOURCE
>  #include <sys/uio.h>
> -    ], [
> -         pwritev2(0, 0, 0, 0, 0);
> +	]], [[
> +pwritev2(0, 0, 0, 0, 0);
> +	]])
>      ], have_pwritev2=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -151,12 +169,14 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
>  #
>  AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
>    [ AC_MSG_CHECKING([for copy_file_range])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/syscall.h>
>  #include <unistd.h>
> -    ], [
> -         syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
> +	]], [[
> +syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
> +	]])
>      ], have_copy_file_range=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -168,11 +188,13 @@ AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
>  #
>  AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
>    [ AC_MSG_CHECKING([for sync_file_range])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <fcntl.h>
> -    ], [
> -         sync_file_range(0, 0, 0, 0);
> +	]], [[
> +sync_file_range(0, 0, 0, 0);
> +	]])
>      ], have_sync_file_range=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -184,11 +206,13 @@ AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
>  #
>  AC_DEFUN([AC_HAVE_SYNCFS],
>    [ AC_MSG_CHECKING([for syncfs])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <unistd.h>
> -    ], [
> -         syncfs(0);
> +	]], [[
> +syncfs(0);
> +	]])
>      ], have_syncfs=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -200,10 +224,12 @@ AC_DEFUN([AC_HAVE_SYNCFS],
>  #
>  AC_DEFUN([AC_HAVE_READDIR],
>    [ AC_MSG_CHECKING([for readdir])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <dirent.h>
> -    ], [
> -         readdir(0);
> +	]], [[
> +readdir(0);
> +	]])
>      ], have_readdir=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -304,15 +330,17 @@ AC_DEFUN([AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG],
>  #
>  AC_DEFUN([AC_HAVE_GETFSMAP],
>    [ AC_MSG_CHECKING([for GETFSMAP])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/syscall.h>
>  #include <unistd.h>
>  #include <linux/fs.h>
>  #include <linux/fsmap.h>
> -    ], [
> -         unsigned long x = FS_IOC_GETFSMAP;
> -         struct fsmap_head fh;
> +	]], [[
> +unsigned long x = FS_IOC_GETFSMAP;
> +struct fsmap_head fh;
> +	]])
>      ], have_getfsmap=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -338,11 +366,13 @@ AC_DEFUN([AC_HAVE_STATFS_FLAGS],
>  #
>  AC_DEFUN([AC_HAVE_MAP_SYNC],
>    [ AC_MSG_CHECKING([for MAP_SYNC])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <asm-generic/mman.h>
>  #include <asm-generic/mman-common.h>
> -    ], [
> -        int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
> +	]], [[
> +int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
> +	]])
>      ], have_map_sync=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -354,13 +384,15 @@ AC_DEFUN([AC_HAVE_MAP_SYNC],
>  #
>  AC_DEFUN([AC_HAVE_MALLINFO],
>    [ AC_MSG_CHECKING([for mallinfo ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <malloc.h>
> -    ], [
> -         struct mallinfo test;
> +	]], [[
> +struct mallinfo test;
>  
> -         test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
> -         test = mallinfo();
> +test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
> +test = mallinfo();
> +	]])
>      ], have_mallinfo=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -400,10 +432,13 @@ AC_DEFUN([AC_HAVE_FSTATAT],
>  #
>  AC_DEFUN([AC_HAVE_SG_IO],
>    [ AC_MSG_CHECKING([for struct sg_io_hdr ])
> -    AC_TRY_COMPILE([#include <scsi/sg.h>],
> -    [
> -         struct sg_io_hdr hdr;
> -         ioctl(0, SG_IO, &hdr);
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
> +#include <scsi/sg.h>
> +	]], [[
> +struct sg_io_hdr hdr;
> +ioctl(0, SG_IO, &hdr);
> +	]])
>      ], have_sg_io=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -415,10 +450,13 @@ AC_DEFUN([AC_HAVE_SG_IO],
>  #
>  AC_DEFUN([AC_HAVE_HDIO_GETGEO],
>    [ AC_MSG_CHECKING([for struct hd_geometry ])
> -    AC_TRY_COMPILE([#include <linux/hdreg.h>],
> -    [
> -         struct hd_geometry hdr;
> -         ioctl(0, HDIO_GETGEO, &hdr);
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
> +#include <linux/hdreg.h>,
> +	]], [[
> +struct hd_geometry hdr;
> +ioctl(0, HDIO_GETGEO, &hdr);
> +	]])
>      ], have_hdio_getgeo=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> diff --git a/m4/package_types.m4 b/m4/package_types.m4
> index 1c35839319d6..6e817a310f79 100644
> --- a/m4/package_types.m4
> +++ b/m4/package_types.m4
> @@ -4,9 +4,11 @@
>  AH_TEMPLATE([HAVE_UMODE_T], [Whether you have umode_t])
>  AC_DEFUN([AC_TYPE_UMODE_T],
>    [ AC_MSG_CHECKING([for umode_t])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <asm/types.h>
> -    ], [
> -         umode_t umode;
> +	]], [[
> +umode_t umode;
> +	]])
>      ], AC_DEFINE(HAVE_UMODE_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
>    ])
> diff --git a/m4/package_urcu.m4 b/m4/package_urcu.m4
> index f8e798b66136..ef116e0cda76 100644
> --- a/m4/package_urcu.m4
> +++ b/m4/package_urcu.m4
> @@ -10,11 +10,13 @@ AC_DEFUN([AC_PACKAGE_NEED_URCU_H],
>  
>  AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
>    [ AC_MSG_CHECKING([for liburcu])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <urcu.h>
> -    ], [
> -       rcu_init();
> +	]], [[
> +rcu_init();
> +	]])
>      ], liburcu=-lurcu
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -28,12 +30,14 @@ AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
>  #
>  AC_DEFUN([AC_HAVE_LIBURCU_ATOMIC64],
>    [ AC_MSG_CHECKING([for atomic64_t support in liburcu])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <urcu.h>
> -    ], [
> -       long long f = 3;
> -       uatomic_inc(&f);
> +	]], [[
> +long long f = 3;
> +uatomic_inc(&f);
> +	]])
>      ], have_liburcu_atomic64=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> -- 
> 2.35.1
> 

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

* Re: [PATCH 1/4] metadump: handle corruption errors without aborting
  2022-04-26 23:44 ` [PATCH 1/4] metadump: handle corruption errors without aborting Dave Chinner
@ 2022-04-27  0:45   ` Darrick J. Wong
  2022-04-27  1:26     ` Dave Chinner
  0 siblings, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2022-04-27  0:45 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs

On Wed, Apr 27, 2022 at 09:44:50AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Sean Caron reported that a metadump terminated after givin gthis
> warning:
> 
> xfs_metadump: inode 2216156864 has unexpected extents
> 
> Metadump is supposed to ignore corruptions and continue dumping the
> filesystem as best it can. Whilst it warns about many situations
> where it can't fully dump structures, it should stop processing that
> structure and continue with the next one until the entire filesystem
> has been processed.
> 
> Unfortunately, some warning conditions also return an "abort" error
> status, causing metadump to abort if that condition is hit. Most of
> these abort conditions should really be "continue on next object"
> conditions so that the we attempt to dump the rest of the
> filesystem.
> 
> Fix the returns for warnings that incorrectly cause aborts
> such that the only abort conditions are read errors when
> "stop-on-read-error" semantics are specified. Also make the return
> values consistently mean abort/continue rather than returning -errno
> to mean "stop because read error" and then trying to infer what
> the error means in callers without the context it occurred in.

I was almost about to say "This variable should be named success", but
then noticed that there already /are/ variables named success.  Yuck.

rval==0 means abort?  and rval!=0 means continue?  If so,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> Reported-and-tested-by: Sean Caron <scaron@umich.edu>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  db/metadump.c | 94 +++++++++++++++++++++++++--------------------------
>  1 file changed, 47 insertions(+), 47 deletions(-)
> 
> diff --git a/db/metadump.c b/db/metadump.c
> index 48cda88a3ea5..a21baa2070d9 100644
> --- a/db/metadump.c
> +++ b/db/metadump.c
> @@ -1645,7 +1645,7 @@ process_symlink_block(
>  {
>  	struct bbmap	map;
>  	char		*link;
> -	int		ret = 0;
> +	int		rval = 1;
>  
>  	push_cur();
>  	map.nmaps = 1;
> @@ -1658,8 +1658,7 @@ process_symlink_block(
>  
>  		print_warning("cannot read %s block %u/%u (%llu)",
>  				typtab[btype].name, agno, agbno, s);
> -		if (stop_on_read_error)
> -			ret = -1;
> +		rval = !stop_on_read_error;
>  		goto out_pop;
>  	}
>  	link = iocur_top->data;
> @@ -1682,10 +1681,11 @@ process_symlink_block(
>  	}
>  
>  	iocur_top->need_crc = 1;
> -	ret = write_buf(iocur_top);
> +	if (write_buf(iocur_top))
> +		rval = 0;
>  out_pop:
>  	pop_cur();
> -	return ret;
> +	return rval;
>  }
>  
>  #define MAX_REMOTE_VALS		4095
> @@ -1843,8 +1843,8 @@ process_single_fsb_objects(
>  	typnm_t		btype,
>  	xfs_fileoff_t	last)
>  {
> +	int		rval = 1;
>  	char		*dp;
> -	int		ret = 0;
>  	int		i;
>  
>  	for (i = 0; i < c; i++) {
> @@ -1858,8 +1858,7 @@ process_single_fsb_objects(
>  
>  			print_warning("cannot read %s block %u/%u (%llu)",
>  					typtab[btype].name, agno, agbno, s);
> -			if (stop_on_read_error)
> -				ret = -EIO;
> +			rval = !stop_on_read_error;
>  			goto out_pop;
>  
>  		}
> @@ -1925,16 +1924,17 @@ process_single_fsb_objects(
>  		}
>  
>  write:
> -		ret = write_buf(iocur_top);
> +		if (write_buf(iocur_top))
> +			rval = 0;
>  out_pop:
>  		pop_cur();
> -		if (ret)
> +		if (!rval)
>  			break;
>  		o++;
>  		s++;
>  	}
>  
> -	return ret;
> +	return rval;
>  }
>  
>  /*
> @@ -1952,7 +1952,7 @@ process_multi_fsb_dir(
>  	xfs_fileoff_t	last)
>  {
>  	char		*dp;
> -	int		ret = 0;
> +	int		rval = 1;
>  
>  	while (c > 0) {
>  		unsigned int	bm_len;
> @@ -1978,8 +1978,7 @@ process_multi_fsb_dir(
>  
>  				print_warning("cannot read %s block %u/%u (%llu)",
>  						typtab[btype].name, agno, agbno, s);
> -				if (stop_on_read_error)
> -					ret = -1;
> +				rval = !stop_on_read_error;
>  				goto out_pop;
>  
>  			}
> @@ -1998,18 +1997,19 @@ process_multi_fsb_dir(
>  			}
>  			iocur_top->need_crc = 1;
>  write:
> -			ret = write_buf(iocur_top);
> +			if (write_buf(iocur_top))
> +				rval = 0;
>  out_pop:
>  			pop_cur();
>  			mfsb_map.nmaps = 0;
> -			if (ret)
> +			if (!rval)
>  				break;
>  		}
>  		c -= bm_len;
>  		s += bm_len;
>  	}
>  
> -	return ret;
> +	return rval;
>  }
>  
>  static bool
> @@ -2039,15 +2039,15 @@ process_multi_fsb_objects(
>  		return process_symlink_block(o, s, c, btype, last);
>  	default:
>  		print_warning("bad type for multi-fsb object %d", btype);
> -		return -EINVAL;
> +		return 1;
>  	}
>  }
>  
>  /* inode copy routines */
>  static int
>  process_bmbt_reclist(
> -	xfs_bmbt_rec_t 		*rp,
> -	int 			numrecs,
> +	xfs_bmbt_rec_t		*rp,
> +	int			numrecs,
>  	typnm_t			btype)
>  {
>  	int			i;
> @@ -2059,7 +2059,7 @@ process_bmbt_reclist(
>  	xfs_agnumber_t		agno;
>  	xfs_agblock_t		agbno;
>  	bool			is_multi_fsb = is_multi_fsb_object(mp, btype);
> -	int			error;
> +	int			rval = 1;
>  
>  	if (btype == TYP_DATA)
>  		return 1;
> @@ -2123,16 +2123,16 @@ process_bmbt_reclist(
>  
>  		/* multi-extent blocks require special handling */
>  		if (is_multi_fsb)
> -			error = process_multi_fsb_objects(o, s, c, btype,
> +			rval = process_multi_fsb_objects(o, s, c, btype,
>  					last);
>  		else
> -			error = process_single_fsb_objects(o, s, c, btype,
> +			rval = process_single_fsb_objects(o, s, c, btype,
>  					last);
> -		if (error)
> -			return 0;
> +		if (!rval)
> +			break;
>  	}
>  
> -	return 1;
> +	return rval;
>  }
>  
>  static int
> @@ -2331,7 +2331,7 @@ process_inode_data(
>  	return 1;
>  }
>  
> -static int
> +static void
>  process_dev_inode(
>  	xfs_dinode_t		*dip)
>  {
> @@ -2339,15 +2339,13 @@ process_dev_inode(
>  		if (show_warnings)
>  			print_warning("inode %llu has unexpected extents",
>  				      (unsigned long long)cur_ino);
> -		return 0;
> -	} else {
> -		if (zero_stale_data) {
> -			unsigned int	size = sizeof(xfs_dev_t);
> +		return;
> +	}
> +	if (zero_stale_data) {
> +		unsigned int	size = sizeof(xfs_dev_t);
>  
> -			memset(XFS_DFORK_DPTR(dip) + size, 0,
> -					XFS_DFORK_DSIZE(dip, mp) - size);
> -		}
> -		return 1;
> +		memset(XFS_DFORK_DPTR(dip) + size, 0,
> +				XFS_DFORK_DSIZE(dip, mp) - size);
>  	}
>  }
>  
> @@ -2365,11 +2363,10 @@ process_inode(
>  	xfs_dinode_t 		*dip,
>  	bool			free_inode)
>  {
> -	int			success;
> +	int			rval = 1;
>  	bool			crc_was_ok = false; /* no recalc by default */
>  	bool			need_new_crc = false;
>  
> -	success = 1;
>  	cur_ino = XFS_AGINO_TO_INO(mp, agno, agino);
>  
>  	/* we only care about crc recalculation if we will modify the inode. */
> @@ -2390,32 +2387,34 @@ process_inode(
>  	/* copy appropriate data fork metadata */
>  	switch (be16_to_cpu(dip->di_mode) & S_IFMT) {
>  		case S_IFDIR:
> -			success = process_inode_data(dip, TYP_DIR2);
> +			rval = process_inode_data(dip, TYP_DIR2);
>  			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
>  				need_new_crc = 1;
>  			break;
>  		case S_IFLNK:
> -			success = process_inode_data(dip, TYP_SYMLINK);
> +			rval = process_inode_data(dip, TYP_SYMLINK);
>  			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
>  				need_new_crc = 1;
>  			break;
>  		case S_IFREG:
> -			success = process_inode_data(dip, TYP_DATA);
> +			rval = process_inode_data(dip, TYP_DATA);
>  			break;
>  		case S_IFIFO:
>  		case S_IFCHR:
>  		case S_IFBLK:
>  		case S_IFSOCK:
> -			success = process_dev_inode(dip);
> +			process_dev_inode(dip);
>  			need_new_crc = 1;
>  			break;
>  		default:
>  			break;
>  	}
>  	nametable_clear();
> +	if (!rval)
> +		goto done;
>  
>  	/* copy extended attributes if they exist and forkoff is valid */
> -	if (success && XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
> +	if (XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
>  		attr_data.remote_val_count = 0;
>  		switch (dip->di_aformat) {
>  			case XFS_DINODE_FMT_LOCAL:
> @@ -2425,11 +2424,11 @@ process_inode(
>  				break;
>  
>  			case XFS_DINODE_FMT_EXTENTS:
> -				success = process_exinode(dip, TYP_ATTR);
> +				rval = process_exinode(dip, TYP_ATTR);
>  				break;
>  
>  			case XFS_DINODE_FMT_BTREE:
> -				success = process_btinode(dip, TYP_ATTR);
> +				rval = process_btinode(dip, TYP_ATTR);
>  				break;
>  		}
>  		nametable_clear();
> @@ -2442,7 +2441,8 @@ done:
>  
>  	if (crc_was_ok && need_new_crc)
>  		libxfs_dinode_calc_crc(mp, dip);
> -	return success;
> +
> +	return rval;
>  }
>  
>  static uint32_t	inodes_copied;
> @@ -2541,7 +2541,7 @@ copy_inode_chunk(
>  
>  			/* process_inode handles free inodes, too */
>  			if (!process_inode(agno, agino + ioff + i, dip,
> -			    XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
> +					XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
>  				goto pop_out;
>  
>  			inodes_copied++;
> @@ -2800,7 +2800,7 @@ copy_ino(
>  	xfs_agblock_t		agbno;
>  	xfs_agino_t		agino;
>  	int			offset;
> -	int			rval = 0;
> +	int			rval = 1;
>  
>  	if (ino == 0 || ino == NULLFSINO)
>  		return 1;
> -- 
> 2.35.1
> 

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

* Re: [PATCH 1/4] metadump: handle corruption errors without aborting
  2022-04-27  0:45   ` Darrick J. Wong
@ 2022-04-27  1:26     ` Dave Chinner
  0 siblings, 0 replies; 17+ messages in thread
From: Dave Chinner @ 2022-04-27  1:26 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On Tue, Apr 26, 2022 at 05:45:03PM -0700, Darrick J. Wong wrote:
> On Wed, Apr 27, 2022 at 09:44:50AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > Sean Caron reported that a metadump terminated after givin gthis
> > warning:
> > 
> > xfs_metadump: inode 2216156864 has unexpected extents
> > 
> > Metadump is supposed to ignore corruptions and continue dumping the
> > filesystem as best it can. Whilst it warns about many situations
> > where it can't fully dump structures, it should stop processing that
> > structure and continue with the next one until the entire filesystem
> > has been processed.
> > 
> > Unfortunately, some warning conditions also return an "abort" error
> > status, causing metadump to abort if that condition is hit. Most of
> > these abort conditions should really be "continue on next object"
> > conditions so that the we attempt to dump the rest of the
> > filesystem.
> > 
> > Fix the returns for warnings that incorrectly cause aborts
> > such that the only abort conditions are read errors when
> > "stop-on-read-error" semantics are specified. Also make the return
> > values consistently mean abort/continue rather than returning -errno
> > to mean "stop because read error" and then trying to infer what
> > the error means in callers without the context it occurred in.
> 
> I was almost about to say "This variable should be named success", but
> then noticed that there already /are/ variables named success.  Yuck.

Yeah, mess.

> rval==0 means abort?  and rval!=0 means continue?  If so,

Same as it was before.

> Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Ta.

-Dave.

-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH 2/4] metadump: be careful zeroing corrupt inode forks
  2022-04-27  0:40   ` Darrick J. Wong
@ 2022-04-27  1:27     ` Dave Chinner
  0 siblings, 0 replies; 17+ messages in thread
From: Dave Chinner @ 2022-04-27  1:27 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On Tue, Apr 26, 2022 at 05:40:27PM -0700, Darrick J. Wong wrote:
> On Wed, Apr 27, 2022 at 09:44:51AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > When a corrupt inode fork is encountered, we can zero beyond the end
> > of the inode if the fork pointers are sufficiently trashed. We
> > should not trust the fork pointers when corruption is detected and
> > skip the zeroing in this case. We want metadump to capture the
> > corruption and so skipping the zeroing will give us the best chance
> > of preserving the corruption in a meaningful state for diagnosis.
> > 
> > Reported-by: Sean Caron <scaron@umich.edu>
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> 
> Hmm.  I /think/ the only real change here is the addition of the
> DFORK_DSIZE > LITINO warning, right?  The rest is just reindenting the
> loop body?

Yes.

> If so, LGTM.
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Thanks!

-Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-04-27  0:42   ` Darrick J. Wong
@ 2022-04-27  1:33     ` Dave Chinner
  0 siblings, 0 replies; 17+ messages in thread
From: Dave Chinner @ 2022-04-27  1:33 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On Tue, Apr 26, 2022 at 05:42:41PM -0700, Darrick J. Wong wrote:
> On Wed, Apr 27, 2022 at 09:44:53AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been
> > deprecated and made obsolete.
> > 
> > .....
> > configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete.
> > configure.ac:164: You should run autoupdate.
> > ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
> > m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from...
> > configure.ac:164: the top level
> > configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete.
> > configure.ac:165: You should run autoupdate.
> > ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
> > m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from...
> > configure.ac:165: the top level
> > .....
> > 
> > But "autoupdate" does nothing to fix this, so I have to manually do
> > these conversions:
> > 
> > 	- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
> > 	- AC_TRY_LINK -> AC_LINK_IFELSE
> > 
> > because I have nothing better to do than fix currently working
> > code.
> > 
> > Also, running autoupdate forces the minimum pre-req to be autoconf
> > 2.71 because it replaces other stuff...
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> 
> I hate autoconf, and this seems like stupid pedantry on their part...

Same, and yes, I really don't see the point of forcing everyone to
update code like this when it largely could have been handled simply
by rewriting the AC_TRY_COMPILE macro to use the AC_LANG_PROGRAM
macro internally.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-04-26 23:44 ` [PATCH 4/4] xfsprogs: autoconf modernisation Dave Chinner
  2022-04-27  0:42   ` Darrick J. Wong
@ 2022-05-26 18:49   ` Eric Sandeen
  2022-05-26 19:44     ` Eric Sandeen
  2022-05-27 17:04   ` Darrick J. Wong
  2 siblings, 1 reply; 17+ messages in thread
From: Eric Sandeen @ 2022-05-26 18:49 UTC (permalink / raw)
  To: Dave Chinner, linux-xfs

On 4/26/22 6:44 PM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been
> deprecated and made obsolete.
> 
> .....
> configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete.
> configure.ac:164: You should run autoupdate.
> ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
> m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from...
> configure.ac:164: the top level
> configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete.
> configure.ac:165: You should run autoupdate.
> ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
> m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from...
> configure.ac:165: the top level
> .....
> 
> But "autoupdate" does nothing to fix this, so I have to manually do
> these conversions:
> 
> 	- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
> 	- AC_TRY_LINK -> AC_LINK_IFELSE
> 
> because I have nothing better to do than fix currently working
> code.
> 
> Also, running autoupdate forces the minimum pre-req to be autoconf
> 2.71 because it replaces other stuff...

Bleah, to that part.  2.71 isn't even available on Fedora Core 35 which
was released 6 months ago.
I'm afraid this will break lots of builds in not-very-old environments.

I'm inclined to look into whether I can just replace the obsolete
macros to shut up the warnings for now, does that seem reasonable?

And then bumping the 2.50 minimum to the 8-year-old 2.69 is probably wise ;)

Thanks,
-Eric

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

* Re: [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-05-26 18:49   ` Eric Sandeen
@ 2022-05-26 19:44     ` Eric Sandeen
  2022-05-27  1:11       ` Dave Chinner
  2022-05-27  6:17       ` Christoph Hellwig
  0 siblings, 2 replies; 17+ messages in thread
From: Eric Sandeen @ 2022-05-26 19:44 UTC (permalink / raw)
  To: Dave Chinner, linux-xfs

On 5/26/22 1:49 PM, Eric Sandeen wrote:
>> Also, running autoupdate forces the minimum pre-req to be autoconf
>> 2.71 because it replaces other stuff...
> Bleah, to that part.  2.71 isn't even available on Fedora Core 35 which
> was released 6 months ago.
> I'm afraid this will break lots of builds in not-very-old environments.
> 
> I'm inclined to look into whether I can just replace the obsolete
> macros to shut up the warnings for now, does that seem reasonable?
> 
> And then bumping the 2.50 minimum to the 8-year-old 2.69 is probably wise ;)
> 
> Thanks,
> -Eric

Actually, I think that 2.71 from autoupdate is gratuitous, all your changes
seem fine under the (ancient) 2.69.

So I'm inclined to merge this patch as is, but with a 2.69 minimum, as the
current 2.50 version requirement is for something released around the turn
of the century...

Any concerns or complaints?

-Eric

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

* Re: [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-05-26 19:44     ` Eric Sandeen
@ 2022-05-27  1:11       ` Dave Chinner
  2022-05-27  6:17       ` Christoph Hellwig
  1 sibling, 0 replies; 17+ messages in thread
From: Dave Chinner @ 2022-05-27  1:11 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

On Thu, May 26, 2022 at 02:44:54PM -0500, Eric Sandeen wrote:
> On 5/26/22 1:49 PM, Eric Sandeen wrote:
> >> Also, running autoupdate forces the minimum pre-req to be autoconf
> >> 2.71 because it replaces other stuff...
> > Bleah, to that part.  2.71 isn't even available on Fedora Core 35 which
> > was released 6 months ago.
> > I'm afraid this will break lots of builds in not-very-old environments.
> > 
> > I'm inclined to look into whether I can just replace the obsolete
> > macros to shut up the warnings for now, does that seem reasonable?
> > 
> > And then bumping the 2.50 minimum to the 8-year-old 2.69 is probably wise ;)
> > 
> > Thanks,
> > -Eric
> 
> Actually, I think that 2.71 from autoupdate is gratuitous, all your changes
> seem fine under the (ancient) 2.69.
> 
> So I'm inclined to merge this patch as is, but with a 2.69 minimum, as the
> current 2.50 version requirement is for something released around the turn
> of the century...
> 
> Any concerns or complaints?

Not from me.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-05-26 19:44     ` Eric Sandeen
  2022-05-27  1:11       ` Dave Chinner
@ 2022-05-27  6:17       ` Christoph Hellwig
  1 sibling, 0 replies; 17+ messages in thread
From: Christoph Hellwig @ 2022-05-27  6:17 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Dave Chinner, linux-xfs

On Thu, May 26, 2022 at 02:44:54PM -0500, Eric Sandeen wrote:
> Actually, I think that 2.71 from autoupdate is gratuitous, all your changes
> seem fine under the (ancient) 2.69.
> 
> So I'm inclined to merge this patch as is, but with a 2.69 minimum, as the
> current 2.50 version requirement is for something released around the turn
> of the century...

Sounds good.

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

* Re: [PATCH 4/4] xfsprogs: autoconf modernisation
  2022-04-26 23:44 ` [PATCH 4/4] xfsprogs: autoconf modernisation Dave Chinner
  2022-04-27  0:42   ` Darrick J. Wong
  2022-05-26 18:49   ` Eric Sandeen
@ 2022-05-27 17:04   ` Darrick J. Wong
  2 siblings, 0 replies; 17+ messages in thread
From: Darrick J. Wong @ 2022-05-27 17:04 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs

On Wed, Apr 27, 2022 at 09:44:53AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been
> deprecated and made obsolete.
> 
> .....
> configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete.
> configure.ac:164: You should run autoupdate.
> ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
> m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from...
> configure.ac:164: the top level
> configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete.
> configure.ac:165: You should run autoupdate.
> ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
> m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from...
> configure.ac:165: the top level
> .....
> 
> But "autoupdate" does nothing to fix this, so I have to manually do
> these conversions:
> 
> 	- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
> 	- AC_TRY_LINK -> AC_LINK_IFELSE

Note for the next time we have to do this: I started rebasing djwong-dev
on this one patch, and noticed my autoupdate accepts file paths, which
means that one can do things like:

$ autoupdate configure.ac m4/*.m4

instead of doing this by hand.

--D

> because I have nothing better to do than fix currently working
> code.
> 
> Also, running autoupdate forces the minimum pre-req to be autoconf
> 2.71 because it replaces other stuff...
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  configure.ac          |   8 +--
>  m4/package_attr.m4    |   8 ++-
>  m4/package_libcdev.m4 | 158 ++++++++++++++++++++++++++----------------
>  m4/package_types.m4   |   8 ++-
>  m4/package_urcu.m4    |  18 +++--
>  5 files changed, 123 insertions(+), 77 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 4278145fe74b..36e42394a9df 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,13 +1,13 @@
> -AC_INIT([xfsprogs], [5.15.0], [linux-xfs@vger.kernel.org])
> -AC_PREREQ(2.50)
> +AC_INIT([xfsprogs],[5.15.0],[linux-xfs@vger.kernel.org])
> +AC_PREREQ([2.71])
>  AC_CONFIG_AUX_DIR([.])
>  AC_CONFIG_MACRO_DIR([m4])
>  AC_CONFIG_SRCDIR([include/libxfs.h])
> -AC_CONFIG_HEADER(include/platform_defs.h)
> +AC_CONFIG_HEADERS([include/platform_defs.h])
>  AC_PREFIX_DEFAULT(/usr)
>  
>  AC_PROG_INSTALL
> -AC_PROG_LIBTOOL
> +LT_INIT
>  
>  AC_PROG_CC
>  AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
> diff --git a/m4/package_attr.m4 b/m4/package_attr.m4
> index 432492311d18..05e02b38fb5a 100644
> --- a/m4/package_attr.m4
> +++ b/m4/package_attr.m4
> @@ -8,15 +8,17 @@ AC_DEFUN([AC_PACKAGE_WANT_ATTRIBUTES_H],
>  #
>  AC_DEFUN([AC_HAVE_LIBATTR],
>    [ AC_MSG_CHECKING([for struct attrlist_cursor])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <sys/types.h>
>  #include <attr/attributes.h>
> -       ], [
> +	]], [[
>  struct attrlist_cursor *cur;
>  struct attrlist *list;
>  struct attrlist_ent *ent;
>  int flags = ATTR_ROOT;
> -       ], have_libattr=yes
> +	]])
> +    ], have_libattr=yes
>            AC_MSG_RESULT(yes),
>            AC_MSG_RESULT(no))
>      AC_SUBST(have_libattr)
> diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
> index adab9bb9773a..94d76c7b3a19 100644
> --- a/m4/package_libcdev.m4
> +++ b/m4/package_libcdev.m4
> @@ -3,11 +3,13 @@
>  #
>  AC_DEFUN([AC_HAVE_FADVISE],
>    [ AC_MSG_CHECKING([for fadvise ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <fcntl.h>
> -    ], [
> -	posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
> +	]], [[
> +posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
> +	]])
>      ],	have_fadvise=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -19,11 +21,13 @@ AC_DEFUN([AC_HAVE_FADVISE],
>  #
>  AC_DEFUN([AC_HAVE_MADVISE],
>    [ AC_MSG_CHECKING([for madvise ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/mman.h>
> -    ], [
> -	posix_madvise(0, 0, MADV_NORMAL);
> +	]], [[
> +posix_madvise(0, 0, MADV_NORMAL);
> +	]])
>      ],	have_madvise=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -35,11 +39,13 @@ AC_DEFUN([AC_HAVE_MADVISE],
>  #
>  AC_DEFUN([AC_HAVE_MINCORE],
>    [ AC_MSG_CHECKING([for mincore ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/mman.h>
> -    ], [
> -	mincore(0, 0, 0);
> +	]], [[
> +mincore(0, 0, 0);
> +	]])
>      ],	have_mincore=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -51,11 +57,13 @@ AC_DEFUN([AC_HAVE_MINCORE],
>  #
>  AC_DEFUN([AC_HAVE_SENDFILE],
>    [ AC_MSG_CHECKING([for sendfile ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/sendfile.h>
> -    ], [
> -         sendfile(0, 0, 0, 0);
> +	]], [[
> +sendfile(0, 0, 0, 0);
> +	]])
>      ],	have_sendfile=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -67,11 +75,13 @@ AC_DEFUN([AC_HAVE_SENDFILE],
>  #
>  AC_DEFUN([AC_HAVE_GETMNTENT],
>    [ AC_MSG_CHECKING([for getmntent ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <stdio.h>
>  #include <mntent.h>
> -    ], [
> -         getmntent(0);
> +	]], [[
> +getmntent(0);
> +	]])
>      ], have_getmntent=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -83,12 +93,14 @@ AC_DEFUN([AC_HAVE_GETMNTENT],
>  #
>  AC_DEFUN([AC_HAVE_FALLOCATE],
>    [ AC_MSG_CHECKING([for fallocate])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <fcntl.h>
>  #include <linux/falloc.h>
> -    ], [
> -         fallocate(0, 0, 0, 0);
> +	]], [[
> +fallocate(0, 0, 0, 0);
> +	]])
>      ], have_fallocate=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -100,13 +112,15 @@ AC_DEFUN([AC_HAVE_FALLOCATE],
>  #
>  AC_DEFUN([AC_HAVE_FIEMAP],
>    [ AC_MSG_CHECKING([for fiemap])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <linux/fs.h>
>  #include <linux/fiemap.h>
> -    ], [
> -         struct fiemap *fiemap;
> -         ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
> +	]], [[
> +struct fiemap *fiemap;
> +ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
> +	]])
>      ], have_fiemap=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -118,12 +132,14 @@ AC_DEFUN([AC_HAVE_FIEMAP],
>  #
>  AC_DEFUN([AC_HAVE_PREADV],
>    [ AC_MSG_CHECKING([for preadv])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _BSD_SOURCE
>  #define _DEFAULT_SOURCE
>  #include <sys/uio.h>
> -    ], [
> -         preadv(0, 0, 0, 0);
> +	]], [[
> +preadv(0, 0, 0, 0);
> +	]])
>      ], have_preadv=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -135,11 +151,13 @@ AC_DEFUN([AC_HAVE_PREADV],
>  #
>  AC_DEFUN([AC_HAVE_PWRITEV2],
>    [ AC_MSG_CHECKING([for pwritev2])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _BSD_SOURCE
>  #include <sys/uio.h>
> -    ], [
> -         pwritev2(0, 0, 0, 0, 0);
> +	]], [[
> +pwritev2(0, 0, 0, 0, 0);
> +	]])
>      ], have_pwritev2=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -151,12 +169,14 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
>  #
>  AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
>    [ AC_MSG_CHECKING([for copy_file_range])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/syscall.h>
>  #include <unistd.h>
> -    ], [
> -         syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
> +	]], [[
> +syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
> +	]])
>      ], have_copy_file_range=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -168,11 +188,13 @@ AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
>  #
>  AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
>    [ AC_MSG_CHECKING([for sync_file_range])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <fcntl.h>
> -    ], [
> -         sync_file_range(0, 0, 0, 0);
> +	]], [[
> +sync_file_range(0, 0, 0, 0);
> +	]])
>      ], have_sync_file_range=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -184,11 +206,13 @@ AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
>  #
>  AC_DEFUN([AC_HAVE_SYNCFS],
>    [ AC_MSG_CHECKING([for syncfs])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <unistd.h>
> -    ], [
> -         syncfs(0);
> +	]], [[
> +syncfs(0);
> +	]])
>      ], have_syncfs=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -200,10 +224,12 @@ AC_DEFUN([AC_HAVE_SYNCFS],
>  #
>  AC_DEFUN([AC_HAVE_READDIR],
>    [ AC_MSG_CHECKING([for readdir])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <dirent.h>
> -    ], [
> -         readdir(0);
> +	]], [[
> +readdir(0);
> +	]])
>      ], have_readdir=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -304,15 +330,17 @@ AC_DEFUN([AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG],
>  #
>  AC_DEFUN([AC_HAVE_GETFSMAP],
>    [ AC_MSG_CHECKING([for GETFSMAP])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <sys/syscall.h>
>  #include <unistd.h>
>  #include <linux/fs.h>
>  #include <linux/fsmap.h>
> -    ], [
> -         unsigned long x = FS_IOC_GETFSMAP;
> -         struct fsmap_head fh;
> +	]], [[
> +unsigned long x = FS_IOC_GETFSMAP;
> +struct fsmap_head fh;
> +	]])
>      ], have_getfsmap=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -338,11 +366,13 @@ AC_DEFUN([AC_HAVE_STATFS_FLAGS],
>  #
>  AC_DEFUN([AC_HAVE_MAP_SYNC],
>    [ AC_MSG_CHECKING([for MAP_SYNC])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <asm-generic/mman.h>
>  #include <asm-generic/mman-common.h>
> -    ], [
> -        int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
> +	]], [[
> +int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
> +	]])
>      ], have_map_sync=yes
>  	AC_MSG_RESULT(yes),
>  	AC_MSG_RESULT(no))
> @@ -354,13 +384,15 @@ AC_DEFUN([AC_HAVE_MAP_SYNC],
>  #
>  AC_DEFUN([AC_HAVE_MALLINFO],
>    [ AC_MSG_CHECKING([for mallinfo ])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <malloc.h>
> -    ], [
> -         struct mallinfo test;
> +	]], [[
> +struct mallinfo test;
>  
> -         test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
> -         test = mallinfo();
> +test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
> +test = mallinfo();
> +	]])
>      ], have_mallinfo=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -400,10 +432,13 @@ AC_DEFUN([AC_HAVE_FSTATAT],
>  #
>  AC_DEFUN([AC_HAVE_SG_IO],
>    [ AC_MSG_CHECKING([for struct sg_io_hdr ])
> -    AC_TRY_COMPILE([#include <scsi/sg.h>],
> -    [
> -         struct sg_io_hdr hdr;
> -         ioctl(0, SG_IO, &hdr);
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
> +#include <scsi/sg.h>
> +	]], [[
> +struct sg_io_hdr hdr;
> +ioctl(0, SG_IO, &hdr);
> +	]])
>      ], have_sg_io=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -415,10 +450,13 @@ AC_DEFUN([AC_HAVE_SG_IO],
>  #
>  AC_DEFUN([AC_HAVE_HDIO_GETGEO],
>    [ AC_MSG_CHECKING([for struct hd_geometry ])
> -    AC_TRY_COMPILE([#include <linux/hdreg.h>],
> -    [
> -         struct hd_geometry hdr;
> -         ioctl(0, HDIO_GETGEO, &hdr);
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
> +#include <linux/hdreg.h>,
> +	]], [[
> +struct hd_geometry hdr;
> +ioctl(0, HDIO_GETGEO, &hdr);
> +	]])
>      ], have_hdio_getgeo=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> diff --git a/m4/package_types.m4 b/m4/package_types.m4
> index 1c35839319d6..6e817a310f79 100644
> --- a/m4/package_types.m4
> +++ b/m4/package_types.m4
> @@ -4,9 +4,11 @@
>  AH_TEMPLATE([HAVE_UMODE_T], [Whether you have umode_t])
>  AC_DEFUN([AC_TYPE_UMODE_T],
>    [ AC_MSG_CHECKING([for umode_t])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #include <asm/types.h>
> -    ], [
> -         umode_t umode;
> +	]], [[
> +umode_t umode;
> +	]])
>      ], AC_DEFINE(HAVE_UMODE_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
>    ])
> diff --git a/m4/package_urcu.m4 b/m4/package_urcu.m4
> index f8e798b66136..ef116e0cda76 100644
> --- a/m4/package_urcu.m4
> +++ b/m4/package_urcu.m4
> @@ -10,11 +10,13 @@ AC_DEFUN([AC_PACKAGE_NEED_URCU_H],
>  
>  AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
>    [ AC_MSG_CHECKING([for liburcu])
> -    AC_TRY_COMPILE([
> +    AC_COMPILE_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <urcu.h>
> -    ], [
> -       rcu_init();
> +	]], [[
> +rcu_init();
> +	]])
>      ], liburcu=-lurcu
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> @@ -28,12 +30,14 @@ AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
>  #
>  AC_DEFUN([AC_HAVE_LIBURCU_ATOMIC64],
>    [ AC_MSG_CHECKING([for atomic64_t support in liburcu])
> -    AC_TRY_LINK([
> +    AC_LINK_IFELSE(
> +    [	AC_LANG_PROGRAM([[
>  #define _GNU_SOURCE
>  #include <urcu.h>
> -    ], [
> -       long long f = 3;
> -       uatomic_inc(&f);
> +	]], [[
> +long long f = 3;
> +uatomic_inc(&f);
> +	]])
>      ], have_liburcu_atomic64=yes
>         AC_MSG_RESULT(yes),
>         AC_MSG_RESULT(no))
> -- 
> 2.35.1
> 

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

end of thread, other threads:[~2022-05-27 17:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 23:44 [PATCH 0/4] xfsprogs: fixes and updates Dave Chinner
2022-04-26 23:44 ` [PATCH 1/4] metadump: handle corruption errors without aborting Dave Chinner
2022-04-27  0:45   ` Darrick J. Wong
2022-04-27  1:26     ` Dave Chinner
2022-04-26 23:44 ` [PATCH 2/4] metadump: be careful zeroing corrupt inode forks Dave Chinner
2022-04-27  0:40   ` Darrick J. Wong
2022-04-27  1:27     ` Dave Chinner
2022-04-26 23:44 ` [PATCH 3/4] xfs_io: add a quiet option to bulkstat Dave Chinner
2022-04-27  0:38   ` Darrick J. Wong
2022-04-26 23:44 ` [PATCH 4/4] xfsprogs: autoconf modernisation Dave Chinner
2022-04-27  0:42   ` Darrick J. Wong
2022-04-27  1:33     ` Dave Chinner
2022-05-26 18:49   ` Eric Sandeen
2022-05-26 19:44     ` Eric Sandeen
2022-05-27  1:11       ` Dave Chinner
2022-05-27  6:17       ` Christoph Hellwig
2022-05-27 17:04   ` Darrick J. Wong

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