* Mon Feb 15 2016 Andrew Price <anprice@redhat.com> - 3.1.8-7

- libgfs2: Add support for dirent.de_rahead
- gfs2_edit: Include dirent.de_rahead in directory listings
- gfs2-utils: Add a check for the de_rahead field
- libgfs2: Support the new dirent de_cookie field
  Resolves: bz#1307532
This commit is contained in:
Andrew Price 2016-02-15 20:39:08 +00:00
parent 8ee10a8095
commit 0b214d7cb0
5 changed files with 281 additions and 1 deletions

View File

@ -0,0 +1,43 @@
commit 3141e81ae6eef9c2fa1de36929140ec122c70805
Author: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
Date: Wed Sep 9 17:55:29 2015 +0200
libgfs2: Add support for dirent.de_rahead
This field indicates how many blocks of metadata can be read ahead when reading
in the inode a directory entry points at.
Signed-off-by: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 79de64d..70daec4 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -428,6 +428,7 @@ F(de_hash, .flags = LGFS2_MFF_CHECK)
F(de_rec_len, .flags = LGFS2_MFF_BYTES)
F(de_name_len, .flags = LGFS2_MFF_BYTES)
F(de_type)
+F(de_rahead)
RF(__pad)
};
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 4744337..7f34bd2 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -415,6 +415,7 @@ void gfs2_dirent_in(struct gfs2_dirent *de, char *buf)
CPIN_16(de, str, de_rec_len);
CPIN_16(de, str, de_name_len);
CPIN_16(de, str, de_type);
+ CPIN_16(de, str, de_rahead);
}
void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
@@ -427,6 +428,7 @@ void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
CPOUT_16(de, str, de_name_len);
CPOUT_16(de, str, de_type);
memset(str->__pad, 0, sizeof(str->__pad));
+ CPOUT_16(de, str, de_rahead);
}
void gfs2_leaf_in(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh)

View File

@ -0,0 +1,32 @@
commit dcd8296e142d3bd69e1a1bda2c096ed78fe4888f
Author: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
Date: Wed Sep 9 17:55:30 2015 +0200
gfs2_edit: Include dirent.de_rahead in directory listings
When dumping a directory, for directory each entry, also print how many blocks
of metadata can be read ahead when reading in the inode the entry points at.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index e5cb12c..b1826a1 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -342,13 +342,14 @@ static int display_leaf(struct iinfo *ind)
strcpy(edit_fmt, "%llx");
}
}
- print_gfs2("%d/%d [%08x] %lld/%lld (0x%llx/0x%llx): ",
+ print_gfs2("%d/%d [%08x] %lld/%lld (0x%llx/0x%llx) +%u: ",
total_dirents, d + 1,
ind->ii[0].dirent[d].dirent.de_hash,
ind->ii[0].dirent[d].dirent.de_inum.no_formal_ino,
ind->ii[0].dirent[d].block,
ind->ii[0].dirent[d].dirent.de_inum.no_formal_ino,
- ind->ii[0].dirent[d].block);
+ ind->ii[0].dirent[d].block,
+ (unsigned int)ind->ii[0].dirent[d].dirent.de_rahead);
}
print_inode_type(ind->ii[0].dirent[d].dirent.de_type);
print_gfs2(" %s", ind->ii[0].dirent[d].filename);

View File

@ -0,0 +1,83 @@
commit 471bc208c8e29013b2abb66f36d6e6d9ef4e4337
Author: Andrew Price <anprice@redhat.com>
Date: Thu Sep 10 11:33:24 2015 +0100
gfs2-utils: Add a check for the de_rahead field
gfs2_dirent.de_rahead first appeared in Linux 3.15. Support prior
versions by checking for de_rahead and using it conditionally.
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/configure.ac b/configure.ac
index 35cafe6..a5418aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,8 @@ AC_CHECK_HEADER([linux/gfs2_ondisk.h], [], [AC_MSG_ERROR([Unable to find linux/g
AC_CHECK_MEMBER([struct gfs2_sb.sb_uuid], [], [], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_leaf.lf_inode],[AC_DEFINE([GFS2_HAS_LEAF_HINTS],[],[Leaf block 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>]])
# *FLAGS handling
ENV_CFLAGS="$CFLAGS"
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index b1826a1..a13827e 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -349,7 +349,12 @@ static int display_leaf(struct iinfo *ind)
ind->ii[0].dirent[d].block,
ind->ii[0].dirent[d].dirent.de_inum.no_formal_ino,
ind->ii[0].dirent[d].block,
- (unsigned int)ind->ii[0].dirent[d].dirent.de_rahead);
+#ifdef GFS2_HAS_DE_RAHEAD
+ (unsigned int)ind->ii[0].dirent[d].dirent.de_rahead
+#else
+ 0
+#endif
+ );
}
print_inode_type(ind->ii[0].dirent[d].dirent.de_type);
print_gfs2(" %s", ind->ii[0].dirent[d].filename);
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 70daec4..4f43af5 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -428,8 +428,12 @@ F(de_hash, .flags = LGFS2_MFF_CHECK)
F(de_rec_len, .flags = LGFS2_MFF_BYTES)
F(de_name_len, .flags = LGFS2_MFF_BYTES)
F(de_type)
+#ifdef GFS2_HAS_DE_RAHEAD
F(de_rahead)
+RF(__pad2)
+#else
RF(__pad)
+#endif
};
#undef STRUCT
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 7f34bd2..b9418c5 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -415,7 +415,9 @@ void gfs2_dirent_in(struct gfs2_dirent *de, char *buf)
CPIN_16(de, str, de_rec_len);
CPIN_16(de, str, de_name_len);
CPIN_16(de, str, de_type);
+#ifdef GFS2_HAS_DE_RAHEAD
CPIN_16(de, str, de_rahead);
+#endif
}
void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
@@ -428,7 +430,9 @@ void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
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
}
void gfs2_leaf_in(struct gfs2_leaf *lf, struct gfs2_buffer_head *bh)

View File

@ -0,0 +1,106 @@
commit da2bced4ff2a8fa9c95fde8071f2f164c0c1466a
Author: Andrew Price <anprice@redhat.com>
Date: Mon Feb 15 12:42:51 2016 +0000
libgfs2: Support the new dirent de_cookie field
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>
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)

View File

@ -12,7 +12,7 @@
Name: gfs2-utils
Version: 3.1.8
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2+ and LGPLv2+
Group: System Environment/Kernel
Summary: Utilities for managing the global file system (GFS2)
@ -36,6 +36,11 @@ Patch1: gfs2_utils_Fix_hang_on_withdraw.patch
Patch2: scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch
Patch3: scripts_install_the_withdraw_helper_script.patch
Patch4: scripts_install_the_withdraw_udev_rules_script.patch
Patch5: 1307532-1-libgfs2_Add_support_for_dirent_de_rahead.patch
Patch6: 1307532-2-gfs2_edit_Include_dirent_de_rahead_in_directory_listings.patch
Patch7: 1307532-3-gfs2_utils_Add_a_check_for_the_de_rahead_field.patch
Patch8: 1307532-4-libgfs2_Support_the_new_dirent_de_cookie_field.patch
%prep
%setup -q -n gfs2-utils-%{version}
@ -44,6 +49,10 @@ Patch4: scripts_install_the_withdraw_udev_rules_script.patch
%patch2 -p 1 -b .scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper
%patch3 -p 1 -b .scripts_install_the_withdraw_helper_script
%patch4 -p 1 -b .scripts_install_the_withdraw_udev_rules_script
%patch5 -p 1 -b .1307532-1-libgfs2_Add_support_for_dirent_de_rahead
%patch6 -p 1 -b .1307532-2-gfs2_edit_Include_dirent_de_rahead_in_directory_listings
%patch7 -p 1 -b .1307532-3-gfs2_utils_Add_a_check_for_the_de_rahead_field
%patch8 -p 1 -b .1307532-4-libgfs2_Support_the_new_dirent_de_cookie_field
%build
./autogen.sh
@ -82,6 +91,13 @@ file systems.
%{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules
%changelog
* Mon Feb 15 2016 Andrew Price <anprice@redhat.com> - 3.1.8-7
- libgfs2: Add support for dirent.de_rahead
- gfs2_edit: Include dirent.de_rahead in directory listings
- gfs2-utils: Add a check for the de_rahead field
- libgfs2: Support the new dirent de_cookie field
Resolves: bz#1307532
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.8-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild