From fb06c1a898a5f0edd248db2cd6fbf8c31eac8dfd Mon Sep 17 00:00:00 2001 From: Johann Lombardi Date: Mon, 8 Oct 2012 14:34:47 +0200 Subject: [PATCH] LU-1842 quota: remove leftovers from old code - remove all references to qunit_data which is the old format for slave-master RPCs - gather all quota-related data structure definitions in one single place in lustre_idl.h - rename lquota.h to lustre_quota.h since this is the standard naming scheme for all lustre components. Signed-off-by: Johann Lombardi Change-Id: Ifbadb639517c52741c210668f28452ea55bf6a43 Reviewed-on: http://review.whamcloud.com/4221 Tested-by: Hudson Reviewed-by: Fan Yong Reviewed-by: Niu Yawei Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/Makefile.am | 2 +- lustre/include/lquota.h | 220 ---------- lustre/include/lustre/lustre_idl.h | 439 ++++++++----------- lustre/include/lustre_quota.h | 878 +++++++------------------------------ lustre/include/lustre_req_layout.h | 4 - lustre/include/obd.h | 19 +- lustre/llite/dir.c | 1 + lustre/lmv/lmv_obd.c | 1 + lustre/lvfs/lvfs_linux.c | 1 - lustre/mds/handler.c | 1 - lustre/mdt/mdt_handler.c | 2 +- lustre/mdt/mdt_internal.h | 2 +- lustre/mgs/mgs_llog.c | 2 +- lustre/obdclass/dt_object.c | 2 +- lustre/ofd/lproc_ofd.c | 1 - lustre/ofd/ofd_obd.c | 2 +- lustre/osd-ldiskfs/osd_handler.c | 3 +- lustre/osd-ldiskfs/osd_internal.h | 2 +- lustre/osd-ldiskfs/osd_quota.c | 2 +- lustre/osd-zfs/osd_internal.h | 2 +- lustre/osd-zfs/osd_quota.c | 2 +- lustre/ost/ost_handler.c | 6 +- lustre/ost/ost_internal.h | 3 - lustre/ptlrpc/layout.c | 31 -- lustre/ptlrpc/pack_generic.c | 82 ---- lustre/ptlrpc/wiretest.c | 69 +-- lustre/quota/lquota_internal.h | 2 +- lustre/quota/qmt_dev.c | 2 +- lustre/utils/lfs.c | 1 - lustre/utils/req-layout.c | 1 - lustre/utils/wirecheck.c | 41 +- lustre/utils/wiretest.c | 69 +-- 32 files changed, 382 insertions(+), 1513 deletions(-) delete mode 100644 lustre/include/lquota.h diff --git a/lustre/include/Makefile.am b/lustre/include/Makefile.am index d0a1197..d16942d 100644 --- a/lustre/include/Makefile.am +++ b/lustre/include/Makefile.am @@ -48,4 +48,4 @@ EXTRA_DIST = ioctl.h liblustre.h lprocfs_status.h lustre_cfg.h \ md_object.h dt_object.h lustre_param.h lustre_mdt.h \ lustre_fid.h lustre_fld.h lustre_req_layout.h lustre_capa.h \ lustre_idmap.h lustre_eacl.h interval_tree.h obd_cksum.h \ - lu_ref.h cl_object.h lustre_acl.h lclient.h lu_target.h lquota.h + lu_ref.h cl_object.h lustre_acl.h lclient.h lu_target.h diff --git a/lustre/include/lquota.h b/lustre/include/lquota.h deleted file mode 100644 index 043daf1..0000000 --- a/lustre/include/lquota.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 021110-1307, USA - * - * GPL HEADER END - */ -/* - * Copyright (c) 2011, 2012, Whamcloud, Inc. - * Use is subject to license terms. - */ - -#include -#include -#include - -#ifndef _LUSTRE_LQUOTA_H -#define _LUSTRE_LQUOTA_H - -struct lquota_id_info; -struct lquota_trans; - -/* Gather all quota record type in an union that can be used to read any records - * from disk. All fields of these records must be 64-bit aligned, otherwise the - * OSD layer may swab them incorrectly. */ -union lquota_rec { - struct lquota_glb_rec lqr_glb_rec; - struct lquota_slv_rec lqr_slv_rec; - struct lquota_acct_rec lqr_acct_rec; -}; - -/* Index features supported by the global index objects - * Only used for migration purpose and should be removed once on-disk migration - * is no longer needed */ -extern struct dt_index_features dt_quota_iusr_features; -extern struct dt_index_features dt_quota_busr_features; -extern struct dt_index_features dt_quota_igrp_features; -extern struct dt_index_features dt_quota_bgrp_features; - -/* Name used in the configuration logs to identify the default metadata pool - * (composed of all the MDTs, with pool ID 0) and the default data pool (all - * the OSTs, with pool ID 0 too). */ -#define QUOTA_METAPOOL_NAME "mdt=" -#define QUOTA_DATAPOOL_NAME "ost=" - -/* - * Quota Master Target support - */ - -/* Request handlers for quota master operations. - * This is used by the MDT to pass quota/lock requests to the quota master - * target. This won't be needed any more once the QMT is a real target and - * does not rely any more on the MDT service threads and namespace. */ -struct qmt_handlers { - /* Handle quotactl request from client. */ - int (*qmth_quotactl)(const struct lu_env *, struct lu_device *, - struct obd_quotactl *); - - /* Handle dqacq/dqrel request from slave. */ - int (*qmth_dqacq)(const struct lu_env *, struct lu_device *, - struct ptlrpc_request *); - - /* LDLM intent policy associated with quota locks */ - int (*qmth_intent_policy)(const struct lu_env *, struct lu_device *, - struct ptlrpc_request *, struct ldlm_lock **, - int); - - /* Initialize LVB of ldlm resource associated with quota objects */ - int (*qmth_lvbo_init)(struct lu_device *, struct ldlm_resource *); - - /* Update LVB of ldlm resource associated with quota objects */ - int (*qmth_lvbo_update)(struct lu_device *, struct ldlm_resource *, - struct ptlrpc_request *, int); - - /* Return size of LVB to be packed in ldlm message */ - int (*qmth_lvbo_size)(struct lu_device *, struct ldlm_lock *); - - /* Fill request buffer with lvb */ - int (*qmth_lvbo_fill)(struct lu_device *, struct ldlm_lock *, void *, - int); - - /* Free lvb associated with ldlm resource */ - int (*qmth_lvbo_free)(struct lu_device *, struct ldlm_resource *); -}; - -/* actual handlers are defined in lustre/quota/qmt_handler.c */ -extern struct qmt_handlers qmt_hdls; - -/* - * Quota enforcement support on slaves - */ - -struct qsd_instance; - -/* The quota slave feature is implemented under the form of a library. - * The API is the following: - * - * - qsd_init(): the user (mostly the OSD layer) should first allocate a qsd - * instance via qsd_init(). This creates all required structures - * to manage quota enforcement for this target and performs all - * low-level initialization which does not involve any lustre - * object. qsd_init() should typically be called when the OSD - * is being set up. - * - * - qsd_prepare(): This sets up on-disk objects associated with the quota slave - * feature and initiates the quota reintegration procedure if - * needed. qsd_prepare() should typically be called when - * ->ldo_prepare is invoked. - * - * - qsd_start(): a qsd instance should be started once recovery is completed - * (i.e. when ->ldo_recovery_complete is called). This is used - * to notify the qsd layer that quota should now be enforced - * again via the qsd_op_begin/end functions. The last step of the - * reintegration prodecure (namely usage reconciliation) will be - * completed during start. - * - * - qsd_fini(): is used to release a qsd_instance structure allocated with - * qsd_init(). This releases all quota slave objects and frees the - * structures associated with the qsd_instance. - * - * - qsd_op_begin(): is used to enforce quota, it must be called in the - * declaration of each operation. qsd_op_end() should then be - * invoked later once all operations have been completed in - * order to release/adjust the quota space. - * Running qsd_op_begin() before qsd_start() isn't fatal and - * will return success. - * Once qsd_start() has been run, qsd_op_begin() will block - * until the reintegration procedure is completed. - * - * - qsd_op_end(): performs the post operation quota processing. This must be - * called after the operation transaction stopped. - * While qsd_op_begin() must be invoked each time a new - * operation is declared, qsd_op_end() should be called only - * once for the whole transaction. - * - * - qsd_adjust_quota(): triggers pre-acquire/release if necessary. - * - * Below are the function prototypes to be used by OSD layer to manage quota - * enforcement. Arguments are documented where each function is defined. */ - -struct qsd_instance *qsd_init(const struct lu_env *, char *, struct dt_device *, - cfs_proc_dir_entry_t *); -int qsd_prepare(const struct lu_env *, struct qsd_instance *); -int qsd_start(const struct lu_env *, struct qsd_instance *); -void qsd_fini(const struct lu_env *, struct qsd_instance *); -int qsd_op_begin(const struct lu_env *, struct qsd_instance *, - struct lquota_trans *, struct lquota_id_info *, int *); -void qsd_op_end(const struct lu_env *, struct qsd_instance *, - struct lquota_trans *); -void qsd_adjust_quota(const struct lu_env *, struct qsd_instance *, - union lquota_id *, int); - -/* - * Quota information attached to a transaction - */ - -struct lquota_entry; - -struct lquota_id_info { - /* quota identifier */ - union lquota_id lqi_id; - - /* USRQUOTA or GRPQUOTA for now, could be expanded for - * directory quota or other types later. */ - int lqi_type; - - /* inodes or kbytes to be consumed or released, it could - * be negative when releasing space. */ - long long lqi_space; - - /* quota slave entry structure associated with this ID */ - struct lquota_entry *lqi_qentry; - - /* whether we are reporting blocks or inodes */ - bool lqi_is_blk; -}; - -/* Since we enforce only inode quota in meta pool (MDTs), and block quota in - * data pool (OSTs), there are at most 4 quota ids being enforced in a single - * transaction, which is chown transaction: - * original uid and gid, new uid and gid. - * - * This value might need to be revised when directory quota is added. */ -#define QUOTA_MAX_TRANSIDS 4 - -/* all qids involved in a single transaction */ -struct lquota_trans { - unsigned short lqt_id_cnt; - struct lquota_id_info lqt_ids[QUOTA_MAX_TRANSIDS]; -}; - -/* flags for quota local enforcement */ -#define QUOTA_FL_OVER_USRQUOTA 0x01 -#define QUOTA_FL_OVER_GRPQUOTA 0x02 -#define QUOTA_FL_SYNC 0x04 - -#define IS_LQUOTA_RES(res) \ - (res->lr_name.name[LUSTRE_RES_ID_SEQ_OFF] == FID_SEQ_QUOTA || \ - res->lr_name.name[LUSTRE_RES_ID_SEQ_OFF] == FID_SEQ_QUOTA_GLB) - -/* helper function used by MDT & OFD to retrieve quota accounting information - * on slave */ -int lquotactl_slv(const struct lu_env *, struct dt_device *, - struct obd_quotactl *); -#endif /* _LUSTRE_LQUOTA_H */ diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index bae42d0..4979b69 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1136,7 +1136,7 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); #define OBD_CONNECT_RMT_CLIENT 0x10000ULL /*Remote client */ #define OBD_CONNECT_RMT_CLIENT_FORCE 0x20000ULL /*Remote client by force */ #define OBD_CONNECT_BRW_SIZE 0x40000ULL /*Max bytes per rpc */ -#define OBD_CONNECT_QUOTA64 0x80000ULL /*64bit qunit_data.qd_count */ +#define OBD_CONNECT_QUOTA64 0x80000ULL /*Not used since 2.4 */ #define OBD_CONNECT_MDS_CAPA 0x100000ULL /*MDS capability */ #define OBD_CONNECT_OSS_CAPA 0x200000ULL /*OSS capability */ #define OBD_CONNECT_CANCELSET 0x400000ULL /*Early batched cancels. */ @@ -1145,7 +1145,7 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); #define OBD_CONNECT_LRU_RESIZE 0x2000000ULL /*LRU resize feature. */ #define OBD_CONNECT_MDS_MDS 0x4000000ULL /*MDS-MDS connection */ #define OBD_CONNECT_REAL 0x8000000ULL /*real connection */ -#define OBD_CONNECT_CHANGE_QS 0x10000000ULL /*shrink/enlarge qunit */ +#define OBD_CONNECT_CHANGE_QS 0x10000000ULL /*Not used since 2.4 */ #define OBD_CONNECT_CKSUM 0x20000000ULL /*support several cksum algos*/ #define OBD_CONNECT_FID 0x40000000ULL /*FID is supported by server */ #define OBD_CONNECT_VBR 0x80000000ULL /*version based recovery */ @@ -1210,11 +1210,9 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \ - OBD_CONNECT_BRW_SIZE | OBD_CONNECT_QUOTA64 | \ + OBD_CONNECT_BRW_SIZE | OBD_CONNECT_OSS_CAPA | \ OBD_CONNECT_CANCELSET | OBD_CONNECT_AT | \ LRU_RESIZE_CONNECT_FLAG | OBD_CONNECT_CKSUM | \ - OBD_CONNECT_CHANGE_QS | \ - OBD_CONNECT_OSS_CAPA | \ OBD_CONNECT_RMT_CLIENT | \ OBD_CONNECT_RMT_CLIENT_FORCE | OBD_CONNECT_VBR | \ OBD_CONNECT_MDS | OBD_CONNECT_SKIP_ORPHAN | \ @@ -1346,7 +1344,7 @@ typedef enum { OST_SET_INFO = 17, OST_QUOTACHECK = 18, OST_QUOTACTL = 19, - OST_QUOTA_ADJUST_QUNIT = 20, + OST_QUOTA_ADJUST_QUNIT = 20, /* not used since 2.4 */ OST_LAST_OPC } ost_cmd_t; #define OST_FIRST_OPC OST_REPLY @@ -1597,6 +1595,183 @@ struct ost_lvb { }; /* + * lquota data structures + */ + +#ifndef QUOTABLOCK_BITS +#define QUOTABLOCK_BITS 10 +#endif + +#ifndef QUOTABLOCK_SIZE +#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) +#endif + +#ifndef toqb +#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) +#endif + +/* The lquota_id structure is an union of all the possible identifier types that + * can be used with quota, this includes: + * - 64-bit user ID + * - 64-bit group ID + * - a FID which can be used for per-directory quota in the future */ +union lquota_id { + struct lu_fid qid_fid; /* FID for per-directory quota */ + __u64 qid_uid; /* user identifier */ + __u64 qid_gid; /* group identifier */ +}; + +/* quotactl management */ +struct obd_quotactl { + __u32 qc_cmd; + __u32 qc_type; /* see Q_* flag below */ + __u32 qc_id; + __u32 qc_stat; + struct obd_dqinfo qc_dqinfo; + struct obd_dqblk qc_dqblk; +}; + +extern void lustre_swab_obd_quotactl(struct obd_quotactl *q); + +#define Q_QUOTACHECK 0x800100 /* deprecated as of 2.4 */ +#define Q_INITQUOTA 0x800101 /* deprecated as of 2.4 */ +#define Q_GETOINFO 0x800102 /* get obd quota info */ +#define Q_GETOQUOTA 0x800103 /* get obd quotas */ +#define Q_FINVALIDATE 0x800104 /* deprecated as of 2.4 */ + +#define Q_COPY(out, in, member) (out)->member = (in)->member + +#define QCTL_COPY(out, in) \ +do { \ + Q_COPY(out, in, qc_cmd); \ + Q_COPY(out, in, qc_type); \ + Q_COPY(out, in, qc_id); \ + Q_COPY(out, in, qc_stat); \ + Q_COPY(out, in, qc_dqinfo); \ + Q_COPY(out, in, qc_dqblk); \ +} while (0) + +/* Body of quota request used for quota acquire/release RPCs between quota + * master (aka QMT) and slaves (ak QSD). */ +struct quota_body { + struct lu_fid qb_fid; /* FID of global index packing the pool ID + * and type (data or metadata) as well as + * the quota type (user or group). */ + union lquota_id qb_id; /* uid or gid or directory FID */ + __u32 qb_flags; /* see below */ + __u32 qb_padding; + __u64 qb_count; /* acquire/release count (kbytes/inodes) */ + __u64 qb_usage; /* current slave usage (kbytes/inodes) */ + __u64 qb_slv_ver; /* slave index file version */ + struct lustre_handle qb_lockh; /* per-ID lock handle */ + struct lustre_handle qb_glb_lockh; /* global lock handle */ + __u64 qb_padding1[4]; +}; + +/* When the quota_body is used in the reply of quota global intent + * lock (IT_QUOTA_CONN) reply, qb_fid contains slave index file FID. */ +#define qb_slv_fid qb_fid +/* qb_usage is the current qunit (in kbytes/inodes) when quota_body is used in + * quota reply */ +#define qb_qunit qb_usage + +#define QUOTA_DQACQ_FL_ACQ 0x1 /* acquire quota */ +#define QUOTA_DQACQ_FL_PREACQ 0x2 /* pre-acquire */ +#define QUOTA_DQACQ_FL_REL 0x4 /* release quota */ +#define QUOTA_DQACQ_FL_REPORT 0x8 /* report usage */ + +extern void lustre_swab_quota_body(struct quota_body *b); + +/* Quota types currently supported */ +enum { + LQUOTA_TYPE_USR = 0x00, /* maps to USRQUOTA */ + LQUOTA_TYPE_GRP = 0x01, /* maps to GRPQUOTA */ + LQUOTA_TYPE_MAX +}; + +/* There are 2 different resource types on which a quota limit can be enforced: + * - inodes on the MDTs + * - blocks on the OSTs */ +enum { + LQUOTA_RES_MD = 0x01, /* skip 0 to avoid null oid in FID */ + LQUOTA_RES_DT = 0x02, + LQUOTA_LAST_RES, + LQUOTA_FIRST_RES = LQUOTA_RES_MD +}; +#define LQUOTA_NR_RES (LQUOTA_LAST_RES - LQUOTA_FIRST_RES + 1) + +/* + * Space accounting support + * Format of an accounting record, providing disk usage information for a given + * user or group + */ +struct lquota_acct_rec { /* 16 bytes */ + __u64 bspace; /* current space in use */ + __u64 ispace; /* current # inodes in use */ +}; + +/* + * Global quota index support + * Format of a global record, providing global quota settings for a given quota + * identifier + */ +struct lquota_glb_rec { /* 32 bytes */ + __u64 qbr_hardlimit; /* quota hard limit, in #inodes or kbytes */ + __u64 qbr_softlimit; /* quota soft limit, in #inodes or kbytes */ + __u64 qbr_time; /* grace time, in seconds */ + __u64 qbr_granted; /* how much is granted to slaves, in #inodes or + * kbytes */ +}; + +/* + * Slave index support + * Format of a slave record, recording how much space is granted to a given + * slave + */ +struct lquota_slv_rec { /* 8 bytes */ + __u64 qsr_granted; /* space granted to the slave for the key=ID, + * in #inodes or kbytes */ +}; + +/* Data structures associated with the quota locks */ + +/* Glimpse descriptor used for the index & per-ID quota locks */ +struct ldlm_gl_lquota_desc { + union lquota_id gl_id; /* quota ID subject to the glimpse */ + __u64 gl_flags; /* see LQUOTA_FL* below */ + __u64 gl_ver; /* new index version */ + __u64 gl_hardlimit; /* new hardlimit or qunit value */ + __u64 gl_softlimit; /* new softlimit */ + __u64 gl_pad1; + __u64 gl_pad2; +}; +#define gl_qunit gl_hardlimit /* current qunit value used when + * glimpsing per-ID quota locks */ + +/* quota glimpse flags */ +#define LQUOTA_FL_EDQUOT 0x1 /* user/group out of quota space on QMT */ + +/* LVB used with quota (global and per-ID) locks */ +struct lquota_lvb { + __u64 lvb_flags; /* see LQUOTA_FL* above */ + __u64 lvb_id_may_rel; /* space that might be released later */ + __u64 lvb_id_rel; /* space released by the slave for this ID */ + __u64 lvb_id_qunit; /* current qunit value */ + __u64 lvb_pad1; +}; + +/* LVB used with global quota lock */ +#define lvb_glb_ver lvb_id_may_rel /* current version of the global index */ + +/* op codes */ +typedef enum { + QUOTA_DQACQ = 601, + QUOTA_DQREL = 602, + QUOTA_LAST_OPC +} quota_cmd_t; +#define QUOTA_FIRST_OPC QUOTA_DQACQ + +/* * MDS REQ RECORDS */ @@ -1796,167 +1971,6 @@ struct mdt_ioepoch { extern void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b); -/* The lquota_id structure is an union of all the possible identifier types that - * can be used with quota, this includes: - * - 64-bit user ID - * - 64-bit group ID - * - a FID which can be used for per-directory quota in the future */ -union lquota_id { - struct lu_fid qid_fid; /* FID for per-directory quota */ - __u64 qid_uid; /* user identifier */ - __u64 qid_gid; /* group identifier */ -}; - -#define Q_QUOTACHECK 0x800100 -#define Q_INITQUOTA 0x800101 /* init slave limits */ -#define Q_GETOINFO 0x800102 /* get obd quota info */ -#define Q_GETOQUOTA 0x800103 /* get obd quotas */ -#define Q_FINVALIDATE 0x800104 /* invalidate operational quotas */ - -#define Q_TYPEMATCH(id, type) \ - ((id) == (type) || (id) == UGQUOTA) - -#define Q_TYPESET(oqc, type) Q_TYPEMATCH((oqc)->qc_type, type) - -#define Q_GETOCMD(oqc) \ - ((oqc)->qc_cmd == Q_GETOINFO || (oqc)->qc_cmd == Q_GETOQUOTA) - -#define QCTL_COPY(out, in) \ -do { \ - Q_COPY(out, in, qc_cmd); \ - Q_COPY(out, in, qc_type); \ - Q_COPY(out, in, qc_id); \ - Q_COPY(out, in, qc_stat); \ - Q_COPY(out, in, qc_dqinfo); \ - Q_COPY(out, in, qc_dqblk); \ -} while (0) - -struct obd_quotactl { - __u32 qc_cmd; - __u32 qc_type; - __u32 qc_id; - __u32 qc_stat; - struct obd_dqinfo qc_dqinfo; - struct obd_dqblk qc_dqblk; -}; - -extern void lustre_swab_obd_quotactl(struct obd_quotactl *q); - -#define QUOTA_DQACQ_FL_ACQ 0x1 /* acquire quota */ -#define QUOTA_DQACQ_FL_PREACQ 0x2 /* pre-acquire */ -#define QUOTA_DQACQ_FL_REL 0x4 /* release quota */ -#define QUOTA_DQACQ_FL_REPORT 0x8 /* report usage */ - -struct quota_body { - struct lu_fid qb_fid; /* FID of global index packing the pool ID - * and type (data or metadata) as well as - * the quota type (user or group). */ - union lquota_id qb_id; /* uid or gid or directory FID */ - __u32 qb_flags; /* see above */ - __u32 qb_padding; - __u64 qb_count; /* acquire/release count (kbytes/inodes) */ - __u64 qb_usage; /* current slave usage (kbytes/inodes) */ - __u64 qb_slv_ver; /* slave index file version */ - struct lustre_handle qb_lockh; /* per-ID lock handle */ - struct lustre_handle qb_glb_lockh; /* global lock handle */ - __u64 qb_padding1[4]; -}; - -/* When the quota_body is used in the reply of quota global intent - * lock (IT_QUOTA_CONN) reply, qb_fid contains slave index file FID. */ -#define qb_slv_fid qb_fid -/* qb_usage is the current qunit (in kbytes/inodes) when quota_body is used in - * quota reply */ -#define qb_qunit qb_usage - -extern void lustre_swab_quota_body(struct quota_body *b); - -struct quota_adjust_qunit { - __u32 qaq_flags; - __u32 qaq_id; - __u64 qaq_bunit_sz; - __u64 qaq_iunit_sz; - __u64 padding1; -}; -extern void lustre_swab_quota_adjust_qunit(struct quota_adjust_qunit *q); - -/* Quota types currently supported */ -enum { - LQUOTA_TYPE_USR = 0x00, /* maps to USRQUOTA */ - LQUOTA_TYPE_GRP = 0x01, /* maps to GRPQUOTA */ - LQUOTA_TYPE_MAX -}; - -/* There are 2 different resource types on which a quota limit can be enforced: - * - inodes on the MDTs - * - blocks on the OSTs */ -enum { - LQUOTA_RES_MD = 0x01, /* skip 0 to avoid null oid in FID */ - LQUOTA_RES_DT = 0x02, - LQUOTA_LAST_RES, - LQUOTA_FIRST_RES = LQUOTA_RES_MD -}; -#define LQUOTA_NR_RES (LQUOTA_LAST_RES - LQUOTA_FIRST_RES + 1) - -/* - * Space accounting support - * Format of an accounting record, providing disk usage information for a given - * user or group - */ -struct lquota_acct_rec { /* 16 bytes */ - __u64 bspace; /* current space in use */ - __u64 ispace; /* current # inodes in use */ -}; - -/* - * Global quota index support - * Format of a global record, providing global quota settings for a given quota - * identifier - */ -struct lquota_glb_rec { /* 32 bytes */ - __u64 qbr_hardlimit; /* quota hard limit, in #inodes or kbytes */ - __u64 qbr_softlimit; /* quota soft limit, in #inodes or kbytes */ - __u64 qbr_time; /* grace time, in seconds */ - __u64 qbr_granted; /* how much is granted to slaves, in #inodes or - * kbytes */ -}; - -/* - * Slave index support - * Format of a slave record, recording how much space is granted to a given - * slave - */ -struct lquota_slv_rec { /* 8 bytes */ - __u64 qsr_granted; /* space granted to the slave for the key=ID, - * in #inodes or kbytes */ -}; - -/* flags is shared among quota structures */ -#define LQUOTA_FLAGS_GRP 1UL /* 0 is user, 1 is group */ -#define LQUOTA_FLAGS_BLK 2UL /* 0 is inode, 1 is block */ -#define LQUOTA_FLAGS_ADJBLK 4UL /* adjust the block qunit size */ -#define LQUOTA_FLAGS_ADJINO 8UL /* adjust the inode qunit size */ -#define LQUOTA_FLAGS_CHG_QS 16UL /* indicate whether it has capability of - * OBD_CONNECT_CHANGE_QS */ -#define LQUOTA_FLAGS_RECOVERY 32UL /* recovery is going on a uid/gid */ -#define LQUOTA_FLAGS_SETQUOTA 64UL /* being setquota on a uid/gid */ - -/* flags is specific for quota_adjust_qunit */ -#define LQUOTA_QAQ_CREATE_LQS (1UL << 31) /* when it is set, need create lqs */ - -/* the status of lqs_flags in struct lustre_qunit_size */ -#define LQUOTA_QUNIT_FLAGS (LQUOTA_FLAGS_GRP | LQUOTA_FLAGS_BLK) - -#define QAQ_IS_GRP(qaq) ((qaq)->qaq_flags & LQUOTA_FLAGS_GRP) -#define QAQ_IS_ADJBLK(qaq) ((qaq)->qaq_flags & LQUOTA_FLAGS_ADJBLK) -#define QAQ_IS_ADJINO(qaq) ((qaq)->qaq_flags & LQUOTA_FLAGS_ADJINO) -#define QAQ_IS_CREATE_LQS(qaq) ((qaq)->qaq_flags & LQUOTA_QAQ_CREATE_LQS) - -#define QAQ_SET_GRP(qaq) ((qaq)->qaq_flags |= LQUOTA_FLAGS_GRP) -#define QAQ_SET_ADJBLK(qaq) ((qaq)->qaq_flags |= LQUOTA_FLAGS_ADJBLK) -#define QAQ_SET_ADJINO(qaq) ((qaq)->qaq_flags |= LQUOTA_FLAGS_ADJINO) -#define QAQ_SET_CREATE_LQS(qaq) ((qaq)->qaq_flags |= LQUOTA_QAQ_CREATE_LQS) - /* permissions for md_perm.mp_perm */ enum { CFS_SETUID_PERM = 0x01, @@ -2478,36 +2492,6 @@ typedef union { extern void lustre_swab_ldlm_policy_data (ldlm_wire_policy_data_t *d); -/* Data structures associated with the quota locks */ - -/* Glimpse descriptor used for the index & per-ID quota locks */ -struct ldlm_gl_lquota_desc { - union lquota_id gl_id; /* quota ID subject to the glimpse */ - __u64 gl_flags; /* see LQUOTA_FL* below */ - __u64 gl_ver; /* new index version */ - __u64 gl_hardlimit; /* new hardlimit or qunit value */ - __u64 gl_softlimit; /* new softlimit */ - __u64 gl_pad1; - __u64 gl_pad2; -}; -#define gl_qunit gl_hardlimit /* current qunit value used when - * glimpsing per-ID quota locks */ - -/* quota glimpse flags */ -#define LQUOTA_FL_EDQUOT 0x1 /* user/group out of quota space on QMT */ - -/* LVB used with quota (global and per-ID) locks */ -struct lquota_lvb { - __u64 lvb_flags; /* see LQUOTA_FL* above */ - __u64 lvb_id_may_rel; /* space that might be released later */ - __u64 lvb_id_rel; /* space released by the slave for this ID */ - __u64 lvb_id_qunit; /* current qunit value */ - __u64 lvb_pad1; -}; - -/* LVB used with global quota lock */ -#define lvb_glb_ver lvb_id_may_rel /* current version of the global index */ - /* Similarly to ldlm_wire_policy_data_t, there is one common swabber for all * LVB types. As a result, any new LVB structure must match the fields of the * ost_lvb structure. */ @@ -3124,67 +3108,6 @@ union lu_page { char lp_array[LU_PAGE_SIZE]; }; -/* this will be used when OBD_CONNECT_CHANGE_QS is set */ -struct qunit_data { - /** - * ID appiles to (uid, gid) - */ - __u32 qd_id; - /** - * LQUOTA_FLAGS_* affect the responding bits - */ - __u32 qd_flags; - /** - * acquire/release count (bytes for block quota) - */ - __u64 qd_count; - /** - * when a master returns the reply to a slave, it will - * contain the current corresponding qunit size - */ - __u64 qd_qunit; - __u64 padding; -}; - -#define QDATA_IS_GRP(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_GRP) -#define QDATA_IS_BLK(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_BLK) -#define QDATA_IS_ADJBLK(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_ADJBLK) -#define QDATA_IS_ADJINO(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_ADJINO) -#define QDATA_IS_CHANGE_QS(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_CHG_QS) - -#define QDATA_SET_GRP(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_GRP) -#define QDATA_SET_BLK(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_BLK) -#define QDATA_SET_ADJBLK(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_ADJBLK) -#define QDATA_SET_ADJINO(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_ADJINO) -#define QDATA_SET_CHANGE_QS(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_CHG_QS) - -#define QDATA_CLR_GRP(qdata) ((qdata)->qd_flags &= ~LQUOTA_FLAGS_GRP) -#define QDATA_CLR_CHANGE_QS(qdata) ((qdata)->qd_flags &= ~LQUOTA_FLAGS_CHG_QS) - -extern void lustre_swab_qdata(struct qunit_data *d); -extern struct qunit_data *quota_get_qdata(void *req, int is_req, int is_exp); -extern int quota_copy_qdata(void *request, struct qunit_data *qdata, - int is_req, int is_exp); - -typedef enum { - QUOTA_DQACQ = 601, - QUOTA_DQREL = 602, - QUOTA_LAST_OPC -} quota_cmd_t; -#define QUOTA_FIRST_OPC QUOTA_DQACQ - -#define QUOTA_REQUEST 1 -#define QUOTA_REPLY 0 -#define QUOTA_EXPORT 1 -#define QUOTA_IMPORT 0 - -/* quota check function */ -#define QUOTA_RET_OK 0 /**< return successfully */ -#define QUOTA_RET_NOQUOTA 1 /**< not support quota */ -#define QUOTA_RET_NOLIMIT 2 /**< quota limit isn't set */ -#define QUOTA_RET_ACQUOTA 4 /**< need to acquire extra quota */ - - /* security opcodes */ typedef enum { SEC_CTX_INIT = 801, diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index 545a336..131b7d9 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -14,24 +14,15 @@ * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * version 2 along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA * * GPL HEADER END */ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, Intel, Inc. * Use is subject to license terms. - * - * Copyright (c) 2012, Whamcloud, Inc. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef _LUSTRE_QUOTA_H @@ -39,7 +30,6 @@ /** \defgroup quota quota * - * @{ */ #if defined(__linux__) @@ -48,743 +38,197 @@ #include #elif defined(__WINNT__) #include -#else #error Unsupported operating system. #endif -#include -#include -#include -#include +#include +#include +#include -struct obd_device; -struct client_obd; - -#ifndef NR_DQHASH -#define NR_DQHASH 45 -#endif - -#ifndef QUOTABLOCK_BITS -#define QUOTABLOCK_BITS 10 -#endif +struct lquota_id_info; +struct lquota_trans; -#ifndef QUOTABLOCK_SIZE -#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) -#endif - -#ifndef toqb -#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) -#endif - -#ifndef MAX_IQ_TIME -#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */ -#endif - -#ifndef MAX_DQ_TIME -#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */ -#endif - -#ifdef __KERNEL__ - -#ifdef LPROCFS -enum { - LQUOTA_FIRST_STAT = 0, - /** @{ */ - /** - * these four are for measuring quota requests, for both of - * quota master and quota slaves - */ - LQUOTA_SYNC_ACQ = LQUOTA_FIRST_STAT, - LQUOTA_SYNC_REL, - LQUOTA_ASYNC_ACQ, - LQUOTA_ASYNC_REL, - /** }@ */ - /** @{ */ - /** - * these four measure how much time I/O threads spend on dealing - * with quota before and after writing data or creating files, - * only for quota slaves(lquota_chkquota and lquota_pending_commit) - */ - LQUOTA_WAIT_FOR_CHK_BLK, - LQUOTA_WAIT_FOR_CHK_INO, - LQUOTA_WAIT_FOR_COMMIT_BLK, - LQUOTA_WAIT_FOR_COMMIT_INO, - /** }@ */ - /** @{ */ - /** - * these two are for measuring time waiting return of quota reqs - * (qctxt_wait_pending_dqacq), only for quota salves - */ - LQUOTA_WAIT_PENDING_BLK_QUOTA, - LQUOTA_WAIT_PENDING_INO_QUOTA, - /** }@ */ - /** @{ */ - /** - * these two are for those when they are calling - * qctxt_wait_pending_dqacq, the quota req has returned already, - * only for quota salves - */ - LQUOTA_NOWAIT_PENDING_BLK_QUOTA, - LQUOTA_NOWAIT_PENDING_INO_QUOTA, - /** }@ */ - /** @{ */ - /** - * these are for quota ctl - */ - LQUOTA_QUOTA_CTL, - /** }@ */ - /** @{ */ - /** - * these are for adjust quota qunit, for both of - * quota master and quota slaves - */ - LQUOTA_ADJUST_QUNIT, - LQUOTA_LAST_STAT - /** }@ */ -}; -#endif /* LPROCFS */ - -/* structures to access admin quotafile */ -struct lustre_mem_dqinfo { - unsigned int dqi_bgrace; - unsigned int dqi_igrace; - unsigned long dqi_flags; - unsigned int dqi_blocks; - unsigned int dqi_free_blk; - unsigned int dqi_free_entry; -}; - -struct lustre_quota_info { - struct file *qi_files[MAXQUOTAS]; - struct lustre_mem_dqinfo qi_info[MAXQUOTAS]; - lustre_quota_version_t qi_version; -}; - -struct lustre_mem_dqblk { - __u64 dqb_bhardlimit; /**< absolute limit on disk blks alloc */ - __u64 dqb_bsoftlimit; /**< preferred limit on disk blks */ - __u64 dqb_curspace; /**< current used space */ - __u64 dqb_ihardlimit; /**< absolute limit on allocated inodes */ - __u64 dqb_isoftlimit; /**< preferred inode limit */ - __u64 dqb_curinodes; /**< current # allocated inodes */ - time_t dqb_btime; /**< time limit for excessive disk use */ - time_t dqb_itime; /**< time limit for excessive inode use */ -}; - -struct lustre_dquot { - /** Hash list in memory, protect by dquot_hash_lock */ - cfs_list_t dq_hash; - /** Protect the data in lustre_dquot */ - cfs_mutex_t dq_mutex; - /** Use count */ - cfs_atomic_t dq_refcnt; - /** Pointer of quota info it belongs to */ - struct lustre_quota_info *dq_info; - /** Offset of dquot on disk */ - loff_t dq_off; - /** ID this applies to (uid, gid) */ - unsigned int dq_id; - /** Type fo quota (USRQUOTA, GRPQUOUTA) */ - int dq_type; - /** See DQ_ in quota.h */ - unsigned long dq_flags; - /** Diskquota usage */ - struct lustre_mem_dqblk dq_dqb; -}; - -struct dquot_id { - cfs_list_t di_link; - __u32 di_id; - __u32 di_flag; -}; -/* set inode quota limitation on a quota uid/gid */ -#define QI_SET (1 << 30) -/* set block quota limitation on a quota uid/gid */ -#define QB_SET (1 << 31) - -#define QFILE_CHK 1 -#define QFILE_RD_INFO 2 -#define QFILE_WR_INFO 3 -#define QFILE_INIT_INFO 4 -#define QFILE_RD_DQUOT 5 -#define QFILE_WR_DQUOT 6 -#define QFILE_CONVERT 7 - -/* admin quotafile operations */ -int lustre_check_quota_file(struct lustre_quota_info *lqi, int type); -int lustre_read_quota_info(struct lustre_quota_info *lqi, int type); -int lustre_write_quota_info(struct lustre_quota_info *lqi, int type); -int lustre_read_dquot(struct lustre_dquot *dquot); -int lustre_commit_dquot(struct lustre_dquot *dquot); -int lustre_init_quota_info(struct lustre_quota_info *lqi, int type); -int lustre_get_qids(struct file *file, struct inode *inode, int type, - cfs_list_t *list); -int lustre_quota_convert(struct lustre_quota_info *lqi, int type); - -typedef int (*dqacq_handler_t) (struct obd_device * obd, struct qunit_data * qd, - int opc); - -/* user quota is turned on on filter */ -#define LQC_USRQUOTA_FLAG (1 << 0) -/* group quota is turned on on filter */ -#define LQC_GRPQUOTA_FLAG (1 << 1) - -#define UGQUOTA2LQC(id) ((Q_TYPEMATCH(id, USRQUOTA) ? LQC_USRQUOTA_FLAG : 0) | \ - (Q_TYPEMATCH(id, GRPQUOTA) ? LQC_GRPQUOTA_FLAG : 0)) - -struct lustre_quota_ctxt { - /** superblock this applies to */ - struct super_block *lqc_sb; - /** obd_device_target for obt_rwsem */ - struct obd_device_target *lqc_obt; - /** import used to send dqacq/dqrel RPC */ - struct obd_import *lqc_import; - /** dqacq/dqrel RPC handler, only for quota master */ - dqacq_handler_t lqc_handler; - /** quota flags */ - unsigned long lqc_flags; - /** @{ */ - unsigned long lqc_recovery:1, /** Doing recovery */ - lqc_switch_qs:1, /** - * the function of change qunit size - * 0:Off, 1:On - */ - lqc_valid:1, /** this qctxt is valid or not */ - lqc_setup:1; /** - * tell whether of not quota_type has - * been processed, so that the master - * knows when it can start processing - * incoming acq/rel quota requests - */ - /** }@ */ - /** - * original unit size of file quota and - * upper limitation for adjust file qunit - */ - unsigned long lqc_iunit_sz; - /** - * Trigger dqacq when available file - * quota less than this value, trigger - * dqrel when available file quota - * more than this value + 1 iunit - */ - unsigned long lqc_itune_sz; - /** - * original unit size of block quota and - * upper limitation for adjust block qunit - */ - unsigned long lqc_bunit_sz; - /** See comment of lqc_itune_sz */ - unsigned long lqc_btune_sz; - /** all lustre_qunit_size structures */ - cfs_hash_t *lqc_lqs_hash; - - /** @{ */ - /** - * the values below are relative to how master change its qunit sizes - */ - /** - * this affects the boundary of - * shrinking and enlarging qunit size. default=4 - */ - unsigned long lqc_cqs_boundary_factor; - /** the least value of block qunit */ - unsigned long lqc_cqs_least_bunit; - /** the least value of inode qunit */ - unsigned long lqc_cqs_least_iunit; - /** - * when enlarging, qunit size will - * mutilple it; when shrinking, - * qunit size will divide it - */ - unsigned long lqc_cqs_qs_factor; - /** - * avoid ping-pong effect of - * adjusting qunit size. How many - * seconds must be waited between - * enlarging and shinking qunit - */ - /** }@ */ - int lqc_switch_seconds; - /** - * when blk qunit reaches this value, - * later write reqs from client should be sync b=16642 - */ - int lqc_sync_blk; - /** guard lqc_imp_valid now */ - cfs_spinlock_t lqc_lock; - /** - * when mds isn't connected, threads - * on osts who send the quota reqs - * with wait==1 will be put here b=14840 - */ - cfs_waitq_t lqc_wait_for_qmaster; - struct proc_dir_entry *lqc_proc_dir; - /** lquota statistics */ - struct lprocfs_stats *lqc_stats; - /** the number of used hashed lqs */ - cfs_atomic_t lqc_lqs; - /** no lqs are in use */ - cfs_waitq_t lqc_lqs_waitq; +/* Gather all quota record type in an union that can be used to read any records + * from disk. All fields of these records must be 64-bit aligned, otherwise the + * OSD layer may swab them incorrectly. */ +union lquota_rec { + struct lquota_glb_rec lqr_glb_rec; + struct lquota_slv_rec lqr_slv_rec; + struct lquota_acct_rec lqr_acct_rec; }; -#define QUOTA_MASTER_READY(qctxt) (qctxt)->lqc_setup = 1 -#define QUOTA_MASTER_UNREADY(qctxt) (qctxt)->lqc_setup = 0 - -struct lustre_qunit_size { - cfs_hlist_node_t lqs_hash; /** the hash entry */ - unsigned int lqs_id; /** id of user/group */ - unsigned long lqs_flags; /** 31st bit is QB_SET, 30th bit is QI_SET - * other bits are same as LQUOTA_FLAGS_* - */ - unsigned long lqs_iunit_sz; /** Unit size of file quota currently */ - /** - * Trigger dqacq when available file quota - * less than this value, trigger dqrel - * when more than this value + 1 iunit - */ - unsigned long lqs_itune_sz; - unsigned long lqs_bunit_sz; /** Unit size of block quota currently */ - unsigned long lqs_btune_sz; /** See comment of lqs itune sz */ - /** the blocks reached ost and don't finish */ - unsigned long lqs_bwrite_pending; - /** the inodes reached mds and don't finish */ - unsigned long lqs_iwrite_pending; - /** when inodes are allocated/released, this value will record it */ - long long lqs_ino_rec; - /** when blocks are allocated/released, this value will record it */ - long long lqs_blk_rec; - cfs_atomic_t lqs_refcount; - cfs_time_t lqs_last_bshrink; /** time of last block shrink */ - cfs_time_t lqs_last_ishrink; /** time of last inode shrink */ - cfs_spinlock_t lqs_lock; - unsigned long long lqs_key; /** hash key */ - struct lustre_quota_ctxt *lqs_ctxt; /** quota ctxt */ -}; - -#define LQS_IS_GRP(lqs) ((lqs)->lqs_flags & LQUOTA_FLAGS_GRP) -#define LQS_IS_ADJBLK(lqs) ((lqs)->lqs_flags & LQUOTA_FLAGS_ADJBLK) -#define LQS_IS_ADJINO(lqs) ((lqs)->lqs_flags & LQUOTA_FLAGS_ADJINO) -#define LQS_IS_RECOVERY(lqs) ((lqs)->lqs_flags & LQUOTA_FLAGS_RECOVERY) -#define LQS_IS_SETQUOTA(lqs) ((lqs)->lqs_flags & LQUOTA_FLAGS_SETQUOTA) - -#define LQS_SET_GRP(lqs) ((lqs)->lqs_flags |= LQUOTA_FLAGS_GRP) -#define LQS_SET_ADJBLK(lqs) ((lqs)->lqs_flags |= LQUOTA_FLAGS_ADJBLK) -#define LQS_SET_ADJINO(lqs) ((lqs)->lqs_flags |= LQUOTA_FLAGS_ADJINO) -#define LQS_SET_RECOVERY(lqs) ((lqs)->lqs_flags |= LQUOTA_FLAGS_RECOVERY) -#define LQS_SET_SETQUOTA(lqs) ((lqs)->lqs_flags |= LQUOTA_FLAGS_SETQUOTA) +/* Index features supported by the global index objects + * Only used for migration purpose and should be removed once on-disk migration + * is no longer needed */ +extern struct dt_index_features dt_quota_iusr_features; +extern struct dt_index_features dt_quota_busr_features; +extern struct dt_index_features dt_quota_igrp_features; +extern struct dt_index_features dt_quota_bgrp_features; -#define LQS_CLEAR_RECOVERY(lqs) ((lqs)->lqs_flags &= ~LQUOTA_FLAGS_RECOVERY) -#define LQS_CLEAR_SETQUOTA(lqs) ((lqs)->lqs_flags &= ~LQUOTA_FLAGS_SETQUOTA) +/* Name used in the configuration logs to identify the default metadata pool + * (composed of all the MDTs, with pool ID 0) and the default data pool (all + * the OSTs, with pool ID 0 too). */ +#define QUOTA_METAPOOL_NAME "mdt=" +#define QUOTA_DATAPOOL_NAME "ost=" -/* In the hash for lustre_qunit_size, the key is decided by - * grp_or_usr and uid/gid, in here, I combine these two values, - * which will make comparing easier and more efficient */ -#define LQS_KEY(is_grp, id) ((is_grp ? 1ULL << 32: 0) + id) -#define LQS_KEY_ID(key) (key & 0xffffffff) -#define LQS_KEY_GRP(key) (key >> 32) +/* + * Quota Master Target support + */ -static inline void lqs_getref(struct lustre_qunit_size *lqs) -{ - int count = cfs_atomic_inc_return(&lqs->lqs_refcount); +/* Request handlers for quota master operations. + * This is used by the MDT to pass quota/lock requests to the quota master + * target. This won't be needed any more once the QMT is a real target and + * does not rely any more on the MDT service threads and namespace. */ +struct qmt_handlers { + /* Handle quotactl request from client. */ + int (*qmth_quotactl)(const struct lu_env *, struct lu_device *, + struct obd_quotactl *); - CDEBUG(D_INFO, "lqs=%p refcount %d\n", lqs, count); -} + /* Handle dqacq/dqrel request from slave. */ + int (*qmth_dqacq)(const struct lu_env *, struct lu_device *, + struct ptlrpc_request *); -static inline void lqs_putref(struct lustre_qunit_size *lqs) -{ - int count = cfs_atomic_read(&lqs->lqs_refcount); + /* LDLM intent policy associated with quota locks */ + int (*qmth_intent_policy)(const struct lu_env *, struct lu_device *, + struct ptlrpc_request *, struct ldlm_lock **, + int); - LASSERT(count > 0); - CDEBUG(D_INFO, "lqs=%p refcount %d\n", lqs, count - 1); + /* Initialize LVB of ldlm resource associated with quota objects */ + int (*qmth_lvbo_init)(struct lu_device *, struct ldlm_resource *); - if (cfs_atomic_dec_and_test(&lqs->lqs_refcount)) { - if (cfs_atomic_dec_and_test(&lqs->lqs_ctxt->lqc_lqs)) - cfs_waitq_signal(&lqs->lqs_ctxt->lqc_lqs_waitq); - OBD_FREE_PTR(lqs); - } -} + /* Update LVB of ldlm resource associated with quota objects */ + int (*qmth_lvbo_update)(struct lu_device *, struct ldlm_resource *, + struct ptlrpc_request *, int); -#else + /* Return size of LVB to be packed in ldlm message */ + int (*qmth_lvbo_size)(struct lu_device *, struct ldlm_lock *); -struct lustre_quota_info { -}; + /* Fill request buffer with lvb */ + int (*qmth_lvbo_fill)(struct lu_device *, struct ldlm_lock *, void *, + int); -struct lustre_quota_ctxt { + /* Free lvb associated with ldlm resource */ + int (*qmth_lvbo_free)(struct lu_device *, struct ldlm_resource *); }; -#define QUOTA_MASTER_READY(qctxt) -#define QUOTA_MASTER_UNREADY(qctxt) +/* actual handlers are defined in lustre/quota/qmt_handler.c */ +extern struct qmt_handlers qmt_hdls; -#endif /* !__KERNEL__ */ +/* + * Quota enforcement support on slaves + */ -/* If the (quota limit < qunit * slave count), the slave which can't - * acquire qunit should set it's local limit as MIN_QLIMIT */ -#define MIN_QLIMIT 1 +struct qsd_instance; -struct quotacheck_thread_args { - struct obd_export *qta_exp; /** obd export */ - struct obd_device *qta_obd; /** obd device */ - struct obd_quotactl qta_oqctl; /** obd_quotactl args */ - struct super_block *qta_sb; /** obd super block */ - cfs_semaphore_t *qta_sem; /** obt_quotachecking */ -}; +/* The quota slave feature is implemented under the form of a library. + * The API is the following: + * + * - qsd_init(): the user (mostly the OSD layer) should first allocate a qsd + * instance via qsd_init(). This creates all required structures + * to manage quota enforcement for this target and performs all + * low-level initialization which does not involve any lustre + * object. qsd_init() should typically be called when the OSD + * is being set up. + * + * - qsd_prepare(): This sets up on-disk objects associated with the quota slave + * feature and initiates the quota reintegration procedure if + * needed. qsd_prepare() should typically be called when + * ->ldo_prepare is invoked. + * + * - qsd_start(): a qsd instance should be started once recovery is completed + * (i.e. when ->ldo_recovery_complete is called). This is used + * to notify the qsd layer that quota should now be enforced + * again via the qsd_op_begin/end functions. The last step of the + * reintegration prodecure (namely usage reconciliation) will be + * completed during start. + * + * - qsd_fini(): is used to release a qsd_instance structure allocated with + * qsd_init(). This releases all quota slave objects and frees the + * structures associated with the qsd_instance. + * + * - qsd_op_begin(): is used to enforce quota, it must be called in the + * declaration of each operation. qsd_op_end() should then be + * invoked later once all operations have been completed in + * order to release/adjust the quota space. + * Running qsd_op_begin() before qsd_start() isn't fatal and + * will return success. + * Once qsd_start() has been run, qsd_op_begin() will block + * until the reintegration procedure is completed. + * + * - qsd_op_end(): performs the post operation quota processing. This must be + * called after the operation transaction stopped. + * While qsd_op_begin() must be invoked each time a new + * operation is declared, qsd_op_end() should be called only + * once for the whole transaction. + * + * - qsd_adjust_quota(): triggers pre-acquire/release if necessary. + * + * Below are the function prototypes to be used by OSD layer to manage quota + * enforcement. Arguments are documented where each function is defined. */ + +struct qsd_instance *qsd_init(const struct lu_env *, char *, struct dt_device *, + cfs_proc_dir_entry_t *); +int qsd_prepare(const struct lu_env *, struct qsd_instance *); +int qsd_start(const struct lu_env *, struct qsd_instance *); +void qsd_fini(const struct lu_env *, struct qsd_instance *); +int qsd_op_begin(const struct lu_env *, struct qsd_instance *, + struct lquota_trans *, struct lquota_id_info *, int *); +void qsd_op_end(const struct lu_env *, struct qsd_instance *, + struct lquota_trans *); +void qsd_adjust_quota(const struct lu_env *, struct qsd_instance *, + union lquota_id *, int); -struct obd_trans_info; -typedef int (*quota_acquire)(struct obd_device *obd, const unsigned int id[], - struct obd_trans_info *oti, int isblk); - -typedef struct { - int (*quota_init) (void); - int (*quota_exit) (void); - int (*quota_setup) (struct obd_device *); - int (*quota_cleanup) (struct obd_device *); - /** - * For quota master, close admin quota files - */ - int (*quota_fs_cleanup) (struct obd_device *); - int (*quota_ctl) (struct obd_device *, struct obd_export *, - struct obd_quotactl *); - int (*quota_check) (struct obd_device *, struct obd_export *, - struct obd_quotactl *); - int (*quota_recovery) (struct obd_device *); - - /** - * For quota master/slave, adjust quota limit after fs operation - */ - int (*quota_adjust) (struct obd_device *, const unsigned int[], - const unsigned int[], int, int); - - /** - * For quota slave, set import, trigger quota recovery, - * For quota master, set lqc_setup - */ - int (*quota_setinfo) (struct obd_device *, void *); - - /** - * For quota slave, clear import when relative import is invalid - */ - int (*quota_clearinfo) (struct obd_export *, struct obd_device *); - - /** - * For quota slave, set proper thread resoure capability - */ - int (*quota_enforce) (struct obd_device *, unsigned int); - - /** - * For quota slave, check whether specified uid/gid is over quota - */ - int (*quota_getflag) (struct obd_device *, struct obdo *); - -#ifdef __KERNEL__ - /** - * For quota slave, acquire/release quota from master if needed - */ - int (*quota_acquire) (struct obd_device *, const unsigned int [], - struct obd_trans_info *, int); - - /** - * For quota slave, check whether specified uid/gid's remaining quota - * can finish a block_write or inode_create rpc. It updates the pending - * record of block and inode, acquires quota if necessary - */ - int (*quota_chkquota) (struct obd_device *, struct obd_export *, - const unsigned int [], int [], - int, quota_acquire, struct obd_trans_info *, - int, struct inode *, int); - - /** - * For quota client, the actions after the pending write is committed - */ - int (*quota_pending_commit) (struct obd_device *, const unsigned int [], - int [], int); -#endif +/* + * Quota information attached to a transaction + */ - /** - * For quota client, poll if the quota check done - */ - int (*quota_poll_check) (struct obd_export *, struct if_quotacheck *); - - /** - * For quota client, check whether specified uid/gid is over quota - */ - int (*quota_chkdq) (struct client_obd *, const unsigned int []); - - /** - * For quota client, set over quota flag for specifed uid/gid - */ - int (*quota_setdq) (struct client_obd *, const unsigned int [], - obd_flag, obd_flag); - - /** - * For adjusting qunit size b=10600 - */ - int (*quota_adjust_qunit) (struct obd_export *exp, - struct quota_adjust_qunit *oqaq, - struct lustre_quota_ctxt *qctxt, - struct ptlrpc_request_set *rqset); - -} quota_interface_t; - -#define Q_COPY(out, in, member) (out)->member = (in)->member - -#define QUOTA_OP(interface, op) interface->quota_ ## op - -#define QUOTA_CHECK_OP(interface, op) \ -do { \ - if (!interface) \ - RETURN(0); \ - if (!QUOTA_OP(interface, op)) { \ - CERROR("no quota operation: " #op "\n"); \ - RETURN(-EOPNOTSUPP); \ - } \ -} while(0) - -static inline int lquota_init(quota_interface_t *interface) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, init); - rc = QUOTA_OP(interface, init)(); - RETURN(rc); -} - -static inline int lquota_exit(quota_interface_t *interface) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, exit); - rc = QUOTA_OP(interface, exit)(); - RETURN(rc); -} - -static inline int lquota_setup(quota_interface_t *interface, - struct obd_device *obd) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, setup); - rc = QUOTA_OP(interface, setup)(obd); - RETURN(rc); -} - -static inline int lquota_cleanup(quota_interface_t *interface, - struct obd_device *obd) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, cleanup); - rc = QUOTA_OP(interface, cleanup)(obd); - RETURN(rc); -} - -static inline int lquota_fs_cleanup(quota_interface_t *interface, - struct obd_device *obd) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, fs_cleanup); - rc = QUOTA_OP(interface, fs_cleanup)(obd); - RETURN(rc); -} - -static inline int lquota_recovery(quota_interface_t *interface, - struct obd_device *obd) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, recovery); - rc = QUOTA_OP(interface, recovery)(obd); - RETURN(rc); -} - -static inline int lquota_check(quota_interface_t *interface, - struct obd_device *obd, - struct obd_export *exp, - struct obd_quotactl *oqctl) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, check); - rc = QUOTA_OP(interface, check)(obd, exp, oqctl); - RETURN(rc); -} - -static inline int lquota_ctl(quota_interface_t *interface, - struct obd_device *obd, - struct obd_quotactl *oqctl) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, ctl); - rc = QUOTA_OP(interface, ctl)(obd, NULL, oqctl); - RETURN(rc); -} - -static inline int lquota_adjust(quota_interface_t *interface, - struct obd_device *obd, - const unsigned int qcids[], - const unsigned int qpids[], - int rc, int opc) -{ - int ret; - ENTRY; - - QUOTA_CHECK_OP(interface, adjust); - ret = QUOTA_OP(interface, adjust)(obd, qcids, qpids, rc, opc); - RETURN(ret); -} - -static inline int lquota_setinfo(quota_interface_t *interface, - struct obd_device *obd, - void *data) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, setinfo); - rc = QUOTA_OP(interface, setinfo)(obd, data); - RETURN(rc); -} - -static inline int lquota_clearinfo(quota_interface_t *interface, - struct obd_export *exp, - struct obd_device *obd) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, clearinfo); - rc = QUOTA_OP(interface, clearinfo)(exp, obd); - RETURN(rc); -} - -static inline int lquota_enforce(quota_interface_t *interface, - struct obd_device *obd, - unsigned int ignore) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, enforce); - rc = QUOTA_OP(interface, enforce)(obd, ignore); - RETURN(rc); -} - -static inline int lquota_getflag(quota_interface_t *interface, - struct obd_device *obd, struct obdo *oa) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, getflag); - rc = QUOTA_OP(interface, getflag)(obd, oa); - RETURN(rc); -} - -#ifdef __KERNEL__ -static inline int lquota_chkquota(quota_interface_t *interface, - struct obd_device *obd, - struct obd_export *exp, - const unsigned int id[], int pending[], - int count, struct obd_trans_info *oti, - int isblk, void *data, int frags) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, chkquota); - QUOTA_CHECK_OP(interface, acquire); - rc = QUOTA_OP(interface, chkquota)(obd, exp, id, pending, count, - QUOTA_OP(interface, acquire), oti, - isblk, (struct inode *)data, frags); - RETURN(rc); -} - -static inline int lquota_pending_commit(quota_interface_t *interface, - struct obd_device *obd, - const unsigned int id[], - int pending[], int isblk) -{ - int rc; - ENTRY; - - QUOTA_CHECK_OP(interface, pending_commit); - rc = QUOTA_OP(interface, pending_commit)(obd, id, pending, isblk); - RETURN(rc); -} -#endif +struct lquota_entry; -#ifndef __KERNEL__ -#ifndef MAXQUOTAS -#define MAXQUOTAS 2 -#endif +struct lquota_id_info { + /* quota identifier */ + union lquota_id lqi_id; -#ifndef USRQUOTA -#define USRQUOTA 0 -#endif + /* USRQUOTA or GRPQUOTA for now, could be expanded for + * directory quota or other types later. */ + int lqi_type; -#ifndef GRPQUOTA -#define GRPQUOTA 1 -#endif + /* inodes or kbytes to be consumed or released, it could + * be negative when releasing space. */ + long long lqi_space; -#endif + /* quota slave entry structure associated with this ID */ + struct lquota_entry *lqi_qentry; -#define LUSTRE_ADMIN_QUOTAFILES_V2 {\ - "admin_quotafile_v2.usr", /** user admin quotafile */\ - "admin_quotafile_v2.grp" /** group admin quotafile */\ -} + /* whether we are reporting blocks or inodes */ + bool lqi_is_blk; +}; -/* - * Definitions of structures for vfsv0 quota format - * Source linux/fs/quota/quotaio_v2.h +/* Since we enforce only inode quota in meta pool (MDTs), and block quota in + * data pool (OSTs), there are at most 4 quota ids being enforced in a single + * transaction, which is chown transaction: + * original uid and gid, new uid and gid. * - * 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_H) && !defined(HAVE_FS_QUOTA_QUOTAIO_H) && \ - !defined(HAVE_FS_QUOTAIO_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 */ -}; + * This value might need to be revised when directory quota is added. */ +#define QUOTA_MAX_TRANSIDS 4 -/* First generic header */ -struct v2_disk_dqheader { - __le32 dqh_magic; /* Magic number identifying file */ - __le32 dqh_version; /* File version */ +/* all qids involved in a single transaction */ +struct lquota_trans { + unsigned short lqt_id_cnt; + struct lquota_id_info lqt_ids[QUOTA_MAX_TRANSIDS]; }; -#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__ */ +/* flags for quota local enforcement */ +#define QUOTA_FL_OVER_USRQUOTA 0x01 +#define QUOTA_FL_OVER_GRPQUOTA 0x02 +#define QUOTA_FL_SYNC 0x04 -/** @} quota */ +#define IS_LQUOTA_RES(res) \ + (res->lr_name.name[LUSTRE_RES_ID_SEQ_OFF] == FID_SEQ_QUOTA || \ + res->lr_name.name[LUSTRE_RES_ID_SEQ_OFF] == FID_SEQ_QUOTA_GLB) +/* helper function used by MDT & OFD to retrieve quota accounting information + * on slave */ +int lquotactl_slv(const struct lu_env *, struct dt_device *, + struct obd_quotactl *); +/** @} quota */ #endif /* _LUSTRE_QUOTA_H */ diff --git a/lustre/include/lustre_req_layout.h b/lustre/include/lustre_req_layout.h index eeb3ea8..e46b903 100644 --- a/lustre/include/lustre_req_layout.h +++ b/lustre/include/lustre_req_layout.h @@ -181,7 +181,6 @@ extern struct req_format RQF_MDS_REINT_SETATTR; extern struct req_format RQF_MDS_REINT_SETXATTR; extern struct req_format RQF_MDS_QUOTACHECK; extern struct req_format RQF_MDS_QUOTACTL; -extern struct req_format RQF_MDS_QUOTA_DQACQ; extern struct req_format RQF_QC_CALLBACK; extern struct req_format RQF_QUOTA_DQACQ; /* OST req_format */ @@ -189,7 +188,6 @@ extern struct req_format RQF_OST_CONNECT; extern struct req_format RQF_OST_DISCONNECT; extern struct req_format RQF_OST_QUOTACHECK; extern struct req_format RQF_OST_QUOTACTL; -extern struct req_format RQF_OST_QUOTA_ADJUST_QUNIT; extern struct req_format RQF_OST_GETATTR; extern struct req_format RQF_OST_SETATTR; extern struct req_format RQF_OST_CREATE; @@ -265,8 +263,6 @@ extern struct req_msg_field RMF_CAPA1; extern struct req_msg_field RMF_CAPA2; extern struct req_msg_field RMF_OBD_QUOTACHECK; extern struct req_msg_field RMF_OBD_QUOTACTL; -extern struct req_msg_field RMF_QUOTA_ADJUST_QUNIT; -extern struct req_msg_field RMF_QUNIT_DATA; extern struct req_msg_field RMF_QUOTA_BODY; extern struct req_msg_field RMF_STRING; diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 02e5fee..1113a74 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -63,7 +63,6 @@ #include #include #include -#include #include #include @@ -275,9 +274,6 @@ struct obd_device_target { struct lu_target *obt_lut; #endif __u64 obt_mount_count; - cfs_semaphore_t obt_quotachecking; - struct lustre_quota_ctxt obt_qctxt; - lustre_quota_version_t obt_qfmt; cfs_rw_semaphore_t obt_rwsem; struct vfsmount *obt_vfsmnt; struct file *obt_health_check_filp; @@ -378,9 +374,6 @@ struct filter_obd { cfs_spinlock_t fo_llog_list_lock; struct brw_stats fo_filter_stats; - struct lustre_quota_ctxt fo_quota_ctxt; - cfs_spinlock_t fo_quotacheck_lock; - cfs_atomic_t fo_quotachecking; int fo_fmd_max_num; /* per exp filter_mod_data */ int fo_fmd_max_age; /* jiffies to fmd expiry */ @@ -535,8 +528,12 @@ struct client_obd { /* also protected by the poorly named _loi_list_lock lock above */ struct osc_async_rc cl_ar; - /* used by quotacheck */ - int cl_qchk_stat; /* quotacheck stat of the peer */ + /* used by quotacheck when the servers are older than 2.4 */ + int cl_qchk_stat; /* quotacheck stat of the peer */ +#define CL_NOT_QUOTACHECKED 1 /* client->cl_qchk_stat init value */ +#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 7, 50, 0) +#warning "please consider removing quotacheck compatibility code" +#endif /* sequence manager */ struct lu_client_seq *cl_seq; @@ -550,8 +547,6 @@ struct client_obd { }; #define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid) -#define CL_NOT_QUOTACHECKED 1 /* client->cl_qchk_stat init value */ - struct mds_obd { /* NB this field MUST be first */ struct obd_device_target mds_obt; @@ -586,14 +581,12 @@ struct mds_obd { __u32 mds_lov_objid_lastidx; - struct lustre_quota_info mds_quota_info; cfs_rw_semaphore_t mds_qonoff_sem; unsigned long mds_fl_user_xattr:1, mds_fl_acl:1, mds_evict_ost_nids:1, mds_fl_cfglog:1, mds_fl_synced:1, - mds_quota:1, mds_fl_target:1; /* mds have one or * more targets */ diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 3965d20..013f54f 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -48,6 +48,7 @@ #define DEBUG_SUBSYSTEM S_LLITE +#include #include #include #include diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index a80bf66..21f530a 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -49,6 +49,7 @@ #include #endif +#include #include #include #include diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index a79fecc..aaf70a8 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -58,7 +58,6 @@ #include #include -#include __u64 obd_max_pages = 0; __u64 obd_max_alloc = 0; diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index dfafa7a..ba51efa 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -373,7 +373,6 @@ static int mds_cmd_cleanup(struct obd_device *obd) mds->mds_objects_dir = NULL; } - ll_vfs_dq_off(obd->u.obt.obt_sb, 0); shrink_dcache_sb(mds->mds_obt.obt_sb); fsfilt_put_ops(obd->obd_fsops); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 1a89c83..62da03a 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -67,7 +67,7 @@ #include "mdt_internal.h" #include #include -#include +#include mdl_mode_t mdt_mdl_lock_modes[] = { [LCK_MINMODE] = MDL_MINMODE, diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 5d50e50..98f3deb 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -71,7 +71,7 @@ #include #include #include -#include +#include /* check if request's xid is equal to last one or not*/ static inline int req_xid_is_last(struct ptlrpc_request *req) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 8cc4d64..aab8ce2 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include "mgs_internal.h" diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index 51305b5..ce0f45a 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -49,7 +49,7 @@ /* fid_be_to_cpu() */ #include -#include +#include /* context key constructor/destructor: dt_global_key_init, dt_global_key_fini */ LU_KEY_INIT(dt_global, struct dt_thread_info); diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c index d863df2..0bd7095 100644 --- a/lustre/ofd/lproc_ofd.c +++ b/lustre/ofd/lproc_ofd.c @@ -41,7 +41,6 @@ #include #include #include -#include #include "ofd_internal.h" diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index c44524d..80fe705 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -44,7 +44,7 @@ #include "ofd_internal.h" #include -#include +#include static int ofd_export_stats_init(struct ofd_device *ofd, struct obd_export *exp, void *client_nid) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 66600be..3572bf9 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -72,8 +72,7 @@ /* llo_* api support */ #include -/* dt_acct_features */ -#include +#include #ifdef HAVE_LDISKFS_PDO int ldiskfs_pdo = 1; diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index f01412d..c806e7f 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -72,7 +72,7 @@ #include #include #include -#include +#include #include "osd_oi.h" #include "osd_iam.h" diff --git a/lustre/osd-ldiskfs/osd_quota.c b/lustre/osd-ldiskfs/osd_quota.c index 5cfd1f5..414284e 100644 --- a/lustre/osd-ldiskfs/osd_quota.c +++ b/lustre/osd-ldiskfs/osd_quota.c @@ -28,7 +28,7 @@ * Author: Niu Yawei */ -#include +#include #include "osd_internal.h" /** diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h index d3025b7..e6c21d8 100644 --- a/lustre/osd-zfs/osd_internal.h +++ b/lustre/osd-zfs/osd_internal.h @@ -47,7 +47,7 @@ #define _OSD_INTERNAL_H #include -#include +#include #include #include diff --git a/lustre/osd-zfs/osd_quota.c b/lustre/osd-zfs/osd_quota.c index 5470d94..6399112 100644 --- a/lustre/osd-zfs/osd_quota.c +++ b/lustre/osd-zfs/osd_quota.c @@ -27,7 +27,7 @@ * Author: Johann Lombardi */ -#include +#include #include #include "udmu.h" #include "osd_internal.h" diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 5fdc789..a2f4de9 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -51,7 +51,6 @@ #include #include #include -#include #include "ost_internal.h" static int oss_num_threads; @@ -1670,7 +1669,6 @@ int ost_msg_check_version(struct lustre_msg *msg) case OST_GET_INFO: case OST_QUOTACHECK: case OST_QUOTACTL: - case OST_QUOTA_ADJUST_QUNIT: rc = lustre_msg_check_version(msg, LUSTRE_OST_VERSION); if (rc) CERROR("bad opc %u version %08x, expecting %08x\n", @@ -1699,6 +1697,10 @@ int ost_msg_check_version(struct lustre_msg *msg) lustre_msg_get_version(msg), LUSTRE_LOG_VERSION); break; + case OST_QUOTA_ADJUST_QUNIT: + rc = -ENOTSUPP; + CERROR("Quota adjust is deprecated as of 2.4.0\n"); + break; default: CERROR("Unexpected opcode %d\n", lustre_msg_get_opc(msg)); rc = -ENOTSUPP; diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h index ff77a52..247699c 100644 --- a/lustre/ost/ost_internal.h +++ b/lustre/ost/ost_internal.h @@ -62,9 +62,6 @@ struct ost_thread_local_cache { struct ost_thread_local_cache *ost_tls(struct ptlrpc_request *r); -/* Quota stuff */ -extern quota_interface_t *quota_interface; - #ifdef LPROCFS void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars); #else diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index c6e3169..20bde6c 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -121,15 +121,6 @@ static const struct req_msg_field *quotactl_only[] = { &RMF_PTLRPC_BODY, &RMF_OBD_QUOTACTL }; -static const struct req_msg_field *quota_adjust_qunit_only[] = { - &RMF_PTLRPC_BODY, - &RMF_QUOTA_ADJUST_QUNIT -}; - -static const struct req_msg_field *qunit_data_only[] = { - &RMF_PTLRPC_BODY, - &RMF_QUNIT_DATA -}; static const struct req_msg_field *quota_body_only[] = { &RMF_PTLRPC_BODY, @@ -622,13 +613,11 @@ static struct req_format *req_formats[] = { &RQF_MDS_REINT_SETXATTR, &RQF_MDS_QUOTACHECK, &RQF_MDS_QUOTACTL, - &RQF_MDS_QUOTA_DQACQ, &RQF_QC_CALLBACK, &RQF_OST_CONNECT, &RQF_OST_DISCONNECT, &RQF_OST_QUOTACHECK, &RQF_OST_QUOTACTL, - &RQF_OST_QUOTA_ADJUST_QUNIT, &RQF_OST_GETATTR, &RQF_OST_SETATTR, &RQF_OST_CREATE, @@ -796,17 +785,6 @@ struct req_msg_field RMF_OBD_QUOTACTL = lustre_swab_obd_quotactl, NULL); EXPORT_SYMBOL(RMF_OBD_QUOTACTL); -struct req_msg_field RMF_QUOTA_ADJUST_QUNIT = - DEFINE_MSGF("quota_adjust_qunit", 0, - sizeof(struct quota_adjust_qunit), - lustre_swab_quota_adjust_qunit, NULL); -EXPORT_SYMBOL(RMF_QUOTA_ADJUST_QUNIT); - -struct req_msg_field RMF_QUNIT_DATA = - DEFINE_MSGF("qunit_data", 0, - sizeof(struct qunit_data), lustre_swab_qdata, NULL); -EXPORT_SYMBOL(RMF_QUNIT_DATA); - struct req_msg_field RMF_QUOTA_BODY = DEFINE_MSGF("quota_body", 0, sizeof(struct quota_body), lustre_swab_quota_body, NULL); @@ -1092,19 +1070,10 @@ struct req_format RQF_OST_QUOTACTL = DEFINE_REQ_FMT0("OST_QUOTACTL", quotactl_only, quotactl_only); EXPORT_SYMBOL(RQF_OST_QUOTACTL); -struct req_format RQF_OST_QUOTA_ADJUST_QUNIT = - DEFINE_REQ_FMT0("OST_QUOTA_ADJUST_QUNIT", quota_adjust_qunit_only, - quota_adjust_qunit_only); -EXPORT_SYMBOL(RQF_OST_QUOTA_ADJUST_QUNIT); - struct req_format RQF_QC_CALLBACK = DEFINE_REQ_FMT0("QC_CALLBACK", quotactl_only, empty); EXPORT_SYMBOL(RQF_QC_CALLBACK); -struct req_format RQF_MDS_QUOTA_DQACQ = - DEFINE_REQ_FMT0("MDS_QUOTA_DQACQ", qunit_data_only, qunit_data_only); -EXPORT_SYMBOL(RQF_MDS_QUOTA_DQACQ); - struct req_format RQF_QUOTA_DQACQ = DEFINE_REQ_FMT0("QUOTA_DQACQ", quota_body_only, quota_body_only); EXPORT_SYMBOL(RQF_QUOTA_DQACQ); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 87d38ac..d6e9a66 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1977,16 +1977,6 @@ void lustre_swab_obd_quotactl (struct obd_quotactl *q) } EXPORT_SYMBOL(lustre_swab_obd_quotactl); -void lustre_swab_quota_adjust_qunit (struct quota_adjust_qunit *q) -{ - __swab32s (&q->qaq_flags); - __swab32s (&q->qaq_id); - __swab64s (&q->qaq_bunit_sz); - __swab64s (&q->qaq_iunit_sz); - __swab64s (&q->padding1); -} -EXPORT_SYMBOL(lustre_swab_quota_adjust_qunit); - void lustre_swab_mdt_remote_perm (struct mdt_remote_perm *p) { __swab32s (&p->rp_uid); @@ -2261,16 +2251,6 @@ int llog_log_swabbed(struct llog_log_hdr *hdr) return -1; } -void lustre_swab_qdata(struct qunit_data *d) -{ - __swab32s (&d->qd_id); - __swab32s (&d->qd_flags); - __swab64s (&d->qd_count); - __swab64s (&d->qd_qunit); - CLASSERT(offsetof(typeof(*d), padding) != 0); -} -EXPORT_SYMBOL(lustre_swab_qdata); - void lustre_swab_quota_body(struct quota_body *b) { lustre_swab_lu_fid(&b->qb_fid); @@ -2376,68 +2356,6 @@ void dump_rcs(__u32 *rc) } EXPORT_SYMBOL(dump_rcs); -#ifdef __KERNEL__ - -/** - * got qdata from request(req/rep) - */ -struct qunit_data *quota_get_qdata(void *r, int is_req, int is_exp) -{ - struct ptlrpc_request *req = (struct ptlrpc_request *)r; - struct qunit_data *qdata; - __u64 flags = is_exp ? req->rq_export->exp_connect_flags : - req->rq_import->imp_connect_data.ocd_connect_flags; - - LASSERT(req); - /* support for quota64 */ - LASSERT(flags & OBD_CONNECT_QUOTA64); - /* support for change_qs */ - LASSERT(flags & OBD_CONNECT_CHANGE_QS); - - if (is_req == QUOTA_REQUEST) - qdata = req_capsule_client_get(&req->rq_pill, &RMF_QUNIT_DATA); - else - qdata = req_capsule_server_get(&req->rq_pill, &RMF_QUNIT_DATA); - if (qdata == NULL) - return ERR_PTR(-EPROTO); - - QDATA_SET_CHANGE_QS(qdata); - return qdata; -} -EXPORT_SYMBOL(quota_get_qdata); - -/** - * copy qdata to request(req/rep) - */ -int quota_copy_qdata(void *r, struct qunit_data *qdata, int is_req, - int is_exp) -{ - struct ptlrpc_request *req = (struct ptlrpc_request *)r; - void *target; - __u64 flags = is_exp ? req->rq_export->exp_connect_flags : - req->rq_import->imp_connect_data.ocd_connect_flags; - - LASSERT(req); - LASSERT(qdata); - /* support for quota64 */ - LASSERT(flags & OBD_CONNECT_QUOTA64); - /* support for change_qs */ - LASSERT(flags & OBD_CONNECT_CHANGE_QS); - - if (is_req == QUOTA_REQUEST) - target = req_capsule_client_get(&req->rq_pill, &RMF_QUNIT_DATA); - else - target = req_capsule_server_get(&req->rq_pill, &RMF_QUNIT_DATA); - if (target == NULL) - return -EPROTO; - - LASSERT(target != qdata); - memcpy(target, qdata, sizeof(*qdata)); - return 0; -} -EXPORT_SYMBOL(quota_copy_qdata); -#endif /* __KERNEL__ */ - static inline int req_ptlrpc_body_swabbed(struct ptlrpc_request *req) { LASSERT(req->rq_reqmsg); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 0fff13f..65b2596 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -226,22 +226,6 @@ void lustre_assert_wire_constants(void) (unsigned)MF_SOM_AU); LASSERTF(MF_GETATTR_LOCK == 0x00000100UL, "found 0x%.8xUL\n", (unsigned)MF_GETATTR_LOCK); - LASSERTF(LQUOTA_FLAGS_GRP == 1, "found %lld\n", - (long long)LQUOTA_FLAGS_GRP); - LASSERTF(LQUOTA_FLAGS_BLK == 2, "found %lld\n", - (long long)LQUOTA_FLAGS_BLK); - LASSERTF(LQUOTA_FLAGS_ADJBLK == 4, "found %lld\n", - (long long)LQUOTA_FLAGS_ADJBLK); - LASSERTF(LQUOTA_FLAGS_ADJINO == 8, "found %lld\n", - (long long)LQUOTA_FLAGS_ADJINO); - LASSERTF(LQUOTA_FLAGS_CHG_QS == 16, "found %lld\n", - (long long)LQUOTA_FLAGS_CHG_QS); - LASSERTF(LQUOTA_FLAGS_RECOVERY == 32, "found %lld\n", - (long long)LQUOTA_FLAGS_RECOVERY); - LASSERTF(LQUOTA_FLAGS_SETQUOTA == 64, "found %lld\n", - (long long)LQUOTA_FLAGS_SETQUOTA); - LASSERTF(LQUOTA_QAQ_CREATE_LQS == 0x80000000UL, "found 0x%.8xUL\n", - (unsigned)LQUOTA_QAQ_CREATE_LQS); LASSERTF(MDS_ATTR_MODE == 0x0000000000000001ULL, "found 0x%.16llxULL\n", (long long)MDS_ATTR_MODE); LASSERTF(MDS_ATTR_UID == 0x0000000000000002ULL, "found 0x%.16llxULL\n", @@ -1538,6 +1522,11 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n", (long long)(int)sizeof(union lquota_id)); + LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n", + (long long)QUOTABLOCK_BITS); + LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n", + (long long)QUOTABLOCK_SIZE); + /* Checks for struct obd_quotactl */ LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n", (long long)(int)sizeof(struct obd_quotactl)); @@ -3720,30 +3709,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ll_fiemap_info_key *)0)->fiemap) == 32, "found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_info_key *)0)->fiemap)); - /* Checks for struct qunit_data */ - LASSERTF((int)sizeof(struct qunit_data) == 32, "found %lld\n", - (long long)(int)sizeof(struct qunit_data)); - LASSERTF((int)offsetof(struct qunit_data, qd_id) == 0, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_id)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_id) == 4, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_id)); - LASSERTF((int)offsetof(struct qunit_data, qd_flags) == 4, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_flags)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_flags) == 4, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_flags)); - LASSERTF((int)offsetof(struct qunit_data, qd_count) == 8, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_count)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_count) == 8, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_count)); - LASSERTF((int)offsetof(struct qunit_data, qd_qunit) == 16, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_qunit)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_qunit) == 8, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_qunit)); - LASSERTF((int)offsetof(struct qunit_data, padding) == 24, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, padding)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->padding) == 8, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->padding)); - /* Checks for struct quota_body */ LASSERTF((int)sizeof(struct quota_body) == 112, "found %lld\n", (long long)(int)sizeof(struct quota_body)); @@ -3788,30 +3753,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct quota_body *)0)->qb_padding1[4]) == 8, "found %lld\n", (long long)(int)sizeof(((struct quota_body *)0)->qb_padding1[4])); - /* Checks for struct quota_adjust_qunit */ - LASSERTF((int)sizeof(struct quota_adjust_qunit) == 32, "found %lld\n", - (long long)(int)sizeof(struct quota_adjust_qunit)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_flags) == 0, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_flags)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_flags) == 4, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_flags)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_id) == 4, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_id)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_id) == 4, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_id)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_bunit_sz) == 8, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_bunit_sz)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_bunit_sz) == 8, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_bunit_sz)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_iunit_sz) == 16, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_iunit_sz)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_iunit_sz) == 8, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_iunit_sz)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, padding1) == 24, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, padding1)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->padding1) == 8, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->padding1)); - /* Checks for struct mgs_target_info */ LASSERTF((int)sizeof(struct mgs_target_info) == 4544, "found %lld\n", (long long)(int)sizeof(struct mgs_target_info)); diff --git a/lustre/quota/lquota_internal.h b/lustre/quota/lquota_internal.h index 6bd6924..552993b 100644 --- a/lustre/quota/lquota_internal.h +++ b/lustre/quota/lquota_internal.h @@ -26,7 +26,7 @@ */ #include -#include +#include #ifndef _LQUOTA_INTERNAL_H #define _LQUOTA_INTERNAL_H diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c index 685f50f..da01c51 100644 --- a/lustre/quota/qmt_dev.c +++ b/lustre/quota/qmt_dev.c @@ -45,7 +45,7 @@ * The QMT device is currently set up by the MDT and should probably be moved * to a separate target in the future. Meanwhile, the MDT forwards all quota * requests to the QMT via a list of request handlers (see struct qmt_handlers - * in lquota.h). The QMT also borrows the LDLM namespace from the MDT. + * in lustre_quota.h). The QMT also borrows the LDLM namespace from the MDT. * * To bring up a QMT device, the following steps must be completed: * diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index c38f12e..41f76d5 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -70,7 +70,6 @@ #include #include -#include #include #include "obdctl.h" diff --git a/lustre/utils/req-layout.c b/lustre/utils/req-layout.c index a0196c4..8c4c74d 100644 --- a/lustre/utils/req-layout.c +++ b/lustre/utils/req-layout.c @@ -67,7 +67,6 @@ #define lustre_swab_llog_hdr NULL #define lustre_swab_llogd_body NULL #define lustre_swab_obd_quotactl NULL -#define lustre_swab_quota_adjust_qunit NULL #define lustre_swab_mgs_target_info NULL #define lustre_swab_niobuf_remote NULL #define lustre_swab_obd_ioobj NULL diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 5984497..900509a 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -701,9 +701,14 @@ check_obd_ioobj(void) static void check_obd_quotactl(void) { + BLANK_LINE(); CHECK_UNION(lquota_id); + BLANK_LINE(); + CHECK_VALUE(QUOTABLOCK_BITS); + CHECK_VALUE(QUOTABLOCK_SIZE); + BLANK_LINE(); CHECK_STRUCT(obd_quotactl); CHECK_MEMBER(obd_quotactl, qc_cmd); @@ -1643,18 +1648,6 @@ check_ll_fiemap_info_key(void) } static void -check_qunit_data(void) -{ - BLANK_LINE(); - CHECK_STRUCT(qunit_data); - CHECK_MEMBER(qunit_data, qd_id); - CHECK_MEMBER(qunit_data, qd_flags); - CHECK_MEMBER(qunit_data, qd_count); - CHECK_MEMBER(qunit_data, qd_qunit); - CHECK_MEMBER(qunit_data, padding); -} - -static void check_quota_body(void) { BLANK_LINE(); @@ -1750,18 +1743,6 @@ check_posix_acl_xattr_header(void) } static void -check_quota_adjust_qunit(void) -{ - BLANK_LINE(); - CHECK_STRUCT(quota_adjust_qunit); - CHECK_MEMBER(quota_adjust_qunit, qaq_flags); - CHECK_MEMBER(quota_adjust_qunit, qaq_id); - CHECK_MEMBER(quota_adjust_qunit, qaq_bunit_sz); - CHECK_MEMBER(quota_adjust_qunit, qaq_iunit_sz); - CHECK_MEMBER(quota_adjust_qunit, padding1); -} - -static void check_ll_user_fiemap(void) { BLANK_LINE(); @@ -2029,16 +2010,6 @@ main(int argc, char **argv) CHECK_VALUE_X(MF_SOM_AU); CHECK_VALUE_X(MF_GETATTR_LOCK); - CHECK_VALUE(LQUOTA_FLAGS_GRP); - CHECK_VALUE(LQUOTA_FLAGS_BLK); - CHECK_VALUE(LQUOTA_FLAGS_ADJBLK); - CHECK_VALUE(LQUOTA_FLAGS_ADJINO); - CHECK_VALUE(LQUOTA_FLAGS_CHG_QS); - CHECK_VALUE(LQUOTA_FLAGS_RECOVERY); - CHECK_VALUE(LQUOTA_FLAGS_SETQUOTA); - - CHECK_VALUE_X(LQUOTA_QAQ_CREATE_LQS); - CHECK_VALUE_64X(MDS_ATTR_MODE); CHECK_VALUE_64X(MDS_ATTR_UID); CHECK_VALUE_64X(MDS_ATTR_GID); @@ -2202,9 +2173,7 @@ main(int argc, char **argv) check_llogd_body(); check_llogd_conn_body(); check_ll_fiemap_info_key(); - check_qunit_data(); check_quota_body(); - check_quota_adjust_qunit(); check_mgs_target_info(); check_lustre_capa(); check_lustre_capa_key(); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index c389afb..5fbdb13 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -234,22 +234,6 @@ void lustre_assert_wire_constants(void) (unsigned)MF_SOM_AU); LASSERTF(MF_GETATTR_LOCK == 0x00000100UL, "found 0x%.8xUL\n", (unsigned)MF_GETATTR_LOCK); - LASSERTF(LQUOTA_FLAGS_GRP == 1, "found %lld\n", - (long long)LQUOTA_FLAGS_GRP); - LASSERTF(LQUOTA_FLAGS_BLK == 2, "found %lld\n", - (long long)LQUOTA_FLAGS_BLK); - LASSERTF(LQUOTA_FLAGS_ADJBLK == 4, "found %lld\n", - (long long)LQUOTA_FLAGS_ADJBLK); - LASSERTF(LQUOTA_FLAGS_ADJINO == 8, "found %lld\n", - (long long)LQUOTA_FLAGS_ADJINO); - LASSERTF(LQUOTA_FLAGS_CHG_QS == 16, "found %lld\n", - (long long)LQUOTA_FLAGS_CHG_QS); - LASSERTF(LQUOTA_FLAGS_RECOVERY == 32, "found %lld\n", - (long long)LQUOTA_FLAGS_RECOVERY); - LASSERTF(LQUOTA_FLAGS_SETQUOTA == 64, "found %lld\n", - (long long)LQUOTA_FLAGS_SETQUOTA); - LASSERTF(LQUOTA_QAQ_CREATE_LQS == 0x80000000UL, "found 0x%.8xUL\n", - (unsigned)LQUOTA_QAQ_CREATE_LQS); LASSERTF(MDS_ATTR_MODE == 0x0000000000000001ULL, "found 0x%.16llxULL\n", (long long)MDS_ATTR_MODE); LASSERTF(MDS_ATTR_UID == 0x0000000000000002ULL, "found 0x%.16llxULL\n", @@ -1546,6 +1530,11 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n", (long long)(int)sizeof(union lquota_id)); + LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n", + (long long)QUOTABLOCK_BITS); + LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n", + (long long)QUOTABLOCK_SIZE); + /* Checks for struct obd_quotactl */ LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n", (long long)(int)sizeof(struct obd_quotactl)); @@ -3728,30 +3717,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ll_fiemap_info_key *)0)->fiemap) == 32, "found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_info_key *)0)->fiemap)); - /* Checks for struct qunit_data */ - LASSERTF((int)sizeof(struct qunit_data) == 32, "found %lld\n", - (long long)(int)sizeof(struct qunit_data)); - LASSERTF((int)offsetof(struct qunit_data, qd_id) == 0, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_id)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_id) == 4, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_id)); - LASSERTF((int)offsetof(struct qunit_data, qd_flags) == 4, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_flags)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_flags) == 4, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_flags)); - LASSERTF((int)offsetof(struct qunit_data, qd_count) == 8, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_count)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_count) == 8, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_count)); - LASSERTF((int)offsetof(struct qunit_data, qd_qunit) == 16, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, qd_qunit)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->qd_qunit) == 8, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->qd_qunit)); - LASSERTF((int)offsetof(struct qunit_data, padding) == 24, "found %lld\n", - (long long)(int)offsetof(struct qunit_data, padding)); - LASSERTF((int)sizeof(((struct qunit_data *)0)->padding) == 8, "found %lld\n", - (long long)(int)sizeof(((struct qunit_data *)0)->padding)); - /* Checks for struct quota_body */ LASSERTF((int)sizeof(struct quota_body) == 112, "found %lld\n", (long long)(int)sizeof(struct quota_body)); @@ -3796,30 +3761,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct quota_body *)0)->qb_padding1[4]) == 8, "found %lld\n", (long long)(int)sizeof(((struct quota_body *)0)->qb_padding1[4])); - /* Checks for struct quota_adjust_qunit */ - LASSERTF((int)sizeof(struct quota_adjust_qunit) == 32, "found %lld\n", - (long long)(int)sizeof(struct quota_adjust_qunit)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_flags) == 0, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_flags)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_flags) == 4, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_flags)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_id) == 4, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_id)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_id) == 4, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_id)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_bunit_sz) == 8, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_bunit_sz)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_bunit_sz) == 8, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_bunit_sz)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, qaq_iunit_sz) == 16, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, qaq_iunit_sz)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->qaq_iunit_sz) == 8, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->qaq_iunit_sz)); - LASSERTF((int)offsetof(struct quota_adjust_qunit, padding1) == 24, "found %lld\n", - (long long)(int)offsetof(struct quota_adjust_qunit, padding1)); - LASSERTF((int)sizeof(((struct quota_adjust_qunit *)0)->padding1) == 8, "found %lld\n", - (long long)(int)sizeof(((struct quota_adjust_qunit *)0)->padding1)); - /* Checks for struct mgs_target_info */ LASSERTF((int)sizeof(struct mgs_target_info) == 4544, "found %lld\n", (long long)(int)sizeof(struct mgs_target_info)); -- 1.8.3.1