|
|
6ee2f4 |
From a92dcf5a6cc49660d75a67966b0eb093b88e3b4c Mon Sep 17 00:00:00 2001
|
|
|
6ee2f4 |
From: "Tinguely, Mark" <mark.tinguely@hpe.com>
|
|
|
6ee2f4 |
Date: Wed, 9 May 2018 16:50:25 +0200
|
|
|
6ee2f4 |
Subject: [PATCH] Aadd HPE XFS support
|
|
|
6ee2f4 |
MIME-Version: 1.0
|
|
|
6ee2f4 |
Content-Type: text/plain; charset=UTF-8
|
|
|
6ee2f4 |
Content-Transfer-Encoding: 8bit
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
HPE XFS has a different superblock magic and type name
|
|
|
6ee2f4 |
to allow the community XFS and HPE XFS to coexist in
|
|
|
6ee2f4 |
the same linux kernel.
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
This patch add HPE XFS support to the quota-tools so
|
|
|
6ee2f4 |
our customers can use it.
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
Signed-off-by: Mark Tinguely <mark.tinguely@hpe.com>
|
|
|
6ee2f4 |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
6ee2f4 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
6ee2f4 |
---
|
|
|
6ee2f4 |
bylabel.c | 4 +++-
|
|
|
6ee2f4 |
mntopt.h | 1 +
|
|
|
6ee2f4 |
quot.c | 3 ++-
|
|
|
6ee2f4 |
quotacheck.c | 5 +++--
|
|
|
6ee2f4 |
quotaio.c | 3 ++-
|
|
|
6ee2f4 |
quotaon.c | 6 ++++--
|
|
|
6ee2f4 |
quotasys.c | 10 +++++++---
|
|
|
6ee2f4 |
7 files changed, 22 insertions(+), 10 deletions(-)
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
diff --git a/bylabel.c b/bylabel.c
|
|
|
6ee2f4 |
index ff10422..5313461 100644
|
|
|
6ee2f4 |
--- a/bylabel.c
|
|
|
6ee2f4 |
+++ b/bylabel.c
|
|
|
6ee2f4 |
@@ -48,6 +48,7 @@ struct ext2_super_block {
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
#define XFS_SUPER_MAGIC "XFSB"
|
|
|
6ee2f4 |
#define XFS_SUPER_MAGIC2 "BSFX"
|
|
|
6ee2f4 |
+#define EXFS_SUPER_MAGIC "EXFS"
|
|
|
6ee2f4 |
struct xfs_super_block {
|
|
|
6ee2f4 |
u_char s_magic[4];
|
|
|
6ee2f4 |
u_char s_dummy[28];
|
|
|
6ee2f4 |
@@ -107,7 +108,8 @@ static int get_label_uuid(const char *device, char **label, char *uuid)
|
|
|
6ee2f4 |
else if (lseek(fd, 0, SEEK_SET) == 0
|
|
|
6ee2f4 |
&& read(fd, (char *)&xfsb, sizeof(xfsb)) == sizeof(xfsb)
|
|
|
6ee2f4 |
&& (strncmp((char *)&xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0 ||
|
|
|
6ee2f4 |
- strncmp((char *)&xfsb.s_magic, XFS_SUPER_MAGIC2, 4) == 0)) {
|
|
|
6ee2f4 |
+ strncmp((char *)&xfsb.s_magic, XFS_SUPER_MAGIC2, 4) == 0 ||
|
|
|
6ee2f4 |
+ strncmp((char *)&xfsb.s_magic, EXFS_SUPER_MAGIC, 4) == 0)) {
|
|
|
6ee2f4 |
memcpy(uuid, xfsb.s_uuid, sizeof(xfsb.s_uuid));
|
|
|
6ee2f4 |
namesize = sizeof(xfsb.s_fsname);
|
|
|
6ee2f4 |
*label = smalloc(namesize + 1);
|
|
|
6ee2f4 |
diff --git a/mntopt.h b/mntopt.h
|
|
|
6ee2f4 |
index 7913048..0f3b0c5 100644
|
|
|
6ee2f4 |
--- a/mntopt.h
|
|
|
6ee2f4 |
+++ b/mntopt.h
|
|
|
6ee2f4 |
@@ -15,6 +15,7 @@
|
|
|
6ee2f4 |
#define MNTTYPE_UDF "udf" /* OSTA UDF file system */
|
|
|
6ee2f4 |
#define MNTTYPE_REISER "reiserfs" /* Reiser file system */
|
|
|
6ee2f4 |
#define MNTTYPE_XFS "xfs" /* SGI XFS file system */
|
|
|
6ee2f4 |
+#define MNTTYPE_EXFS "exfs" /* HPE EXFS file system */
|
|
|
6ee2f4 |
#define MNTTYPE_AUTOFS "autofs" /* Automount mountpoint */
|
|
|
6ee2f4 |
#define MNTTYPE_JFS "jfs" /* JFS file system */
|
|
|
6ee2f4 |
#define MNTTYPE_NFS4 "nfs4" /* NFSv4 filesystem */
|
|
|
6ee2f4 |
diff --git a/quot.c b/quot.c
|
|
|
6ee2f4 |
index 6311f77..c3a31a4 100644
|
|
|
6ee2f4 |
--- a/quot.c
|
|
|
6ee2f4 |
+++ b/quot.c
|
|
|
6ee2f4 |
@@ -143,7 +143,8 @@ static void mounttable(void)
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
while ((mntp = get_next_mount())) {
|
|
|
6ee2f4 |
/* Currently, only XFS is implemented... */
|
|
|
6ee2f4 |
- if (strcmp(mntp->me_type, MNTTYPE_XFS) == 0) {
|
|
|
6ee2f4 |
+ if (strcmp(mntp->me_type, MNTTYPE_XFS) == 0 ||
|
|
|
6ee2f4 |
+ strcmp(mntp->me_type, MNTTYPE_EXFS) == 0) {
|
|
|
6ee2f4 |
checkXFS(mntp->me_devname, mntp->me_dir);
|
|
|
6ee2f4 |
doit = 1;
|
|
|
6ee2f4 |
}
|
|
|
6ee2f4 |
diff --git a/quotacheck.c b/quotacheck.c
|
|
|
6ee2f4 |
index b1302b6..fd01dfc 100644
|
|
|
6ee2f4 |
--- a/quotacheck.c
|
|
|
6ee2f4 |
+++ b/quotacheck.c
|
|
|
6ee2f4 |
@@ -1042,7 +1042,8 @@ static int detect_filename_format(struct mount_entry *mnt, int type)
|
|
|
6ee2f4 |
int fmt;
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
if (strcmp(mnt->me_type, MNTTYPE_XFS) == 0 ||
|
|
|
6ee2f4 |
- strcmp(mnt->me_type, MNTTYPE_GFS2) == 0)
|
|
|
6ee2f4 |
+ strcmp(mnt->me_type, MNTTYPE_GFS2) == 0 ||
|
|
|
6ee2f4 |
+ strcmp(mnt->me_type, MNTTYPE_EXFS) == 0)
|
|
|
6ee2f4 |
return QF_XFS;
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
if (type == USRQUOTA) {
|
|
|
6ee2f4 |
@@ -1116,7 +1117,7 @@ static int compatible_fs_qfmt(char *fstype, int fmt)
|
|
|
6ee2f4 |
{
|
|
|
6ee2f4 |
/* We never check XFS, NFS, and filesystems supporting VFS metaformat */
|
|
|
6ee2f4 |
if (!strcmp(fstype, MNTTYPE_XFS) || nfs_fstype(fstype) ||
|
|
|
6ee2f4 |
- meta_qf_fstype(fstype))
|
|
|
6ee2f4 |
+ meta_qf_fstype(fstype) || !strcmp(fstype, MNTTYPE_EXFS))
|
|
|
6ee2f4 |
return 0;
|
|
|
6ee2f4 |
/* In all other cases we can pick a format... */
|
|
|
6ee2f4 |
if (fmt == -1)
|
|
|
6ee2f4 |
diff --git a/quotaio.c b/quotaio.c
|
|
|
6ee2f4 |
index df893c6..94ae458 100644
|
|
|
6ee2f4 |
--- a/quotaio.c
|
|
|
6ee2f4 |
+++ b/quotaio.c
|
|
|
6ee2f4 |
@@ -79,7 +79,8 @@ struct quota_handle *init_io(struct mount_entry *mnt, int type, int fmt, int fla
|
|
|
6ee2f4 |
}
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
if (!strcmp(mnt->me_type, MNTTYPE_XFS) || /* XFS filesystem? */
|
|
|
6ee2f4 |
- !strcmp(mnt->me_type, MNTTYPE_GFS2)) { /* XFS filesystem? */
|
|
|
6ee2f4 |
+ !strcmp(mnt->me_type, MNTTYPE_GFS2) || /* XFS filesystem? */
|
|
|
6ee2f4 |
+ !strcmp(mnt->me_type, MNTTYPE_EXFS)) { /* EXFS filesystem? */
|
|
|
6ee2f4 |
if (fmt != -1 && fmt != QF_XFS) { /* User wanted some other format? */
|
|
|
6ee2f4 |
errstr(_("Only XFS quota format is allowed on XFS filesystem.\n"));
|
|
|
6ee2f4 |
goto out_handle;
|
|
|
6ee2f4 |
diff --git a/quotaon.c b/quotaon.c
|
|
|
6ee2f4 |
index fe19224..cee2e25 100644
|
|
|
6ee2f4 |
--- a/quotaon.c
|
|
|
6ee2f4 |
+++ b/quotaon.c
|
|
|
6ee2f4 |
@@ -282,7 +282,8 @@ static int newstate(struct mount_entry *mnt, int type, char *extra)
|
|
|
6ee2f4 |
if (!strcmp(mnt->me_type, MNTTYPE_GFS2)) {
|
|
|
6ee2f4 |
errstr(_("Cannot change state of GFS2 quota.\n"));
|
|
|
6ee2f4 |
return 1;
|
|
|
6ee2f4 |
- } else if (!strcmp(mnt->me_type, MNTTYPE_XFS)) { /* XFS filesystem has special handling... */
|
|
|
6ee2f4 |
+ } else if (!strcmp(mnt->me_type, MNTTYPE_XFS) ||
|
|
|
6ee2f4 |
+ !strcmp(mnt->me_type, MNTTYPE_EXFS)) { /* XFS filesystem has special handling... */
|
|
|
6ee2f4 |
if (!kern_qfmt_supp(QF_XFS)) {
|
|
|
6ee2f4 |
errstr(_("Cannot change state of XFS quota. It's not compiled in kernel.\n"));
|
|
|
6ee2f4 |
return 1;
|
|
|
6ee2f4 |
@@ -337,7 +338,8 @@ static int print_state(struct mount_entry *mnt, int type)
|
|
|
6ee2f4 |
if (kern_qfmt_supp(QF_XFS)) {
|
|
|
6ee2f4 |
on = kern_quota_state_xfs(mnt->me_devname, type);
|
|
|
6ee2f4 |
if (!strcmp(mnt->me_type, MNTTYPE_XFS) ||
|
|
|
6ee2f4 |
- !strcmp(mnt->me_type, MNTTYPE_GFS2) || on >= 0) {
|
|
|
6ee2f4 |
+ !strcmp(mnt->me_type, MNTTYPE_GFS2) || on >= 0 ||
|
|
|
6ee2f4 |
+ !strcmp(mnt->me_type, MNTTYPE_EXFS)) {
|
|
|
6ee2f4 |
if (on < 0)
|
|
|
6ee2f4 |
on = 0;
|
|
|
6ee2f4 |
if (!(flags & FL_VERBOSE))
|
|
|
6ee2f4 |
diff --git a/quotasys.c b/quotasys.c
|
|
|
6ee2f4 |
index 9336411..d8c0e48 100644
|
|
|
6ee2f4 |
--- a/quotasys.c
|
|
|
6ee2f4 |
+++ b/quotasys.c
|
|
|
6ee2f4 |
@@ -781,7 +781,8 @@ static void copy_mntoptarg(char *buf, const char *optarg, int buflen)
|
|
|
6ee2f4 |
static int hasquota(const char *dev, struct mntent *mnt, int type, int flags)
|
|
|
6ee2f4 |
{
|
|
|
6ee2f4 |
if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
|
|
|
6ee2f4 |
- !strcmp(mnt->mnt_type, MNTTYPE_XFS))
|
|
|
6ee2f4 |
+ !strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
|
|
|
6ee2f4 |
+ !strcmp(mnt->mnt_type, MNTTYPE_EXFS))
|
|
|
6ee2f4 |
return hasxfsquota(dev, mnt, type, flags);
|
|
|
6ee2f4 |
if (!strcmp(mnt->mnt_type, MNTTYPE_OCFS2))
|
|
|
6ee2f4 |
return hasvfsmetaquota(dev, mnt, type, flags);
|
|
|
6ee2f4 |
@@ -953,12 +954,14 @@ add_entry:
|
|
|
6ee2f4 |
break;
|
|
|
6ee2f4 |
case QF_XFS:
|
|
|
6ee2f4 |
if (!strcmp(mnt->me_type, MNTTYPE_XFS) ||
|
|
|
6ee2f4 |
- !strcmp(mnt->me_type, MNTTYPE_GFS2))
|
|
|
6ee2f4 |
+ !strcmp(mnt->me_type, MNTTYPE_GFS2) ||
|
|
|
6ee2f4 |
+ !strcmp(mnt->me_type, MNTTYPE_EXFS))
|
|
|
6ee2f4 |
goto add_entry;
|
|
|
6ee2f4 |
break;
|
|
|
6ee2f4 |
default:
|
|
|
6ee2f4 |
if (strcmp(mnt->me_type, MNTTYPE_XFS) &&
|
|
|
6ee2f4 |
strcmp(mnt->me_type, MNTTYPE_GFS2) &&
|
|
|
6ee2f4 |
+ strcmp(mnt->me_type, MNTTYPE_EXFS) &&
|
|
|
6ee2f4 |
!nfs_fstype(mnt->me_type))
|
|
|
6ee2f4 |
goto add_entry;
|
|
|
6ee2f4 |
break;
|
|
|
6ee2f4 |
@@ -1059,7 +1062,8 @@ void init_kernel_interface(void)
|
|
|
6ee2f4 |
else {
|
|
|
6ee2f4 |
struct v2_dqstats v2_stats;
|
|
|
6ee2f4 |
|
|
|
6ee2f4 |
- if (!stat("/proc/fs/xfs/stat", &st))
|
|
|
6ee2f4 |
+ if (!stat("/proc/fs/xfs/stat", &st) ||
|
|
|
6ee2f4 |
+ !stat("/proc/fs/exfs/stat", &st))
|
|
|
6ee2f4 |
kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
|
|
|
6ee2f4 |
else {
|
|
|
6ee2f4 |
fs_quota_stat_t dummy;
|
|
|
6ee2f4 |
--
|
|
|
6ee2f4 |
2.26.3
|
|
|
6ee2f4 |
|