From: Ned Bass Date: Fri, 11 Feb 2011 20:12:19 +0000 (-0800) Subject: LU-84 Allow building against kernel devel headers with quotas X-Git-Tag: 2.0.59-llnl3-base~5 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=560ade217a6de8960792b776ea0417e38c41192f LU-84 Allow building against kernel devel headers with quotas The quota format definitions are normally found in private kernel headers. However, some sites build Lustre against kernel development headers rather than than full kernel source. To accomodate this we add the minimal set of required definitions to lustre/include/lustre_quota.h which will take effect only if quotaio_v*.h are not located at configure time. The upstream version of the 64-bit quota format patch in RHEL6 adds QFMT_VFS_V1 to include/linux/quota.h, so configure can check for that if the quotaio_v*.h headers aren't found. Signed-off-by: Ned Bass Change-Id: Id627f21604f1e35f550adb972c7f0e0ca9edf115 Reviewed-on: http://review.whamcloud.com/295 Tested-by: Hudson Reviewed-by: Oleg Drokin Reviewed-by: Bobi Jam Reviewed-by: Johann Lombardi --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index fe3afd5..f4e0e1f 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1921,6 +1921,9 @@ AC_DEFUN([LC_HAVE_QUOTAIO_V1_H], [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v1.h],[ AC_DEFINE(HAVE_QUOTAIO_V1_H, 1, [kernel has include/linux/quotaio_v1.h]) +],[LB_CHECK_FILE([$LINUX/fs/quotaio_v1.h],[ + AC_DEFINE(HAVE_FS_QUOTAIO_V1_H, 1, + [kernel has fs/quotaio_v1.h]) ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v1.h],[ AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_V1_H, 1, [kernel has fs/quota/quotaio_v1.h]) @@ -1929,6 +1932,7 @@ AC_DEFUN([LC_HAVE_QUOTAIO_V1_H], ]) ]) ]) +]) # sles10 sp2 need 5 parameter for vfs_symlink AC_DEFUN([LC_VFS_SYMLINK_5ARGS], @@ -2121,7 +2125,11 @@ EXTRA_KCFLAGS="$tmp_flags" # # LC_QUOTA64 -# linux kernel have 64-bit limits support +# +# Check if kernel has been patched for 64-bit quota limits support. +# The upstream version of this patch in RHEL6 2.6.32 kernels introduces +# the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for +# that in the absence of quotaio_v1.h in the kernel headers. # AC_DEFUN([LC_QUOTA64],[ AC_MSG_CHECKING([if kernel has 64-bit quota limits support]) @@ -2134,13 +2142,15 @@ EXTRA_KCFLAGS="-I$LINUX/fs" # include int versions[] = V2_INITQVERSIONS_R1; struct v2_disk_dqblk_r1 dqblk_r1; - #else - # ifdef HAVE_FS_QUOTA_QUOTAIO_V1_H - # include - # else - # include - # endif + #elif defined(HAVE_FS_QUOTA_QUOTAIO_V1_H) + # include struct v2r1_disk_dqblk dqblk_r1; + #elif defined(HAVE_FS_QUOTAIO_V1_H) + # include + struct v2r1_disk_dqblk dqblk_r1; + #else + #include + int ver = QFMT_VFS_V1; #endif ],[],[ AC_DEFINE(HAVE_QUOTA64, 1, [have quota64]) diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index ee0ca22..4b72bda 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -797,6 +797,48 @@ extern quota_interface_t lmv_quota_interface; "admin_quotafile_v2.grp" /** group admin quotafile */\ } +/* + * Definitions of structures for vfsv0 quota format + * Source linux/fs/quota/quotaio_v2.h + * + * The following definitions are normally found in private kernel headers. + * However, some sites build Lustre against kernel development headers rather + * than than full kernel source, so we provide them here for compatibility. + */ +#ifdef __KERNEL__ +# if !defined(HAVE_QUOTAIO_V1_H) && !defined(HAVE_FS_QUOTA_QUOTAIO_V1_H) && \ + !defined(HAVE_FS_QUOTAIO_V1_H) + +#include +#include + +#define V2_INITQMAGICS {\ + 0xd9c01f11, /* USRQUOTA */\ + 0xd9c01927 /* GRPQUOTA */\ +} + +/* Header with type and version specific information */ +struct v2_disk_dqinfo { + __le32 dqi_bgrace; /* Time before block soft limit becomes hard limit */ + __le32 dqi_igrace; /* Time before inode soft limit becomes hard limit */ + __le32 dqi_flags; /* Flags for quotafile (DQF_*) */ + __le32 dqi_blocks; /* Number of blocks in file */ + __le32 dqi_free_blk; /* Number of first free block in the list */ + __le32 dqi_free_entry; /* Number of block with at least one free entry */ +}; + +/* First generic header */ +struct v2_disk_dqheader { + __le32 dqh_magic; /* Magic number identifying file */ + __le32 dqh_version; /* File version */ +}; +#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */ +#define QT_TREEOFF 1 /* Offset of tree in file in blocks */ +#define V2_DQTREEOFF QT_TREEOFF + +# endif /* !defined(HAVE_QUOTAIO_V1_H) ... */ +#endif /* __KERNEL__ */ + /** @} quota */ #endif /* _LUSTRE_QUOTA_H */ diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index afae10d..97fa788 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -68,7 +68,7 @@ # include # include # define V2_DQTREEOFF QT_TREEOFF -#else +#elif defined(HAVE_FS_QUOTAIO_V1_H) # include # include # include