X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fquota%2Fqsd_internal.h;h=4f8e9fcc712fbdebdee9c471473317fe96b95649;hp=4b8cde5b9098c648fb176ff9f07552fa7a65124b;hb=d821adb626e050206f1b4605f1159cf65ad22af5;hpb=9680dabde70a9ec5f211e26d7c2f2988f296f455 diff --git a/lustre/quota/qsd_internal.h b/lustre/quota/qsd_internal.h index 4b8cde5..4f8e9fc 100644 --- a/lustre/quota/qsd_internal.h +++ b/lustre/quota/qsd_internal.h @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012 Whamcloud, Inc. + * Copyright (c) 2012, 2013, Intel Corporation. * Use is subject to license terms. */ @@ -56,10 +56,10 @@ struct qsd_instance { cfs_proc_dir_entry_t *qsd_proc; /* export used for the connection to quota master */ - struct obd_export *qsd_exp; + struct obd_export *qsd_exp; /* ldlm namespace used for quota locks */ - struct ldlm_namespace *qsd_ns; + struct ldlm_namespace *qsd_ns; /* on-disk directory where to store index files for this qsd instance */ struct dt_object *qsd_root; @@ -82,7 +82,7 @@ struct qsd_instance { cfs_list_t qsd_adjust_list; /* lock protecting adjust list */ - cfs_spinlock_t qsd_adjust_lock; + spinlock_t qsd_adjust_lock; /* dedicated thread for updating slave index files. */ struct ptlrpc_thread qsd_upd_thread; @@ -95,19 +95,26 @@ struct qsd_instance { * - the qsd update list * - the deferred list * - flags of the qsd_qtype_info */ - cfs_rwlock_t qsd_lock; + rwlock_t qsd_lock; /* Default quota settings which apply to all identifiers */ /* when blk qunit reaches this value, later write reqs from client * should be sync. b=16642 */ unsigned long qsd_sync_threshold; + /* how long a service thread can wait for quota space. + * value dynamically computed from obd_timeout and at_max if not + * enforced here (via procfs) */ + int qsd_timeout; + unsigned long qsd_is_md:1, /* managing quota for mdt */ qsd_started:1, /* instance is now started */ qsd_prepared:1, /* qsd_prepare() successfully * called */ qsd_exp_valid:1,/* qsd_exp is now valid */ - qsd_stopping:1; /* qsd_instance is stopping */ + qsd_stopping:1, /* qsd_instance is stopping */ + qsd_acct_failed:1; /* failed to set up acct + * for one quota type */ }; /* @@ -185,7 +192,7 @@ struct qsd_fsinfo { /* list of all qsd_instance for this fs */ cfs_list_t qfs_qsd_list; - cfs_semaphore_t qfs_sem; + struct semaphore qfs_sem; /* link to the global quota fsinfo list. */ cfs_list_t qfs_link; @@ -217,14 +224,6 @@ static inline void qqi_putref(struct qsd_qtype_info *qqi) cfs_atomic_dec(&qqi->qqi_ref); } -/* all kind of operations supported by qsd_dqacq() */ -enum qsd_ops { - QSD_ADJ, /* adjust quota space based on current qunit */ - QSD_ACQ, /* acquire space for requests */ - QSD_REL, /* release all space quota space uncondionnally */ - QSD_REP, /* report space usage during reintegration */ -}; - #define QSD_RES_TYPE(qsd) ((qsd)->qsd_is_md ? LQUOTA_RES_MD : LQUOTA_RES_DT) /* udpate record for slave & global index copy */ @@ -248,7 +247,7 @@ struct qsd_thread_info { struct ldlm_enqueue_info qti_einfo; struct lustre_handle qti_lockh; __u64 qti_slv_ver; - union ldlm_wire_lvb qti_lvb; + struct lquota_lvb qti_lvb; union { struct quota_body qti_body; struct idx_info qti_ii; @@ -320,6 +319,15 @@ static inline void qsd_set_qunit(struct lquota_entry *lqe, __u64 qunit) #define QSD_WB_INTERVAL 60 /* 60 seconds */ +/* helper function calculating how long a service thread should be waiting for + * quota space */ +static inline int qsd_wait_timeout(struct qsd_instance *qsd) +{ + if (qsd->qsd_timeout != 0) + return qsd->qsd_timeout; + return min_t(int, at_max / 2, obd_timeout / 2); +} + /* qsd_entry.c */ extern struct lquota_entry_operations qsd_lqe_ops; int qsd_refresh_usage(const struct lu_env *, struct lquota_entry *); @@ -345,14 +353,14 @@ typedef void (*qsd_req_completion_t) (const struct lu_env *, struct qsd_qtype_info *, struct quota_body *, struct quota_body *, struct lustre_handle *, - union ldlm_wire_lvb *, void *, int); + struct lquota_lvb *, void *, int); int qsd_send_dqacq(const struct lu_env *, struct obd_export *, struct quota_body *, bool, qsd_req_completion_t, struct qsd_qtype_info *, struct lustre_handle *, struct lquota_entry *); int qsd_intent_lock(const struct lu_env *, struct obd_export *, struct quota_body *, bool, int, qsd_req_completion_t, - struct qsd_qtype_info *, union ldlm_wire_lvb *, void *); + struct qsd_qtype_info *, struct lquota_lvb *, void *); int qsd_fetch_index(const struct lu_env *, struct obd_export *, struct idx_info *, unsigned int, cfs_page_t **, bool *); @@ -366,8 +374,7 @@ void qsd_put_fsinfo(struct qsd_fsinfo *); int qsd_process_config(struct lustre_cfg *); /* qsd_handler.c */ -int qsd_dqacq(const struct lu_env *, struct lquota_entry *, enum qsd_ops); -__u64 qsd_calc_grants(struct lquota_entry *, __u64, __u32); +int qsd_adjust(const struct lu_env *, struct lquota_entry *); /* qsd_writeback.c */ void qsd_upd_schedule(struct qsd_qtype_info *, struct lquota_entry *,