All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Iliopoulos <ailiop@suse.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 1/6] libfrog: add dax capability detection in topology probing
Date: Mon, 24 Aug 2020 22:37:19 +0200	[thread overview]
Message-ID: <20200824203724.13477-2-ailiop@suse.com> (raw)
In-Reply-To: <20200824203724.13477-1-ailiop@suse.com>

Detect support for blkid_topology_get_dax in libblkid which was
introduced in util-linux v2.36, and use it to obtain if the underlying
block device is dax-capable. This can be used to issue warnings for
incompatible configurations during mkfs.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 include/builddefs.in |  1 +
 libfrog/Makefile     |  4 ++++
 libfrog/topology.c   | 11 +++++++++--
 libfrog/topology.h   |  1 +
 m4/package_blkid.m4  |  5 +++++
 5 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/builddefs.in b/include/builddefs.in
index 30b2727a8db4..88ecf24a74a7 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -140,6 +140,7 @@ PCFLAGS+= -DHAVE_FSETXATTR
 endif
 ifeq ($(ENABLE_BLKID),yes)
 PCFLAGS+= -DENABLE_BLKID
+HAVE_BLKID_DAX = @have_blkid_dax@
 endif
 ifeq ($(NEED_INTERNAL_FSXATTR),yes)
 PCFLAGS+= -DOVERRIDE_SYSTEM_FSXATTR
diff --git a/libfrog/Makefile b/libfrog/Makefile
index 395ce30804b7..bb680b6822ed 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile
@@ -56,6 +56,10 @@ ifeq ($(HAVE_GETMNTENT),yes)
 LCFLAGS += -DHAVE_GETMNTENT
 endif
 
+ifeq ($(HAVE_BLKID_DAX),yes)
+LCFLAGS += -DHAVE_BLKID_DAX
+endif
+
 LDIRT = gen_crc32table crc32table.h crc32selftest
 
 default: crc32selftest ltdepend $(LTLIBRARY)
diff --git a/libfrog/topology.c b/libfrog/topology.c
index b1b470c9b6d3..713358b01b4c 100644
--- a/libfrog/topology.c
+++ b/libfrog/topology.c
@@ -180,6 +180,7 @@ static void blkid_get_topology(
 	int		*swidth,
 	int		*lsectorsize,
 	int		*psectorsize,
+	int		*dax,
 	int		force_overwrite)
 {
 
@@ -212,6 +213,10 @@ static void blkid_get_topology(
 	*sunit = val;
 	val = blkid_topology_get_optimal_io_size(tp);
 	*swidth = val;
+#if defined(HAVE_BLKID_DAX)
+	val = blkid_topology_get_dax(tp);
+	*dax = val;
+#endif
 
 	/*
 	 * If the reported values are the same as the physical sector size
@@ -275,6 +280,7 @@ static void blkid_get_topology(
 	int		*swidth,
 	int		*lsectorsize,
 	int		*psectorsize,
+	int		*dax,
 	int		force_overwrite)
 {
 	/*
@@ -320,13 +326,14 @@ void get_topology(
 	} else {
 		blkid_get_topology(dfile, &ft->dsunit, &ft->dswidth,
 				   &ft->lsectorsize, &ft->psectorsize,
-				   force_overwrite);
+				   &ft->dax, force_overwrite);
 	}
 
 	if (xi->rtname && !xi->risfile) {
 		int sunit, lsectorsize, psectorsize;
 
 		blkid_get_topology(xi->rtname, &sunit, &ft->rtswidth,
-				   &lsectorsize, &psectorsize, force_overwrite);
+				   &lsectorsize, &psectorsize, &ft->dax,
+				   force_overwrite);
 	}
 }
diff --git a/libfrog/topology.h b/libfrog/topology.h
index 6fde868a5923..cde8ff282287 100644
--- a/libfrog/topology.h
+++ b/libfrog/topology.h
@@ -16,6 +16,7 @@ typedef struct fs_topology {
 	int	rtswidth;	/* stripe width - rt subvolume */
 	int	lsectorsize;	/* logical sector size &*/
 	int	psectorsize;	/* physical sector size */
+	int	dax;		/* dax support */
 } fs_topology_t;
 
 extern void
diff --git a/m4/package_blkid.m4 b/m4/package_blkid.m4
index 9510dced59c1..db7595237120 100644
--- a/m4/package_blkid.m4
+++ b/m4/package_blkid.m4
@@ -14,5 +14,10 @@ AC_DEFUN([AC_HAVE_BLKID_TOPO],
     echo 'Install the Block device ID development package.'
     exit 1
   fi
+  AC_CHECK_FUNCS(blkid_topology_get_dax)
+  if test $ac_cv_func_blkid_topology_get_dax = yes; then
+	have_blkid_dax=yes
+	AC_SUBST(have_blkid_dax)
+  fi
   AC_SUBST(libblkid)
 ])
-- 
2.28.0


  reply	other threads:[~2020-08-24 20:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 20:37 [PATCH 0/6] xfsprogs: blockdev dax detection and warnings Anthony Iliopoulos
2020-08-24 20:37 ` Anthony Iliopoulos [this message]
2020-08-24 20:37 ` [PATCH 2/6] mkfs: warn if blocksize doesn't match pagesize on dax devices Anthony Iliopoulos
2020-08-24 20:37 ` [PATCH 3/6] mkfs: warn if reflink option is enabled on dax-capable devices Anthony Iliopoulos
2020-08-24 20:37 ` [PATCH 4/6] mkfs: introduce -y option to force incompat config combinations Anthony Iliopoulos
2020-08-24 20:37 ` [PATCH 5/6] mkfs: remove redundant assignment of cli sb options on failure Anthony Iliopoulos
2020-09-28 21:49   ` Eric Sandeen
2020-09-28 21:56     ` Eric Sandeen
2020-08-24 20:37 ` [PATCH 6/6] mkfs: remove a couple of unused function parameters Anthony Iliopoulos
2020-09-28 21:50   ` Eric Sandeen
2020-08-24 22:55 ` [PATCH 0/6] xfsprogs: blockdev dax detection and warnings Dave Chinner
2020-08-25  8:48   ` Anthony Iliopoulos
2020-08-25 13:59   ` Eric Sandeen
2020-08-25 14:40     ` Darrick J. Wong
2020-08-25 22:31       ` Dave Chinner
2020-08-25 15:09     ` Anthony Iliopoulos
2020-08-25 17:32       ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200824203724.13477-2-ailiop@suse.com \
    --to=ailiop@suse.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.