1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * lustre/quota/quota_internal.h
6 * Copyright (c) 2001-2005 Cluster File Systems, Inc.
8 * This file is part of Lustre, http://www.lustre.org.
10 * No redistribution or use is permitted outside of Cluster File Systems, Inc.
14 #ifndef __QUOTA_INTERNAL_H
15 #define __QUOTA_INTERNAL_H
17 #include <lustre_quota.h>
19 /* QUSG covnert bytes to blocks when counting block quota */
20 #define QUSG(count, isblk) (isblk ? toqb(count) : count)
22 /* This flag is set in qc_stat to distinguish if the current getquota
23 * operation is for quota recovery */
24 #define QUOTA_RECOVERING 0x01
28 #define DQUOT_DEBUG(dquot, fmt, arg...) \
29 CDEBUG(D_QUOTA, "refcnt(%u) id(%u) type(%u) off(%llu) flags(%lu) " \
30 "bhardlimit(%u) curspace("LPX64") ihardlimit(%u) " \
31 "curinodes(%u): " fmt, dquot->dq_refcnt, \
32 dquot->dq_id, dquot->dq_type, dquot->dq_off, dquot->dq_flags, \
33 dquot->dq_dqb.dqb_bhardlimit, dquot->dq_dqb.dqb_curspace, \
34 dquot->dq_dqb.dqb_ihardlimit, dquot->dq_dqb.dqb_curinodes, \
37 #define QINFO_DEBUG(qinfo, fmt, arg...) \
38 CDEBUG(D_QUOTA, "files (%p/%p) flags(%lu/%lu) blocks(%u/%u) " \
39 "free_blk(/%u/%u) free_entry(%u/%u): " fmt, \
40 qinfo->qi_files[0], qinfo->qi_files[1], \
41 qinfo->qi_info[0].dqi_flags, qinfo->qi_info[1].dqi_flags, \
42 qinfo->qi_info[0].dqi_blocks, qinfo->qi_info[1].dqi_blocks, \
43 qinfo->qi_info[0].dqi_free_blk, qinfo->qi_info[1].dqi_free_blk,\
44 qinfo->qi_info[0].dqi_free_entry, \
45 qinfo->qi_info[1].dqi_free_entry, ## arg);
48 void qunit_cache_cleanup(void);
49 int qunit_cache_init(void);
50 int qctxt_adjust_qunit(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
51 uid_t uid, gid_t gid, __u32 isblk, int wait);
52 int qctxt_wait_pending_dqacq(struct lustre_quota_ctxt *qctxt, unsigned int id,
53 unsigned short type, int isblk);
54 int qctxt_init(struct lustre_quota_ctxt *qctxt, struct super_block *sb,
55 dqacq_handler_t handler);
56 void qctxt_cleanup(struct lustre_quota_ctxt *qctxt, int force);
57 void qslave_start_recovery(struct obd_device *obd,
58 struct lustre_quota_ctxt *qctxt);
60 int lustre_dquot_init(void);
61 void lustre_dquot_exit(void);
62 int dqacq_handler(struct obd_device *obd, struct qunit_data *qdata, int opc);
63 int mds_quota_adjust(struct obd_device *obd, unsigned int qcids[],
64 unsigned int qpids[], int rc, int opc);
65 int filter_quota_adjust(struct obd_device *obd, unsigned int qcids[],
66 unsigned int qpids[], int rc, int opc);
67 int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl);
68 int mds_admin_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl);
69 int mds_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl);
70 int mds_quota_off(struct obd_device *obd, struct obd_quotactl *oqctl);
71 int mds_set_dqinfo(struct obd_device *obd, struct obd_quotactl *oqctl);
72 int mds_get_dqinfo(struct obd_device *obd, struct obd_quotactl *oqctl);
73 int mds_set_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl);
74 int mds_get_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl);
75 int mds_quota_recovery(struct obd_device *obd);
76 int mds_get_obd_quota(struct obd_device *obd, struct obd_quotactl *oqctl);
80 int mds_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
81 int filter_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
82 int client_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
83 int lov_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
86 int target_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
87 int client_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
88 int lov_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
89 int client_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk);