From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] libgfs2: Support the new dirent de_cookie field
Date: Mon, 15 Feb 2016 13:41:42 +0000 [thread overview]
Message-ID: <1455543702-27428-1-git-send-email-anprice@redhat.com> (raw)
Detect whether the new de_cookie field (kernel commit 471f3db27) is
present in struct gfs2_dirent in the configure script and update the
metadata description to support that field.
It also seems that meta.c was not using the GFS2_HAS_* defines from
clusterautoconfig.h and that was causing a unit test to fail with
gfs2_dirent: __pad: offset is 28, expected 26
gfs2_dirent: size mismatch between struct 40 and fields 38
This commit adds an #include to fix that.
Fixes Rawhide bz#1307532
Signed-off-by: Andrew Price <anprice@redhat.com>
---
configure.ac | 2 ++
gfs2/libgfs2/meta.c | 10 ++++++++--
gfs2/libgfs2/ondisk.c | 21 ++++++++++++++++++---
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 130cb01..f6174ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,6 +127,8 @@ AC_CHECK_MEMBER([struct gfs2_leaf.lf_inode],[AC_DEFINE([GFS2_HAS_LEAF_HINTS],[],
[], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_dirent.de_rahead],[AC_DEFINE([GFS2_HAS_DE_RAHEAD],[],[Dirent readahead field])],
[], [[#include <linux/gfs2_ondisk.h>]])
+AC_CHECK_MEMBER([struct gfs2_dirent.de_cookie],[AC_DEFINE([GFS2_HAS_DE_COOKIE],[],[Dirent cookie field])],
+ [], [[#include <linux/gfs2_ondisk.h>]])
# *FLAGS handling
ENV_CFLAGS="$CFLAGS"
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 4f43af5..90d5647 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -1,6 +1,7 @@
#include <stdint.h>
#include <string.h>
#include "libgfs2.h"
+#include "clusterautoconfig.h"
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define SYM(x) { x, #x },
@@ -430,10 +431,15 @@ F(de_name_len, .flags = LGFS2_MFF_BYTES)
F(de_type)
#ifdef GFS2_HAS_DE_RAHEAD
F(de_rahead)
-RF(__pad2)
+#ifdef GFS2_HAS_DE_COOKIE
+F(de_cookie)
+RF(pad3)
+#else
+RF(pad2)
+#endif /* GFS2_HAS_DE_COOKIE */
#else
RF(__pad)
-#endif
+#endif /* GFS2_HAS_DE_RAHEAD */
};
#undef STRUCT
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index b9418c5..ea1f61f 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -417,7 +417,15 @@ void gfs2_dirent_in(struct gfs2_dirent *de, char *buf)
CPIN_16(de, str, de_type);
#ifdef GFS2_HAS_DE_RAHEAD
CPIN_16(de, str, de_rahead);
-#endif
+#ifdef GFS2_HAS_DE_COOKIE
+ CPIN_32(de, str, de_cookie);
+ CPIN_08(de, str, pad3, 8);
+#else
+ CPIN_08(de, str, pad2, 12);
+#endif /* GFS2_HAS_DE_COOKIE */
+#else
+ CPIN_08(de, str, __pad, 14);
+#endif /* GFS2_HAS_DE_RAHEAD */
}
void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
@@ -429,10 +437,17 @@ void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
CPOUT_16(de, str, de_rec_len);
CPOUT_16(de, str, de_name_len);
CPOUT_16(de, str, de_type);
- memset(str->__pad, 0, sizeof(str->__pad));
#ifdef GFS2_HAS_DE_RAHEAD
CPOUT_16(de, str, de_rahead);
-#endif
+#ifdef GFS2_HAS_DE_COOKIE
+ CPOUT_32(de, str, de_cookie);
+ CPOUT_08(de, str, pad3, 8);
+#else
+ CPOUT_08(de, str, pad2, 12);
+#endif /* GFS2_HAS_DE_COOKIE */
+#else
+ CPOUT_08(de, str, __pad, 14);
+#endif /* GFS2_HAS_DE_RAHEAD */
}
void gfs2_leaf_in(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh)
--
2.4.3
reply other threads:[~2016-02-15 13:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1455543702-27428-1-git-send-email-anprice@redhat.com \
--to=anprice@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).