From 81aca5cee7e6028d74fd0f6142fff40dcb7ba20d Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 12 Jul 2016 16:15:45 +0200 Subject: Improve detection of XFS quota interface Except for really ancient kernels XFS quota interface is always available when quota is compiled in. In recent kernels it is also usable for other filesystems than XFS. So always add XFS quota format as usable if we have non-ancient kernel. Signed-off-by: Jan Kara --- quotasys.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'quotasys.c') diff --git a/quotasys.c b/quotasys.c index 48368a5..fa28f6e 100644 --- a/quotasys.c +++ b/quotasys.c @@ -1025,18 +1025,11 @@ void init_kernel_interface(void) die(2, _("Cannot set signal handler: %s\n"), strerror(errno)); kernel_qfmt_num = 0; - if (!stat("/proc/fs/xfs/stat", &st)) - kernel_qfmt[kernel_qfmt_num++] = QF_XFS; - else { - fs_quota_stat_t dummy; - - if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS)) - kernel_qfmt[kernel_qfmt_num++] = QF_XFS; - } /* Detect new kernel interface; Assume generic interface unless we can prove there is not one... */ if (!stat("/proc/sys/fs/quota", &st) || errno != ENOENT) { kernel_iface = IFACE_GENERIC; kernel_qfmt[kernel_qfmt_num++] = QF_META; + kernel_qfmt[kernel_qfmt_num++] = QF_XFS; kernel_qfmt[kernel_qfmt_num++] = QF_VFSOLD; kernel_qfmt[kernel_qfmt_num++] = QF_VFSV0; kernel_qfmt[kernel_qfmt_num++] = QF_VFSV1; @@ -1044,6 +1037,15 @@ void init_kernel_interface(void) else { struct v2_dqstats v2_stats; + if (!stat("/proc/fs/xfs/stat", &st)) + kernel_qfmt[kernel_qfmt_num++] = QF_XFS; + else { + fs_quota_stat_t dummy; + + if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) || + (errno != EINVAL && errno != ENOSYS)) + kernel_qfmt[kernel_qfmt_num++] = QF_XFS; + } if (quotactl(QCMD(Q_V2_GETSTATS, 0), NULL, 0, (void *)&v2_stats) >= 0) { kernel_qfmt[kernel_qfmt_num++] = QF_VFSV0; kernel_iface = IFACE_VFSV0; -- cgit v1.2.3