From: James Simmons Date: Thu, 24 Apr 2014 16:30:36 +0000 (-0400) Subject: LU-3963 libcfs: convert link list to linux api fld,mdc,osc,mgc X-Git-Tag: 2.5.59~37 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=df497dc560062a0a0c7178498cba8853843d39f1 LU-3963 libcfs: convert link list to linux api fld,mdc,osc,mgc Convert part of the lustre client code over to the linux list api. This covers the fld,mdc,osc,mgc layers. Change-Id: I5a2d5de144e77eb85701dd942ad143cb99d8ea69 Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/9904 Reviewed-by: Bob Glossman Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- diff --git a/lustre/fld/fld_cache.c b/lustre/fld/fld_cache.c index 8ca90f4..24c1f79 100644 --- a/lustre/fld/fld_cache.c +++ b/lustre/fld/fld_cache.c @@ -72,8 +72,8 @@ struct fld_cache *fld_cache_init(const char *name, if (cache == NULL) RETURN(ERR_PTR(-ENOMEM)); - CFS_INIT_LIST_HEAD(&cache->fci_entries_head); - CFS_INIT_LIST_HEAD(&cache->fci_lru); + INIT_LIST_HEAD(&cache->fci_entries_head); + INIT_LIST_HEAD(&cache->fci_lru); cache->fci_cache_count = 0; rwlock_init(&cache->fci_lock); @@ -127,8 +127,8 @@ void fld_cache_fini(struct fld_cache *cache) void fld_cache_entry_delete(struct fld_cache *cache, struct fld_cache_entry *node) { - cfs_list_del(&node->fce_list); - cfs_list_del(&node->fce_lru); + list_del(&node->fce_list); + list_del(&node->fce_lru); cache->fci_cache_count--; OBD_FREE_PTR(node); } @@ -142,12 +142,12 @@ static void fld_fix_new_list(struct fld_cache *cache) struct fld_cache_entry *f_next; struct lu_seq_range *c_range; struct lu_seq_range *n_range; - cfs_list_t *head = &cache->fci_entries_head; + struct list_head *head = &cache->fci_entries_head; ENTRY; restart_fixup: - cfs_list_for_each_entry_safe(f_curr, f_next, head, fce_list) { + list_for_each_entry_safe(f_curr, f_next, head, fce_list) { c_range = &f_curr->fce_range; n_range = &f_next->fce_range; @@ -205,13 +205,13 @@ restart_fixup: */ static inline void fld_cache_entry_add(struct fld_cache *cache, struct fld_cache_entry *f_new, - cfs_list_t *pos) + struct list_head *pos) { - cfs_list_add(&f_new->fce_list, pos); - cfs_list_add(&f_new->fce_lru, &cache->fci_lru); + list_add(&f_new->fce_list, pos); + list_add(&f_new->fce_lru, &cache->fci_lru); - cache->fci_cache_count++; - fld_fix_new_list(cache); + cache->fci_cache_count++; + fld_fix_new_list(cache); } /** @@ -221,7 +221,7 @@ static inline void fld_cache_entry_add(struct fld_cache *cache, static int fld_cache_shrink(struct fld_cache *cache) { struct fld_cache_entry *flde; - cfs_list_t *curr; + struct list_head *curr; int num = 0; ENTRY; @@ -235,7 +235,7 @@ static int fld_cache_shrink(struct fld_cache *cache) while (cache->fci_cache_count + cache->fci_threshold > cache->fci_cache_size && curr != &cache->fci_lru) { - flde = cfs_list_entry(curr, struct fld_cache_entry, fce_lru); + flde = list_entry(curr, struct fld_cache_entry, fce_lru); curr = curr->prev; fld_cache_entry_delete(cache, flde); num++; @@ -396,8 +396,8 @@ int fld_cache_insert_nolock(struct fld_cache *cache, { struct fld_cache_entry *f_curr; struct fld_cache_entry *n; - cfs_list_t *head; - cfs_list_t *prev = NULL; + struct list_head *head; + struct list_head *prev = NULL; const seqno_t new_start = f_new->fce_range.lsr_start; const seqno_t new_end = f_new->fce_range.lsr_end; __u32 new_flags = f_new->fce_range.lsr_flags; @@ -414,7 +414,7 @@ int fld_cache_insert_nolock(struct fld_cache *cache, head = &cache->fci_entries_head; - cfs_list_for_each_entry_safe(f_curr, n, head, fce_list) { + list_for_each_entry_safe(f_curr, n, head, fce_list) { /* add list if next is end of list */ if (new_end < f_curr->fce_range.lsr_start || (new_end == f_curr->fce_range.lsr_start && @@ -464,10 +464,10 @@ void fld_cache_delete_nolock(struct fld_cache *cache, { struct fld_cache_entry *flde; struct fld_cache_entry *tmp; - cfs_list_t *head; + struct list_head *head; head = &cache->fci_entries_head; - cfs_list_for_each_entry_safe(flde, tmp, head, fce_list) { + list_for_each_entry_safe(flde, tmp, head, fce_list) { /* add list if next is end of list */ if (range->lsr_start == flde->fce_range.lsr_start || (range->lsr_end == flde->fce_range.lsr_end && @@ -496,10 +496,10 @@ fld_cache_entry_lookup_nolock(struct fld_cache *cache, { struct fld_cache_entry *flde; struct fld_cache_entry *got = NULL; - cfs_list_t *head; + struct list_head *head; head = &cache->fci_entries_head; - cfs_list_for_each_entry(flde, head, fce_list) { + list_for_each_entry(flde, head, fce_list) { if (range->lsr_start == flde->fce_range.lsr_start || (range->lsr_end == flde->fce_range.lsr_end && range->lsr_flags == flde->fce_range.lsr_flags)) { @@ -536,14 +536,14 @@ int fld_cache_lookup(struct fld_cache *cache, { struct fld_cache_entry *flde; struct fld_cache_entry *prev = NULL; - cfs_list_t *head; + struct list_head *head; ENTRY; read_lock(&cache->fci_lock); head = &cache->fci_entries_head; cache->fci_stat.fst_count++; - cfs_list_for_each_entry(flde, head, fce_list) { + list_for_each_entry(flde, head, fce_list) { if (flde->fce_range.lsr_start > seq) { if (prev != NULL) *range = prev->fce_range; diff --git a/lustre/fld/fld_internal.h b/lustre/fld/fld_internal.h index 6b9c353..515cf88 100644 --- a/lustre/fld/fld_internal.h +++ b/lustre/fld/fld_internal.h @@ -68,11 +68,11 @@ struct lu_fld_hash { }; struct fld_cache_entry { - cfs_list_t fce_lru; - cfs_list_t fce_list; - /** - * fld cache entries are sorted on range->lsr_start field. */ - struct lu_seq_range fce_range; + struct list_head fce_lru; + struct list_head fce_list; + /** + * fld cache entries are sorted on range->lsr_start field. */ + struct lu_seq_range fce_range; }; struct fld_cache { @@ -96,11 +96,11 @@ struct fld_cache { /** * LRU list fld entries. */ - cfs_list_t fci_lru; + struct list_head fci_lru; /** * sorted fld entries. */ - cfs_list_t fci_entries_head; + struct list_head fci_entries_head; /** * Cache statistics. */ diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 92e47ff..806a090 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -85,7 +85,7 @@ fld_rrb_scan(struct lu_client_fld *fld, seqno_t seq) hash = 0; again: - cfs_list_for_each_entry(target, &fld->lcf_targets, ft_chain) { + list_for_each_entry(target, &fld->lcf_targets, ft_chain) { if (target->ft_idx == hash) RETURN(target); } @@ -102,7 +102,7 @@ again: "Targets (%d):\n", fld->lcf_name, hash, seq, fld->lcf_count); - cfs_list_for_each_entry(target, &fld->lcf_targets, ft_chain) { + list_for_each_entry(target, &fld->lcf_targets, ft_chain) { const char *srv_name = target->ft_srv != NULL ? target->ft_srv->lsf_name : ""; const char *exp_name = target->ft_exp != NULL ? @@ -185,7 +185,7 @@ int fld_client_add_target(struct lu_client_fld *fld, RETURN(-ENOMEM); spin_lock(&fld->lcf_lock); - cfs_list_for_each_entry(tmp, &fld->lcf_targets, ft_chain) { + list_for_each_entry(tmp, &fld->lcf_targets, ft_chain) { if (tmp->ft_idx == tar->ft_idx) { spin_unlock(&fld->lcf_lock); OBD_FREE_PTR(target); @@ -201,8 +201,7 @@ int fld_client_add_target(struct lu_client_fld *fld, target->ft_srv = tar->ft_srv; target->ft_idx = tar->ft_idx; - cfs_list_add_tail(&target->ft_chain, - &fld->lcf_targets); + list_add_tail(&target->ft_chain, &fld->lcf_targets); fld->lcf_count++; spin_unlock(&fld->lcf_lock); @@ -218,11 +217,10 @@ int fld_client_del_target(struct lu_client_fld *fld, __u64 idx) ENTRY; spin_lock(&fld->lcf_lock); - cfs_list_for_each_entry_safe(target, tmp, - &fld->lcf_targets, ft_chain) { + list_for_each_entry_safe(target, tmp, &fld->lcf_targets, ft_chain) { if (target->ft_idx == idx) { fld->lcf_count--; - cfs_list_del(&target->ft_chain); + list_del(&target->ft_chain); spin_unlock(&fld->lcf_lock); if (target->ft_exp != NULL) @@ -319,7 +317,7 @@ int fld_client_init(struct lu_client_fld *fld, spin_lock_init(&fld->lcf_lock); fld->lcf_hash = &fld_hash[hash]; fld->lcf_flags = LUSTRE_FLD_INIT; - CFS_INIT_LIST_HEAD(&fld->lcf_targets); + INIT_LIST_HEAD(&fld->lcf_targets); cache_size = FLD_CLIENT_CACHE_SIZE / sizeof(struct fld_cache_entry); @@ -355,10 +353,9 @@ void fld_client_fini(struct lu_client_fld *fld) ENTRY; spin_lock(&fld->lcf_lock); - cfs_list_for_each_entry_safe(target, tmp, - &fld->lcf_targets, ft_chain) { + list_for_each_entry_safe(target, tmp, &fld->lcf_targets, ft_chain) { fld->lcf_count--; - cfs_list_del(&target->ft_chain); + list_del(&target->ft_chain); if (target->ft_exp != NULL) class_export_put(target->ft_exp); OBD_FREE_PTR(target); diff --git a/lustre/fld/lproc_fld.c b/lustre/fld/lproc_fld.c index caf3c1a..873fa23 100644 --- a/lustre/fld/lproc_fld.c +++ b/lustre/fld/lproc_fld.c @@ -68,9 +68,8 @@ fld_proc_targets_seq_show(struct seq_file *m, void *unused) LASSERT(fld != NULL); spin_lock(&fld->lcf_lock); - cfs_list_for_each_entry(target, - &fld->lcf_targets, ft_chain) - seq_printf(m, "%s\n", fld_target_name(target)); + list_for_each_entry(target, &fld->lcf_targets, ft_chain) + seq_printf(m, "%s\n", fld_target_name(target)); spin_unlock(&fld->lcf_lock); RETURN(0); } diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index 68c5cc6..ee1089a 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -95,7 +95,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, struct ptlrpc_request **req, __u64 extra_lock_flags); int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, - cfs_list_t *cancels, ldlm_mode_t mode, + struct list_head *cancels, ldlm_mode_t mode, __u64 bits); /* mdc/mdc_request.c */ int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid, @@ -165,7 +165,7 @@ ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags, static inline int mdc_prep_elc_req(struct obd_export *exp, struct ptlrpc_request *req, int opc, - cfs_list_t *cancels, int count) + struct list_head *cancels, int count) { return ldlm_prep_elc_req(exp, req, LUSTRE_MDS_VERSION, opc, 0, cancels, count); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index ffc49c3..2b5babb 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -272,7 +272,7 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp, struct ptlrpc_request *req; struct obd_device *obddev = class_exp2obd(exp); struct ldlm_intent *lit; - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); int count = 0; int mode; int rc; @@ -367,7 +367,7 @@ mdc_intent_getxattr_pack(struct obd_export *exp, struct ptlrpc_request *req; struct ldlm_intent *lit; int rc, count = 0, maxdata; - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); ENTRY; diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index a233011..e9ad092 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -71,7 +71,7 @@ static int mdc_reint(struct ptlrpc_request *request, * found by @fid. Found locks are added into @cancel list. Returns the amount of * locks added to @cancels list. */ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, - cfs_list_t *cancels, ldlm_mode_t mode, + struct list_head *cancels, ldlm_mode_t mode, __u64 bits) { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; @@ -109,7 +109,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, void *ea, int ealen, void *ea2, int ea2len, struct ptlrpc_request **request, struct md_open_data **mod) { - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); struct ptlrpc_request *req; struct mdc_rpc_lock *rpc_lock; struct obd_device *obd = exp->exp_obd; @@ -222,7 +222,7 @@ int mdc_create(struct obd_export *exp, struct md_op_data *op_data, int count, resends = 0; struct obd_import *import = exp->exp_obd->u.cli.cl_import; int generation = import->imp_generation; - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); ENTRY; /* For case if upper layer did not alloc fid, do it now. */ @@ -327,7 +327,7 @@ rebuild: int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request) { - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req = *request; int count = 0, rc; @@ -382,7 +382,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data, int mdc_link(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request) { - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); struct obd_device *obd = exp->exp_obd; struct ptlrpc_request *req; int count = 0, rc; @@ -430,7 +430,7 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data, const char *old, int oldlen, const char *new, int newlen, struct ptlrpc_request **request) { - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); struct obd_device *obd = exp->exp_obd; struct ptlrpc_request *req; int count = 0, rc; diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 92f0332..7610e59 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -374,7 +374,7 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt, /* Flush local XATTR locks to get rid of a possible cancel RPC */ if (opcode == MDS_REINT && fid_is_sane(fid) && exp->exp_connect_data.ocd_ibits_known & MDS_INODELOCK_XATTR) { - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); int count; /* Without that packing would fail */ @@ -2407,7 +2407,7 @@ static int mdc_quotactl(struct obd_device *unused, struct obd_export *exp, static int mdc_ioc_swap_layouts(struct obd_export *exp, struct md_op_data *op_data) { - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); struct ptlrpc_request *req; int rc, count; struct mdc_swap_layouts *msl, *payload; diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 52d0f37..c2ecb07 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -113,7 +113,7 @@ int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id, int type) } /********************** config llog list **********************/ -static CFS_LIST_HEAD(config_llog_list); +static struct list_head config_llog_list = LIST_HEAD_INIT(config_llog_list); static DEFINE_SPINLOCK(config_list_lock); /* Take a reference to a config log */ @@ -138,7 +138,7 @@ static void config_log_put(struct config_llog_data *cld) /* spinlock to make sure no item with 0 refcount in the list */ if (atomic_dec_and_lock(&cld->cld_refcount, &config_list_lock)) { - cfs_list_del(&cld->cld_list_chain); + list_del(&cld->cld_list_chain); spin_unlock(&config_list_lock); CDEBUG(D_MGC, "dropping config log %s\n", cld->cld_logname); @@ -173,7 +173,7 @@ struct config_llog_data *config_log_find(char *logname, instance = cfg ? cfg->cfg_instance : NULL; spin_lock(&config_list_lock); - cfs_list_for_each_entry(cld, &config_llog_list, cld_list_chain) { + list_for_each_entry(cld, &config_llog_list, cld_list_chain) { /* check if instance equals */ if (instance != cld->cld_cfg.cfg_instance) continue; @@ -233,7 +233,7 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, rc = mgc_logname2resid(logname, &cld->cld_resid, type); spin_lock(&config_list_lock); - cfs_list_add(&cld->cld_list_chain, &config_llog_list); + list_add(&cld->cld_list_chain, &config_llog_list); spin_unlock(&config_list_lock); if (rc) { @@ -476,7 +476,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) seq_printf(m, "client_state:\n"); spin_lock(&config_list_lock); - cfs_list_for_each_entry(cld, &config_llog_list, cld_list_chain) { + list_for_each_entry(cld, &config_llog_list, cld_list_chain) { if (cld->cld_recover == NULL) continue; seq_printf(m, " - { client: %s, nidtbl_version: %u }\n", @@ -570,7 +570,7 @@ static int mgc_requeue_thread(void *data) cld_prev = NULL; spin_lock(&config_list_lock); - cfs_list_for_each_entry(cld, &config_llog_list, + list_for_each_entry(cld, &config_llog_list, cld_list_chain) { if (!cld->cld_lostlock) continue; diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 7c47536..5b94f37 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -92,9 +92,9 @@ static inline char *ext_flags(struct osc_extent *ext, char *flags) return flags; } -static inline char list_empty_marker(cfs_list_t *list) +static inline char list_empty_marker(struct list_head *list) { - return cfs_list_empty(list) ? '-' : '+'; + return list_empty(list) ? '-' : '+'; } #define EXTSTR "[%lu -> %lu/%lu]" @@ -192,7 +192,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, switch (ext->oe_state) { case OES_INV: - if (ext->oe_nr_pages > 0 || !cfs_list_empty(&ext->oe_pages)) + if (ext->oe_nr_pages > 0 || !list_empty(&ext->oe_pages)) GOTO(out, rc = 35); GOTO(out, rc = 0); break; @@ -240,7 +240,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, GOTO(out, rc = 0); page_count = 0; - cfs_list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { + list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { pgoff_t index = osc_index(oap2osc(oap)); ++page_count; if (index > ext->oe_end || index < ext->oe_start) @@ -317,9 +317,9 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj) ext->oe_obj = obj; atomic_set(&ext->oe_refc, 1); atomic_set(&ext->oe_users, 0); - CFS_INIT_LIST_HEAD(&ext->oe_link); + INIT_LIST_HEAD(&ext->oe_link); ext->oe_state = OES_INV; - CFS_INIT_LIST_HEAD(&ext->oe_pages); + INIT_LIST_HEAD(&ext->oe_pages); init_waitqueue_head(&ext->oe_waitq); ext->oe_osclock = NULL; @@ -342,7 +342,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) { LASSERT(atomic_read(&ext->oe_refc) > 0); if (atomic_dec_and_test(&ext->oe_refc)) { - LASSERT(cfs_list_empty(&ext->oe_link)); + LASSERT(list_empty(&ext->oe_link)); LASSERT(atomic_read(&ext->oe_users) == 0); LASSERT(ext->oe_state == OES_INV); LASSERT(!ext->oe_intree); @@ -458,16 +458,16 @@ static struct osc_extent *osc_extent_hold(struct osc_extent *ext) osc_update_pending(obj, OBD_BRW_WRITE, -ext->oe_nr_pages); } atomic_inc(&ext->oe_users); - cfs_list_del_init(&ext->oe_link); + list_del_init(&ext->oe_link); return osc_extent_get(ext); } static void __osc_extent_remove(struct osc_extent *ext) { LASSERT(osc_object_is_locked(ext->oe_obj)); - LASSERT(cfs_list_empty(&ext->oe_pages)); + LASSERT(list_empty(&ext->oe_pages)); osc_extent_erase(ext); - cfs_list_del_init(&ext->oe_link); + list_del_init(&ext->oe_link); osc_extent_state_set(ext, OES_INV); OSC_EXTENT_DUMP(D_CACHE, ext, "destroyed.\n"); } @@ -521,8 +521,8 @@ static int osc_extent_merge(const struct lu_env *env, struct osc_extent *cur, /* only the following bits are needed to merge */ cur->oe_urgent |= victim->oe_urgent; cur->oe_memalloc |= victim->oe_memalloc; - cfs_list_splice_init(&victim->oe_pages, &cur->oe_pages); - cfs_list_del_init(&victim->oe_link); + list_splice_init(&victim->oe_pages, &cur->oe_pages); + list_del_init(&victim->oe_link); victim->oe_nr_pages = 0; osc_extent_get(victim); @@ -564,8 +564,8 @@ int osc_extent_release(const struct lu_env *env, struct osc_extent *ext) osc_extent_merge(env, ext, next_extent(ext)); if (ext->oe_urgent) - cfs_list_move_tail(&ext->oe_link, - &obj->oo_urgent_exts); + list_move_tail(&ext->oe_link, + &obj->oo_urgent_exts); } osc_object_unlock(obj); @@ -813,10 +813,10 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, EASSERT(ergo(rc == 0, ext->oe_state == OES_RPC), ext); osc_lru_add_batch(cli, &ext->oe_pages); - cfs_list_for_each_entry_safe(oap, tmp, &ext->oe_pages, + list_for_each_entry_safe(oap, tmp, &ext->oe_pages, oap_pending_item) { - cfs_list_del_init(&oap->oap_rpc_item); - cfs_list_del_init(&oap->oap_pending_item); + list_del_init(&oap->oap_rpc_item); + list_del_init(&oap->oap_pending_item); if (last_off <= oap->oap_obj_off) { last_off = oap->oap_obj_off; last_count = oap->oap_count; @@ -945,12 +945,12 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, GOTO(out, rc); /* discard all pages with index greater then trunc_index */ - cfs_list_for_each_entry_safe(oap, tmp, &ext->oe_pages, + list_for_each_entry_safe(oap, tmp, &ext->oe_pages, oap_pending_item) { pgoff_t index = osc_index(oap2osc(oap)); struct cl_page *page = oap2cl_page(oap); - LASSERT(cfs_list_empty(&oap->oap_rpc_item)); + LASSERT(list_empty(&oap->oap_rpc_item)); /* only discard the pages with their index greater than * trunc_index, and ... */ @@ -963,7 +963,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, continue; } - cfs_list_del_init(&oap->oap_pending_item); + list_del_init(&oap->oap_pending_item); cl_page_get(page); lu_ref_add(&page->cp_reference, "truncate", current); @@ -1048,7 +1048,7 @@ static int osc_extent_make_ready(const struct lu_env *env, OSC_EXTENT_DUMP(D_CACHE, ext, "make ready\n"); - cfs_list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { + list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { ++page_count; if (last == NULL || last->oap_obj_off < oap->oap_obj_off) last = oap; @@ -1087,7 +1087,7 @@ static int osc_extent_make_ready(const struct lu_env *env, /* for the rest of pages, we don't need to call osf_refresh_count() * because it's known they are not the last page */ - cfs_list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { + list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { if (!(oap->oap_async_flags & ASYNC_COUNT_STABLE)) { oap->oap_count = PAGE_CACHE_SIZE - oap->oap_page_off; spin_lock(&oap->oap_lock); @@ -1171,15 +1171,15 @@ static void osc_extent_tree_dump0(int level, struct osc_object *obj, OSC_EXTENT_DUMP(level, ext, "in tree %d.\n", cnt++); cnt = 1; - cfs_list_for_each_entry(ext, &obj->oo_hp_exts, oe_link) + list_for_each_entry(ext, &obj->oo_hp_exts, oe_link) OSC_EXTENT_DUMP(level, ext, "hp %d.\n", cnt++); cnt = 1; - cfs_list_for_each_entry(ext, &obj->oo_urgent_exts, oe_link) + list_for_each_entry(ext, &obj->oo_urgent_exts, oe_link) OSC_EXTENT_DUMP(level, ext, "urgent %d.\n", cnt++); cnt = 1; - cfs_list_for_each_entry(ext, &obj->oo_reading_exts, oe_link) + list_for_each_entry(ext, &obj->oo_reading_exts, oe_link) OSC_EXTENT_DUMP(level, ext, "reading %d.\n", cnt++); /* osc_object_unlock(obj); */ } @@ -1188,8 +1188,8 @@ static void osc_extent_tree_dump0(int level, struct osc_object *obj, static inline int osc_is_ready(struct osc_object *osc) { - return !cfs_list_empty(&osc->oo_ready_item) || - !cfs_list_empty(&osc->oo_hp_ready_item); + return !list_empty(&osc->oo_ready_item) || + !list_empty(&osc->oo_hp_ready_item); } #define OSC_IO_DEBUG(OSC, STR, args...) \ @@ -1284,8 +1284,8 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, spin_lock(&obj->oo_seatbelt); LASSERT(opg->ops_submitter != NULL); - LASSERT(!cfs_list_empty(&opg->ops_inflight)); - cfs_list_del_init(&opg->ops_inflight); + LASSERT(!list_empty(&opg->ops_inflight)); + list_del_init(&opg->ops_inflight); opg->ops_submitter = NULL; spin_unlock(&obj->oo_seatbelt); @@ -1498,7 +1498,7 @@ static int ocw_granted(struct client_obd *cli, struct osc_cache_waiter *ocw) { int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = cfs_list_empty(&ocw->ocw_entry); + rc = list_empty(&ocw->ocw_entry); client_obd_list_unlock(&cli->cl_loi_list_lock); return rc; } @@ -1546,7 +1546,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, ocw.ocw_oap = oap; ocw.ocw_grant = bytes; while (cli->cl_dirty > 0 || cli->cl_w_in_flight > 0) { - cfs_list_add_tail(&ocw.ocw_entry, &cli->cl_cache_waiters); + list_add_tail(&ocw.ocw_entry, &cli->cl_cache_waiters); ocw.ocw_rc = 0; client_obd_list_unlock(&cli->cl_loi_list_lock); @@ -1579,11 +1579,11 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, &ocw, rc); break; } - cfs_list_del_init(&ocw.ocw_entry); + list_del_init(&ocw.ocw_entry); GOTO(out, rc); } - LASSERT(cfs_list_empty(&ocw.ocw_entry)); + LASSERT(list_empty(&ocw.ocw_entry)); rc = ocw.ocw_rc; if (rc != -EDQUOT) @@ -1601,13 +1601,13 @@ out: /* caller must hold loi_list_lock */ void osc_wake_cache_waiters(struct client_obd *cli) { - cfs_list_t *l, *tmp; + struct list_head *l, *tmp; struct osc_cache_waiter *ocw; ENTRY; - cfs_list_for_each_safe(l, tmp, &cli->cl_cache_waiters) { - ocw = cfs_list_entry(l, struct osc_cache_waiter, ocw_entry); - cfs_list_del_init(&ocw->ocw_entry); + list_for_each_safe(l, tmp, &cli->cl_cache_waiters) { + ocw = list_entry(l, struct osc_cache_waiter, ocw_entry); + list_del_init(&ocw->ocw_entry); ocw->ocw_rc = -EDQUOT; /* we can't dirty more */ @@ -1636,7 +1636,7 @@ wakeup: static int osc_max_rpc_in_flight(struct client_obd *cli, struct osc_object *osc) { - int hprpc = !!cfs_list_empty(&osc->oo_hp_exts); + int hprpc = !!list_empty(&osc->oo_hp_exts); return rpcs_in_flight(cli) >= cli->cl_max_rpcs_in_flight + hprpc; } @@ -1663,18 +1663,18 @@ static int osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, CDEBUG(D_CACHE, "invalid import forcing RPC\n"); RETURN(1); } - if (!cfs_list_empty(&osc->oo_hp_exts)) { + if (!list_empty(&osc->oo_hp_exts)) { CDEBUG(D_CACHE, "high prio request forcing RPC\n"); RETURN(1); } - if (!cfs_list_empty(&osc->oo_urgent_exts)) { + if (!list_empty(&osc->oo_urgent_exts)) { CDEBUG(D_CACHE, "urgent request forcing RPC\n"); RETURN(1); } /* trigger a write rpc stream as long as there are dirtiers * waiting for space. as they're waiting, they're not going to * create more pages to coalesce with what's waiting.. */ - if (!cfs_list_empty(&cli->cl_cache_waiters)) { + if (!list_empty(&cli->cl_cache_waiters)) { CDEBUG(D_CACHE, "cache waiters forcing RPC\n"); RETURN(1); } @@ -1689,7 +1689,7 @@ static int osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, RETURN(1); } /* all read are urgent. */ - if (!cfs_list_empty(&osc->oo_reading_exts)) + if (!list_empty(&osc->oo_reading_exts)) RETURN(1); } @@ -1713,15 +1713,16 @@ static void osc_update_pending(struct osc_object *obj, int cmd, int delta) static int osc_makes_hprpc(struct osc_object *obj) { - return !cfs_list_empty(&obj->oo_hp_exts); + return !list_empty(&obj->oo_hp_exts); } -static void on_list(cfs_list_t *item, cfs_list_t *list, int should_be_on) +static void on_list(struct list_head *item, struct list_head *list, + int should_be_on) { - if (cfs_list_empty(item) && should_be_on) - cfs_list_add_tail(item, list); - else if (!cfs_list_empty(item) && !should_be_on) - cfs_list_del_init(item); + if (list_empty(item) && should_be_on) + list_add_tail(item, list); + else if (!list_empty(item) && !should_be_on) + list_del_init(item); } /* maintain the osc's cli list membership invariants so that osc_send_oap_rpc @@ -1901,7 +1902,8 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, * - extent must be compatible with previous ones */ static int try_to_add_extent_for_io(struct client_obd *cli, - struct osc_extent *ext, cfs_list_t *rpclist, + struct osc_extent *ext, + struct list_head *rpclist, int *pc, unsigned int *max_pages) { struct osc_extent *tmp; @@ -1914,7 +1916,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli, if (*pc + ext->oe_nr_pages > *max_pages) RETURN(0); - cfs_list_for_each_entry(tmp, rpclist, oe_link) { + list_for_each_entry(tmp, rpclist, oe_link) { EASSERT(tmp->oe_owner == current, tmp); #if 0 if (overlapped(tmp, ext)) { @@ -1932,7 +1934,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli, } *pc += ext->oe_nr_pages; - cfs_list_move_tail(&ext->oe_link, rpclist); + list_move_tail(&ext->oe_link, rpclist); ext->oe_owner = current; RETURN(1); } @@ -1950,7 +1952,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli, * 5. Traverse the extent tree from the 1st extent; * 6. Above steps exit if there is no space in this RPC. */ -static int get_write_extents(struct osc_object *obj, cfs_list_t *rpclist) +static int get_write_extents(struct osc_object *obj, struct list_head *rpclist) { struct client_obd *cli = osc_cli(obj); struct osc_extent *ext; @@ -1958,9 +1960,9 @@ static int get_write_extents(struct osc_object *obj, cfs_list_t *rpclist) unsigned int max_pages = cli->cl_max_pages_per_rpc; LASSERT(osc_object_is_locked(obj)); - while (!cfs_list_empty(&obj->oo_hp_exts)) { - ext = cfs_list_entry(obj->oo_hp_exts.next, struct osc_extent, - oe_link); + while (!list_empty(&obj->oo_hp_exts)) { + ext = list_entry(obj->oo_hp_exts.next, struct osc_extent, + oe_link); LASSERT(ext->oe_state == OES_CACHE); if (!try_to_add_extent_for_io(cli, ext, rpclist, &page_count, &max_pages)) @@ -1970,9 +1972,9 @@ static int get_write_extents(struct osc_object *obj, cfs_list_t *rpclist) if (page_count == max_pages) return page_count; - while (!cfs_list_empty(&obj->oo_urgent_exts)) { - ext = cfs_list_entry(obj->oo_urgent_exts.next, - struct osc_extent, oe_link); + while (!list_empty(&obj->oo_urgent_exts)) { + ext = list_entry(obj->oo_urgent_exts.next, + struct osc_extent, oe_link); if (!try_to_add_extent_for_io(cli, ext, rpclist, &page_count, &max_pages)) return page_count; @@ -1982,7 +1984,7 @@ static int get_write_extents(struct osc_object *obj, cfs_list_t *rpclist) while ((ext = next_extent(ext)) != NULL) { if ((ext->oe_state != OES_CACHE) || - (!cfs_list_empty(&ext->oe_link) && + (!list_empty(&ext->oe_link) && ext->oe_owner != NULL)) continue; @@ -1998,7 +2000,7 @@ static int get_write_extents(struct osc_object *obj, cfs_list_t *rpclist) while (ext != NULL) { if ((ext->oe_state != OES_CACHE) || /* this extent may be already in current rpclist */ - (!cfs_list_empty(&ext->oe_link) && ext->oe_owner != NULL)) { + (!list_empty(&ext->oe_link) && ext->oe_owner != NULL)) { ext = next_extent(ext); continue; } @@ -2016,7 +2018,7 @@ static int osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, struct osc_object *osc, pdl_policy_t pol) { - CFS_LIST_HEAD(rpclist); + struct list_head rpclist = LIST_HEAD_INIT(rpclist); struct osc_extent *ext; struct osc_extent *tmp; struct osc_extent *first = NULL; @@ -2028,14 +2030,14 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, LASSERT(osc_object_is_locked(osc)); page_count = get_write_extents(osc, &rpclist); - LASSERT(equi(page_count == 0, cfs_list_empty(&rpclist))); + LASSERT(equi(page_count == 0, list_empty(&rpclist))); - if (cfs_list_empty(&rpclist)) + if (list_empty(&rpclist)) RETURN(0); osc_update_pending(osc, OBD_BRW_WRITE, -page_count); - cfs_list_for_each_entry(ext, &rpclist, oe_link) { + list_for_each_entry(ext, &rpclist, oe_link) { LASSERT(ext->oe_state == OES_CACHE || ext->oe_state == OES_LOCK_DONE); if (ext->oe_state == OES_CACHE) @@ -2048,11 +2050,11 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, * lock order is page lock -> object lock. */ osc_object_unlock(osc); - cfs_list_for_each_entry_safe(ext, tmp, &rpclist, oe_link) { + list_for_each_entry_safe(ext, tmp, &rpclist, oe_link) { if (ext->oe_state == OES_LOCKING) { rc = osc_extent_make_ready(env, ext); if (unlikely(rc < 0)) { - cfs_list_del_init(&ext->oe_link); + list_del_init(&ext->oe_link); osc_extent_finish(env, ext, 0, rc); continue; } @@ -2065,10 +2067,10 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, } } - if (!cfs_list_empty(&rpclist)) { + if (!list_empty(&rpclist)) { LASSERT(page_count > 0); rc = osc_build_rpc(env, cli, &rpclist, OBD_BRW_WRITE, pol); - LASSERT(cfs_list_empty(&rpclist)); + LASSERT(list_empty(&rpclist)); } osc_object_lock(osc); @@ -2091,14 +2093,14 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, { struct osc_extent *ext; struct osc_extent *next; - CFS_LIST_HEAD(rpclist); + struct list_head rpclist = LIST_HEAD_INIT(rpclist); int page_count = 0; unsigned int max_pages = cli->cl_max_pages_per_rpc; int rc = 0; ENTRY; LASSERT(osc_object_is_locked(osc)); - cfs_list_for_each_entry_safe(ext, next, + list_for_each_entry_safe(ext, next, &osc->oo_reading_exts, oe_link) { EASSERT(ext->oe_state == OES_LOCK_DONE, ext); if (!try_to_add_extent_for_io(cli, ext, &rpclist, &page_count, @@ -2111,12 +2113,12 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, osc_update_pending(osc, OBD_BRW_READ, -page_count); - if (!cfs_list_empty(&rpclist)) { + if (!list_empty(&rpclist)) { osc_object_unlock(osc); LASSERT(page_count > 0); rc = osc_build_rpc(env, cli, &rpclist, OBD_BRW_READ, pol); - LASSERT(cfs_list_empty(&rpclist)); + LASSERT(list_empty(&rpclist)); osc_object_lock(osc); } @@ -2124,9 +2126,9 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, } #define list_to_obj(list, item) ({ \ - cfs_list_t *__tmp = (list)->next; \ - cfs_list_del_init(__tmp); \ - cfs_list_entry(__tmp, struct osc_object, oo_##item); \ + struct list_head *__tmp = (list)->next; \ + list_del_init(__tmp); \ + list_entry(__tmp, struct osc_object, oo_##item); \ }) /* This is called by osc_check_rpcs() to find which objects have pages that @@ -2138,26 +2140,26 @@ static struct osc_object *osc_next_obj(struct client_obd *cli) /* First return objects that have blocked locks so that they * will be flushed quickly and other clients can get the lock, * then objects which have pages ready to be stuffed into RPCs */ - if (!cfs_list_empty(&cli->cl_loi_hp_ready_list)) + if (!list_empty(&cli->cl_loi_hp_ready_list)) RETURN(list_to_obj(&cli->cl_loi_hp_ready_list, hp_ready_item)); - if (!cfs_list_empty(&cli->cl_loi_ready_list)) + if (!list_empty(&cli->cl_loi_ready_list)) RETURN(list_to_obj(&cli->cl_loi_ready_list, ready_item)); /* then if we have cache waiters, return all objects with queued * writes. This is especially important when many small files * have filled up the cache and not been fired into rpcs because * they don't pass the nr_pending/object threshhold */ - if (!cfs_list_empty(&cli->cl_cache_waiters) && - !cfs_list_empty(&cli->cl_loi_write_list)) + if (!list_empty(&cli->cl_cache_waiters) && + !list_empty(&cli->cl_loi_write_list)) RETURN(list_to_obj(&cli->cl_loi_write_list, write_item)); /* then return all queued objects when we have an invalid import * so that they get flushed */ if (cli->cl_import == NULL || cli->cl_import->imp_invalid) { - if (!cfs_list_empty(&cli->cl_loi_write_list)) + if (!list_empty(&cli->cl_loi_write_list)) RETURN(list_to_obj(&cli->cl_loi_write_list, write_item)); - if (!cfs_list_empty(&cli->cl_loi_read_list)) + if (!list_empty(&cli->cl_loi_read_list)) RETURN(list_to_obj(&cli->cl_loi_read_list, read_item)); } @@ -2291,8 +2293,8 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, if (!client_is_remote(exp) && cfs_capable(CFS_CAP_SYS_RESOURCE)) oap->oap_brw_flags = OBD_BRW_NOQUOTA; - CFS_INIT_LIST_HEAD(&oap->oap_pending_item); - CFS_INIT_LIST_HEAD(&oap->oap_rpc_item); + INIT_LIST_HEAD(&oap->oap_pending_item); + INIT_LIST_HEAD(&oap->oap_rpc_item); spin_lock_init(&oap->oap_lock); CDEBUG(D_INFO, "oap %p page %p obj off "LPU64"\n", @@ -2322,8 +2324,8 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, if (cli->cl_import == NULL || cli->cl_import->imp_invalid) RETURN(-EIO); - if (!cfs_list_empty(&oap->oap_pending_item) || - !cfs_list_empty(&oap->oap_rpc_item)) + if (!list_empty(&oap->oap_pending_item) || + !list_empty(&oap->oap_rpc_item)) RETURN(-EBUSY); /* Set the OBD_BRW_SRVLOCK before the page is queued. */ @@ -2462,7 +2464,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, else LASSERT(ext->oe_srvlock == ops->ops_srvlock); ++ext->oe_nr_pages; - cfs_list_add_tail(&oap->oap_pending_item, &ext->oe_pages); + list_add_tail(&oap->oap_pending_item, &ext->oe_pages); osc_object_unlock(osc); } RETURN(rc); @@ -2482,10 +2484,10 @@ int osc_teardown_async_page(const struct lu_env *env, oap, ops, osc_index(oap2osc(oap))); osc_object_lock(obj); - if (!cfs_list_empty(&oap->oap_rpc_item)) { + if (!list_empty(&oap->oap_rpc_item)) { CDEBUG(D_CACHE, "oap %p is not in cache.\n", oap); rc = -EBUSY; - } else if (!cfs_list_empty(&oap->oap_pending_item)) { + } else if (!list_empty(&oap->oap_pending_item)) { ext = osc_extent_lookup(obj, osc_index(oap2osc(oap))); /* only truncated pages are allowed to be taken out. * See osc_extent_truncate() and osc_cache_truncate_start() @@ -2569,8 +2571,8 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, if (ext->oe_state == OES_CACHE) { OSC_EXTENT_DUMP(D_CACHE, ext, "flush page %p make it urgent.\n", oap); - if (cfs_list_empty(&ext->oe_link)) - cfs_list_add_tail(&ext->oe_link, &obj->oo_urgent_exts); + if (list_empty(&ext->oe_link)) + list_add_tail(&ext->oe_link, &obj->oo_urgent_exts); unplug = true; } rc = 0; @@ -2598,7 +2600,7 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) struct client_obd *cli = osc_cli(obj); struct osc_extent *ext; struct osc_extent *found = NULL; - cfs_list_t *plist; + struct list_head *plist; pgoff_t index = osc_index(ops); int rc = -EBUSY; int cmd; @@ -2616,7 +2618,7 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) plist = &obj->oo_reading_exts; cmd = OBD_BRW_READ; } - cfs_list_for_each_entry(ext, plist, oe_link) { + list_for_each_entry(ext, plist, oe_link) { if (ext->oe_start <= index && ext->oe_end >= index) { LASSERT(ext->oe_state == OES_LOCK_DONE); /* For OES_LOCK_DONE state extent, it has already held @@ -2626,7 +2628,7 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) } } if (found != NULL) { - cfs_list_del_init(&found->oe_link); + list_del_init(&found->oe_link); osc_update_pending(obj, cmd, -found->oe_nr_pages); osc_object_unlock(obj); @@ -2650,7 +2652,7 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) } int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, - cfs_list_t *list, int cmd, int brw_flags) + struct list_head *list, int cmd, int brw_flags) { struct client_obd *cli = osc_cli(obj); struct osc_extent *ext; @@ -2661,7 +2663,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, pgoff_t end = 0; ENTRY; - cfs_list_for_each_entry(oap, list, oap_pending_item) { + list_for_each_entry(oap, list, oap_pending_item) { pgoff_t index = osc_index(oap2osc(oap)); if (index > end) end = index; @@ -2673,8 +2675,8 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, ext = osc_extent_alloc(obj); if (ext == NULL) { - cfs_list_for_each_entry(oap, list, oap_pending_item) { - cfs_list_del_init(&oap->oap_pending_item); + list_for_each_entry(oap, list, oap_pending_item) { + list_del_init(&oap->oap_pending_item); osc_ap_completion(env, cli, oap, 0, -ENOMEM); } RETURN(-ENOMEM); @@ -2688,16 +2690,16 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, ext->oe_srvlock = !!(brw_flags & OBD_BRW_SRVLOCK); ext->oe_nr_pages = page_count; ext->oe_mppr = mppr; - cfs_list_splice_init(list, &ext->oe_pages); + list_splice_init(list, &ext->oe_pages); osc_object_lock(obj); /* Reuse the initial refcount for RPC, don't drop it */ osc_extent_state_set(ext, OES_LOCK_DONE); if (cmd & OBD_BRW_WRITE) { - cfs_list_add_tail(&ext->oe_link, &obj->oo_urgent_exts); + list_add_tail(&ext->oe_link, &obj->oo_urgent_exts); osc_update_pending(obj, OBD_BRW_WRITE, page_count); } else { - cfs_list_add_tail(&ext->oe_link, &obj->oo_reading_exts); + list_add_tail(&ext->oe_link, &obj->oo_reading_exts); osc_update_pending(obj, OBD_BRW_READ, page_count); } osc_object_unlock(obj); @@ -2716,7 +2718,7 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_io *oio, struct osc_extent *ext; struct osc_extent *waiting = NULL; pgoff_t index; - CFS_LIST_HEAD(list); + struct list_head list = LIST_HEAD_INIT(list); int result = 0; bool partial; ENTRY; @@ -2763,8 +2765,8 @@ again: osc_update_pending(obj, OBD_BRW_WRITE, -ext->oe_nr_pages); } - EASSERT(cfs_list_empty(&ext->oe_link), ext); - cfs_list_add_tail(&ext->oe_link, &list); + EASSERT(list_empty(&ext->oe_link), ext); + list_add_tail(&ext->oe_link, &list); ext = next_extent(ext); } @@ -2772,11 +2774,11 @@ again: osc_list_maint(cli, obj); - while (!cfs_list_empty(&list)) { + while (!list_empty(&list)) { int rc; - ext = cfs_list_entry(list.next, struct osc_extent, oe_link); - cfs_list_del_init(&ext->oe_link); + ext = list_entry(list.next, struct osc_extent, oe_link); + list_del_init(&ext->oe_link); /* extent may be in OES_ACTIVE state because inode mutex * is released before osc_io_end() in file write case */ @@ -2849,7 +2851,7 @@ void osc_cache_truncate_end(const struct lu_env *env, struct osc_io *oio, osc_extent_state_set(ext, OES_CACHE); if (ext->oe_fsync_wait && !ext->oe_urgent) { ext->oe_urgent = 1; - cfs_list_move_tail(&ext->oe_link, &obj->oo_urgent_exts); + list_move_tail(&ext->oe_link, &obj->oo_urgent_exts); unplug = true; } osc_update_pending(obj, OBD_BRW_WRITE, ext->oe_nr_pages); @@ -2930,7 +2932,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, pgoff_t start, pgoff_t end, int hp, int discard) { struct osc_extent *ext; - CFS_LIST_HEAD(discard_list); + struct list_head discard_list = LIST_HEAD_INIT(discard_list); bool unplug = false; int result = 0; ENTRY; @@ -2950,7 +2952,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, case OES_CACHE: result += ext->oe_nr_pages; if (!discard) { - cfs_list_t *list = NULL; + struct list_head *list = NULL; if (hp) { EASSERT(!ext->oe_hp, ext); ext->oe_hp = 1; @@ -2960,7 +2962,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, list = &obj->oo_urgent_exts; } if (list != NULL) - cfs_list_move_tail(&ext->oe_link, list); + list_move_tail(&ext->oe_link, list); unplug = true; } else { /* the only discarder is lock cancelling, so @@ -2969,7 +2971,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, ext->oe_max_end <= end, ext); osc_extent_state_set(ext, OES_LOCKING); ext->oe_owner = current; - cfs_list_move_tail(&ext->oe_link, + list_move_tail(&ext->oe_link, &discard_list); osc_update_pending(obj, OBD_BRW_WRITE, -ext->oe_nr_pages); @@ -2994,14 +2996,14 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, } osc_object_unlock(obj); - LASSERT(ergo(!discard, cfs_list_empty(&discard_list))); - if (!cfs_list_empty(&discard_list)) { + LASSERT(ergo(!discard, list_empty(&discard_list))); + if (!list_empty(&discard_list)) { struct osc_extent *tmp; int rc; osc_list_maint(osc_cli(obj), obj); - cfs_list_for_each_entry_safe(ext, tmp, &discard_list, oe_link) { - cfs_list_del_init(&ext->oe_link); + list_for_each_entry_safe(ext, tmp, &discard_list, oe_link) { + list_del_init(&ext->oe_link); EASSERT(ext->oe_state == OES_LOCKING, ext); /* Discard caching pages. We don't actually write this diff --git a/lustre/osc/osc_cl_internal.h b/lustre/osc/osc_cl_internal.h index 4a62b3c..3941910 100644 --- a/lustre/osc/osc_cl_internal.h +++ b/lustre/osc/osc_cl_internal.h @@ -140,21 +140,21 @@ struct osc_object { /** * List of pages in transfer. */ - cfs_list_t oo_inflight[CRT_NR]; + struct list_head oo_inflight[CRT_NR]; /** * Lock, protecting ccc_object::cob_inflight, because a seat-belt is * locked during take-off and landing. */ - spinlock_t oo_seatbelt; + spinlock_t oo_seatbelt; /** * used by the osc to keep track of what objects to build into rpcs. * Protected by client_obd->cli_loi_list_lock. */ - cfs_list_t oo_ready_item; - cfs_list_t oo_hp_ready_item; - cfs_list_t oo_write_item; - cfs_list_t oo_read_item; + struct list_head oo_ready_item; + struct list_head oo_hp_ready_item; + struct list_head oo_write_item; + struct list_head oo_read_item; /** * extent is a red black tree to manage (async) dirty pages. @@ -163,11 +163,11 @@ struct osc_object { /** * Manage write(dirty) extents. */ - cfs_list_t oo_hp_exts; /* list of hp extents */ - cfs_list_t oo_urgent_exts; /* list of writeback extents */ - cfs_list_t oo_rpc_exts; + struct list_head oo_hp_exts; /* list of hp extents */ + struct list_head oo_urgent_exts; /* list of writeback extents */ + struct list_head oo_rpc_exts; - cfs_list_t oo_reading_exts; + struct list_head oo_reading_exts; atomic_t oo_nr_reads; atomic_t oo_nr_writes; @@ -386,12 +386,12 @@ struct osc_page { /** * lru page list. See osc_lru_{del|use}() in osc_page.c for usage. */ - cfs_list_t ops_lru; + struct list_head ops_lru; /** * Linkage into a per-osc_object list of pages in flight. For * debugging. */ - cfs_list_t ops_inflight; + struct list_head ops_inflight; /** * Thread that submitted this page for transfer. For debugging. */ @@ -433,7 +433,7 @@ void osc_index2policy (ldlm_policy_data_t *policy, const struct cl_object *obj, int osc_lvb_print (const struct lu_env *env, void *cookie, lu_printer_t p, const struct ost_lvb *lvb); -void osc_lru_add_batch(struct client_obd *cli, cfs_list_t *list); +void osc_lru_add_batch(struct client_obd *cli, struct list_head *list); void osc_page_submit(const struct lu_env *env, struct osc_page *opg, enum cl_req_type crt, int brw_flags); int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops); @@ -450,7 +450,7 @@ int osc_teardown_async_page(const struct lu_env *env, struct osc_object *obj, int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, struct osc_page *ops); int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, - cfs_list_t *list, int cmd, int brw_flags); + struct list_head *list, int cmd, int brw_flags); int osc_cache_truncate_start(const struct lu_env *env, struct osc_io *oio, struct osc_object *obj, __u64 size); void osc_cache_truncate_end(const struct lu_env *env, struct osc_io *oio, @@ -630,7 +630,7 @@ struct osc_extent { /** busy if non-zero */ atomic_t oe_users; /** link list of osc_object's oo_{hp|urgent|locking}_exts. */ - cfs_list_t oe_link; + struct list_head oe_link; /** state of this extent */ unsigned int oe_state; /** flags for this extent. */ @@ -660,7 +660,7 @@ struct osc_extent { /** # of dirty pages in this extent */ unsigned int oe_nr_pages; /** list of pending oap pages. Pages in this list are NOT sorted. */ - cfs_list_t oe_pages; + struct list_head oe_pages; /** Since an extent has to be written out in atomic, this is used to * remember the next page need to be locked to write this extent out. * Not used right now. diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index 8378d0a..7c93137 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -56,8 +56,8 @@ struct osc_async_page { unsigned short oap_cmd; unsigned short oap_interrupted:1; - cfs_list_t oap_pending_item; - cfs_list_t oap_rpc_item; + struct list_head oap_pending_item; + struct list_head oap_rpc_item; obd_off oap_obj_off; unsigned oap_page_off; @@ -84,8 +84,8 @@ static inline struct osc_async_page *brw_page2oap(struct brw_page *pga) } struct osc_cache_waiter { - cfs_list_t ocw_entry; - wait_queue_head_t ocw_waitq; + struct list_head ocw_entry; + wait_queue_head_t ocw_waitq; struct osc_async_page *ocw_oap; int ocw_grant; int ocw_rc; @@ -134,7 +134,7 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo, int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *cfg); int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, - cfs_list_t *ext_list, int cmd, pdl_policy_t p); + struct list_head *ext_list, int cmd, pdl_policy_t p); int osc_lru_shrink(const struct lu_env *env, struct client_obd *cli, int target, bool force); int osc_lru_reclaim(struct client_obd *cli); @@ -193,9 +193,9 @@ static inline struct osc_device *obd2osc_dev(const struct obd_device *d) extern struct kmem_cache *osc_quota_kmem; struct osc_quota_info { - /** linkage for quota hash table */ - cfs_hlist_node_t oqi_hash; - obd_uid oqi_id; + /** linkage for quota hash table */ + struct hlist_node oqi_hash; + obd_uid oqi_id; }; int osc_quota_setup(struct obd_device *obd); int osc_quota_cleanup(struct obd_device *obd); diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index 934511e..696bf99f 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -103,13 +103,13 @@ static int osc_io_submit(const struct lu_env *env, const struct cl_io_slice *ios, enum cl_req_type crt, struct cl_2queue *queue) { - struct cl_page *page; - struct cl_page *tmp; - struct client_obd *cli = NULL; - struct osc_object *osc = NULL; /* to keep gcc happy */ - struct osc_page *opg; - struct cl_io *io; - CFS_LIST_HEAD (list); + struct cl_page *page; + struct cl_page *tmp; + struct client_obd *cli = NULL; + struct osc_object *osc = NULL; /* to keep gcc happy */ + struct osc_page *opg; + struct cl_io *io; + struct list_head list = LIST_HEAD_INIT(list); struct cl_page_list *qin = &queue->c2_qin; struct cl_page_list *qout = &queue->c2_qout; @@ -145,8 +145,8 @@ static int osc_io_submit(const struct lu_env *env, oap = &opg->ops_oap; LASSERT(osc == oap->oap_obj); - if (!cfs_list_empty(&oap->oap_pending_item) || - !cfs_list_empty(&oap->oap_rpc_item)) { + if (!list_empty(&oap->oap_pending_item) || + !list_empty(&oap->oap_rpc_item)) { CDEBUG(D_CACHE, "Busy oap %p page %p for submit.\n", oap, opg); result = -EBUSY; @@ -174,7 +174,7 @@ static int osc_io_submit(const struct lu_env *env, spin_unlock(&oap->oap_lock); osc_page_submit(env, opg, crt, brw_flags); - cfs_list_add_tail(&oap->oap_pending_item, &list); + list_add_tail(&oap->oap_pending_item, &list); if (++queued == max_pages) { queued = 0; result = osc_queue_sync_pages(env, osc, &list, cmd, @@ -272,7 +272,7 @@ static int osc_io_commit_async(const struct lu_env *env, opg = osc_cl_page_osc(page, osc); oap = &opg->ops_oap; - if (!cfs_list_empty(&oap->oap_rpc_item)) { + if (!list_empty(&oap->oap_rpc_item)) { CDEBUG(D_CACHE, "Busy oap %p page %p for submit.\n", oap, opg); result = -EBUSY; @@ -280,7 +280,7 @@ static int osc_io_commit_async(const struct lu_env *env, } /* The page may be already in dirty cache. */ - if (cfs_list_empty(&oap->oap_pending_item)) { + if (list_empty(&oap->oap_pending_item)) { result = osc_page_cache_add(env, &opg->ops_cl, io); if (result != 0) break; @@ -403,7 +403,7 @@ static int trunc_check_cb(const struct lu_env *env, struct cl_io *io, oap = &ops->ops_oap; if (oap->oap_cmd & OBD_BRW_WRITE && - !cfs_list_empty(&oap->oap_pending_item)) + !list_empty(&oap->oap_pending_item)) CL_PAGE_DEBUG(D_ERROR, env, page, "exists " LPU64 "/%s.\n", start, current->comm); @@ -804,7 +804,7 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *subobj; clerq = slice->crs_req; - LASSERT(!cfs_list_empty(&clerq->crq_pages)); + LASSERT(!list_empty(&clerq->crq_pages)); apage = container_of(clerq->crq_pages.next, struct cl_page, cp_flight); opg = osc_cl_page_osc(apage, NULL); @@ -816,8 +816,8 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_lock *scan; head = cl_object_header(subobj); - cfs_list_for_each_entry(scan, &head->coh_locks, - cll_linkage) + list_for_each_entry(scan, &head->coh_locks, + cll_linkage) CL_LOCK_DEBUG(D_ERROR, env, scan, "no cover page!\n"); CL_PAGE_DEBUG(D_ERROR, env, apage, diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 816cc78..3f828e0 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -1116,7 +1116,7 @@ static int osc_lock_enqueue_wait(const struct lu_env *env, return 0; spin_lock(&hdr->coh_lock_guard); - cfs_list_for_each_entry(scan, &hdr->coh_locks, cll_linkage) { + list_for_each_entry(scan, &hdr->coh_locks, cll_linkage) { struct cl_lock_descr *cld = &scan->cll_descr; const struct osc_lock *scan_ols; diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index 77a4a69..29eaaf8 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -83,18 +83,18 @@ static int osc_object_init(const struct lu_env *env, struct lu_object *obj, #endif spin_lock_init(&osc->oo_seatbelt); for (i = 0; i < CRT_NR; ++i) - CFS_INIT_LIST_HEAD(&osc->oo_inflight[i]); + INIT_LIST_HEAD(&osc->oo_inflight[i]); - CFS_INIT_LIST_HEAD(&osc->oo_ready_item); - CFS_INIT_LIST_HEAD(&osc->oo_hp_ready_item); - CFS_INIT_LIST_HEAD(&osc->oo_write_item); - CFS_INIT_LIST_HEAD(&osc->oo_read_item); + INIT_LIST_HEAD(&osc->oo_ready_item); + INIT_LIST_HEAD(&osc->oo_hp_ready_item); + INIT_LIST_HEAD(&osc->oo_write_item); + INIT_LIST_HEAD(&osc->oo_read_item); osc->oo_root.rb_node = NULL; - CFS_INIT_LIST_HEAD(&osc->oo_hp_exts); - CFS_INIT_LIST_HEAD(&osc->oo_urgent_exts); - CFS_INIT_LIST_HEAD(&osc->oo_rpc_exts); - CFS_INIT_LIST_HEAD(&osc->oo_reading_exts); + INIT_LIST_HEAD(&osc->oo_hp_exts); + INIT_LIST_HEAD(&osc->oo_urgent_exts); + INIT_LIST_HEAD(&osc->oo_rpc_exts); + INIT_LIST_HEAD(&osc->oo_reading_exts); atomic_set(&osc->oo_nr_reads, 0); atomic_set(&osc->oo_nr_writes, 0); spin_lock_init(&osc->oo_lock); @@ -111,18 +111,18 @@ static void osc_object_free(const struct lu_env *env, struct lu_object *obj) int i; for (i = 0; i < CRT_NR; ++i) - LASSERT(cfs_list_empty(&osc->oo_inflight[i])); + LASSERT(list_empty(&osc->oo_inflight[i])); - LASSERT(cfs_list_empty(&osc->oo_ready_item)); - LASSERT(cfs_list_empty(&osc->oo_hp_ready_item)); - LASSERT(cfs_list_empty(&osc->oo_write_item)); - LASSERT(cfs_list_empty(&osc->oo_read_item)); + LASSERT(list_empty(&osc->oo_ready_item)); + LASSERT(list_empty(&osc->oo_hp_ready_item)); + LASSERT(list_empty(&osc->oo_write_item)); + LASSERT(list_empty(&osc->oo_read_item)); LASSERT(osc->oo_root.rb_node == NULL); - LASSERT(cfs_list_empty(&osc->oo_hp_exts)); - LASSERT(cfs_list_empty(&osc->oo_urgent_exts)); - LASSERT(cfs_list_empty(&osc->oo_rpc_exts)); - LASSERT(cfs_list_empty(&osc->oo_reading_exts)); + LASSERT(list_empty(&osc->oo_hp_exts)); + LASSERT(list_empty(&osc->oo_urgent_exts)); + LASSERT(list_empty(&osc->oo_rpc_exts)); + LASSERT(list_empty(&osc->oo_reading_exts)); LASSERT(atomic_read(&osc->oo_nr_reads) == 0); LASSERT(atomic_read(&osc->oo_nr_writes) == 0); diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index 594b13a..eb054a9 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -128,7 +128,7 @@ static int osc_page_protected(const struct lu_env *env, descr->cld_start = osc_index(opg); descr->cld_end = osc_index(opg); spin_lock(&hdr->coh_lock_guard); - cfs_list_for_each_entry(scan, &hdr->coh_locks, cll_linkage) { + list_for_each_entry(scan, &hdr->coh_locks, cll_linkage) { /* * Lock-less sub-lock has to be either in HELD state * (when io is actively going on), or in CACHED state, @@ -200,7 +200,7 @@ static void osc_page_transfer_add(const struct lu_env *env, osc_lru_use(osc_cli(obj), opg); spin_lock(&obj->oo_seatbelt); - cfs_list_add(&opg->ops_inflight, &obj->oo_inflight[crt]); + list_add(&opg->ops_inflight, &obj->oo_inflight[crt]); opg->ops_submitter = current; spin_unlock(&obj->oo_seatbelt); } @@ -252,9 +252,9 @@ static int osc_page_is_under_lock(const struct lu_env *env, RETURN(result); } -static const char *osc_list(cfs_list_t *head) +static const char *osc_list(struct list_head *head) { - return cfs_list_empty(head) ? "-" : "+"; + return list_empty(head) ? "-" : "+"; } static inline cfs_time_t osc_submit_duration(struct osc_page *opg) @@ -336,8 +336,8 @@ static void osc_page_delete(const struct lu_env *env, spin_lock(&obj->oo_seatbelt); if (opg->ops_submitter != NULL) { - LASSERT(!cfs_list_empty(&opg->ops_inflight)); - cfs_list_del_init(&opg->ops_inflight); + LASSERT(!list_empty(&opg->ops_inflight)); + list_del_init(&opg->ops_inflight); opg->ops_submitter = NULL; } spin_unlock(&obj->oo_seatbelt); @@ -438,8 +438,8 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, #endif /* ops_inflight and ops_lru are the same field, but it doesn't * hurt to initialize it twice :-) */ - CFS_INIT_LIST_HEAD(&opg->ops_inflight); - CFS_INIT_LIST_HEAD(&opg->ops_lru); + INIT_LIST_HEAD(&opg->ops_inflight); + INIT_LIST_HEAD(&opg->ops_lru); /* reserve an LRU space for this page */ if (page->cp_type == CPT_CACHEABLE && result == 0) { @@ -573,26 +573,26 @@ int lru_queue_work(const struct lu_env *env, void *data) RETURN(0); } -void osc_lru_add_batch(struct client_obd *cli, cfs_list_t *plist) +void osc_lru_add_batch(struct client_obd *cli, struct list_head *plist) { - CFS_LIST_HEAD(lru); + struct list_head lru = LIST_HEAD_INIT(lru); struct osc_async_page *oap; int npages = 0; - cfs_list_for_each_entry(oap, plist, oap_pending_item) { + list_for_each_entry(oap, plist, oap_pending_item) { struct osc_page *opg = oap2osc_page(oap); if (!opg->ops_in_lru) continue; ++npages; - LASSERT(cfs_list_empty(&opg->ops_lru)); - cfs_list_add(&opg->ops_lru, &lru); + LASSERT(list_empty(&opg->ops_lru)); + list_add(&opg->ops_lru, &lru); } if (npages > 0) { client_obd_list_lock(&cli->cl_lru_list_lock); - cfs_list_splice_tail(&lru, &cli->cl_lru_list); + list_splice_tail(&lru, &cli->cl_lru_list); atomic_sub(npages, &cli->cl_lru_busy); atomic_add(npages, &cli->cl_lru_in_list); client_obd_list_unlock(&cli->cl_lru_list_lock); @@ -606,7 +606,7 @@ void osc_lru_add_batch(struct client_obd *cli, cfs_list_t *plist) static void __osc_lru_del(struct client_obd *cli, struct osc_page *opg) { LASSERT(atomic_read(&cli->cl_lru_in_list) > 0); - cfs_list_del_init(&opg->ops_lru); + list_del_init(&opg->ops_lru); atomic_dec(&cli->cl_lru_in_list); } @@ -618,7 +618,7 @@ static void osc_lru_del(struct client_obd *cli, struct osc_page *opg) { if (opg->ops_in_lru) { client_obd_list_lock(&cli->cl_lru_list_lock); - if (!cfs_list_empty(&opg->ops_lru)) { + if (!list_empty(&opg->ops_lru)) { __osc_lru_del(cli, opg); } else { LASSERT(atomic_read(&cli->cl_lru_busy) > 0); @@ -634,7 +634,7 @@ static void osc_lru_del(struct client_obd *cli, struct osc_page *opg) (void)ptlrpcd_queue_work(cli->cl_lru_work); wake_up(&osc_lru_waitq); } else { - LASSERT(cfs_list_empty(&opg->ops_lru)); + LASSERT(list_empty(&opg->ops_lru)); } } @@ -645,7 +645,7 @@ static void osc_lru_use(struct client_obd *cli, struct osc_page *opg) { /* If page is being transfered for the first time, * ops_lru should be empty */ - if (opg->ops_in_lru && !cfs_list_empty(&opg->ops_lru)) { + if (opg->ops_in_lru && !list_empty(&opg->ops_lru)) { client_obd_list_lock(&cli->cl_lru_list_lock); __osc_lru_del(cli, opg); client_obd_list_unlock(&cli->cl_lru_list_lock); @@ -707,18 +707,18 @@ int osc_lru_shrink(const struct lu_env *env, struct client_obd *cli, client_obd_list_lock(&cli->cl_lru_list_lock); maxscan = min(target << 1, atomic_read(&cli->cl_lru_in_list)); - while (!cfs_list_empty(&cli->cl_lru_list)) { + while (!list_empty(&cli->cl_lru_list)) { struct cl_page *page; bool will_free = false; if (--maxscan < 0) break; - opg = cfs_list_entry(cli->cl_lru_list.next, struct osc_page, - ops_lru); + opg = list_entry(cli->cl_lru_list.next, struct osc_page, + ops_lru); page = opg->ops_cl.cpl_page; if (cl_page_in_use_noref(page)) { - cfs_list_move_tail(&opg->ops_lru, &cli->cl_lru_list); + list_move_tail(&opg->ops_lru, &cli->cl_lru_list); continue; } @@ -767,7 +767,7 @@ int osc_lru_shrink(const struct lu_env *env, struct client_obd *cli, } if (!will_free) { - cfs_list_move_tail(&opg->ops_lru, &cli->cl_lru_list); + list_move_tail(&opg->ops_lru, &cli->cl_lru_list); continue; } @@ -816,7 +816,7 @@ int osc_lru_reclaim(struct client_obd *cli) ENTRY; LASSERT(cache != NULL); - LASSERT(!cfs_list_empty(&cache->ccc_lru)); + LASSERT(!list_empty(&cache->ccc_lru)); env = cl_env_nested_get(&nest); if (IS_ERR(env)) @@ -841,19 +841,19 @@ int osc_lru_reclaim(struct client_obd *cli) * from its own. This should rarely happen. */ spin_lock(&cache->ccc_lru_lock); cache->ccc_lru_shrinkers++; - cfs_list_move_tail(&cli->cl_lru_osc, &cache->ccc_lru); + list_move_tail(&cli->cl_lru_osc, &cache->ccc_lru); max_scans = atomic_read(&cache->ccc_users); - while (--max_scans > 0 && !cfs_list_empty(&cache->ccc_lru)) { - cli = cfs_list_entry(cache->ccc_lru.next, struct client_obd, - cl_lru_osc); + while (--max_scans > 0 && !list_empty(&cache->ccc_lru)) { + cli = list_entry(cache->ccc_lru.next, struct client_obd, + cl_lru_osc); CDEBUG(D_CACHE, "%s: cli %p LRU pages: %d, busy: %d.\n", cli->cl_import->imp_obd->obd_name, cli, atomic_read(&cli->cl_lru_in_list), atomic_read(&cli->cl_lru_busy)); - cfs_list_move_tail(&cli->cl_lru_osc, &cache->ccc_lru); + list_move_tail(&cli->cl_lru_osc, &cache->ccc_lru); if (osc_cache_too_much(cli) > 0) { spin_unlock(&cache->ccc_lru_lock); diff --git a/lustre/osc/osc_quota.c b/lustre/osc/osc_quota.c index 79283fc..31db149 100644 --- a/lustre/osc/osc_quota.c +++ b/lustre/osc/osc_quota.c @@ -147,48 +147,48 @@ oqi_hashfn(cfs_hash_t *hs, const void *key, unsigned mask) } static int -oqi_keycmp(const void *key, cfs_hlist_node_t *hnode) +oqi_keycmp(const void *key, struct hlist_node *hnode) { struct osc_quota_info *oqi; obd_uid uid; LASSERT(key != NULL); uid = *((obd_uid*)key); - oqi = cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash); + oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash); return uid == oqi->oqi_id; } static void * -oqi_key(cfs_hlist_node_t *hnode) +oqi_key(struct hlist_node *hnode) { struct osc_quota_info *oqi; - oqi = cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash); + oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash); return &oqi->oqi_id; } static void * -oqi_object(cfs_hlist_node_t *hnode) +oqi_object(struct hlist_node *hnode) { - return cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash); + return hlist_entry(hnode, struct osc_quota_info, oqi_hash); } static void -oqi_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode) +oqi_get(cfs_hash_t *hs, struct hlist_node *hnode) { } static void -oqi_put_locked(cfs_hash_t *hs, cfs_hlist_node_t *hnode) +oqi_put_locked(cfs_hash_t *hs, struct hlist_node *hnode) { } static void -oqi_exit(cfs_hash_t *hs, cfs_hlist_node_t *hnode) +oqi_exit(cfs_hash_t *hs, struct hlist_node *hnode) { struct osc_quota_info *oqi; - oqi = cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash); + oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash); OBD_SLAB_FREE_PTR(oqi, osc_quota_kmem); } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index f6ce5cb..6575d79 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -639,7 +639,7 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo, * @objid. Found locks are added into @cancel list. Returns the amount of * locks added to @cancels list. */ static int osc_resource_get_unused(struct obd_export *exp, struct obdo *oa, - cfs_list_t *cancels, + struct list_head *cancels, ldlm_mode_t mode, __u64 lock_flags) { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; @@ -742,7 +742,7 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, struct client_obd *cli = &exp->exp_obd->u.cli; struct ptlrpc_request *req; struct ost_body *body; - CFS_LIST_HEAD(cancels); + struct list_head cancels = LIST_HEAD_INIT(cancels); int rc, count; ENTRY; @@ -1002,14 +1002,13 @@ static int osc_should_shrink_grant(struct client_obd *client) static int osc_grant_shrink_grant_cb(struct timeout_item *item, void *data) { - struct client_obd *client; + struct client_obd *client; - cfs_list_for_each_entry(client, &item->ti_obd_list, - cl_grant_shrink_list) { - if (osc_should_shrink_grant(client)) - osc_shrink_grant(client); - } - return 0; + list_for_each_entry(client, &item->ti_obd_list, cl_grant_shrink_list) { + if (osc_should_shrink_grant(client)) + osc_shrink_grant(client); + } + return 0; } static int osc_add_shrink_grant(struct client_obd *client) @@ -1071,7 +1070,7 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) cli->cl_avail_grant, cli->cl_lost_grant, cli->cl_chunkbits); if (ocd->ocd_connect_flags & OBD_CONNECT_GRANT_SHRINK && - cfs_list_empty(&cli->cl_grant_shrink_list)) + list_empty(&cli->cl_grant_shrink_list)) osc_add_shrink_grant(cli); } @@ -1423,7 +1422,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa, aa->aa_resends = 0; aa->aa_ppga = pga; aa->aa_cli = cli; - CFS_INIT_LIST_HEAD(&aa->aa_oaps); + INIT_LIST_HEAD(&aa->aa_oaps); if (ocapa && reserve) aa->aa_ocapa = capa_get(ocapa); @@ -1657,7 +1656,7 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, if (rc) RETURN(rc); - cfs_list_for_each_entry(oap, &aa->aa_oaps, oap_rpc_item) { + list_for_each_entry(oap, &aa->aa_oaps, oap_rpc_item) { if (oap->oap_request != NULL) { LASSERTF(request == oap->oap_request, "request %p != oap_request %p\n", @@ -1685,13 +1684,13 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, new_aa = ptlrpc_req_async_args(new_req); - CFS_INIT_LIST_HEAD(&new_aa->aa_oaps); - cfs_list_splice_init(&aa->aa_oaps, &new_aa->aa_oaps); - CFS_INIT_LIST_HEAD(&new_aa->aa_exts); - cfs_list_splice_init(&aa->aa_exts, &new_aa->aa_exts); + INIT_LIST_HEAD(&new_aa->aa_oaps); + list_splice_init(&aa->aa_oaps, &new_aa->aa_oaps); + INIT_LIST_HEAD(&new_aa->aa_exts); + list_splice_init(&aa->aa_exts, &new_aa->aa_exts); new_aa->aa_resends = aa->aa_resends; - cfs_list_for_each_entry(oap, &new_aa->aa_oaps, oap_rpc_item) { + list_for_each_entry(oap, &new_aa->aa_oaps, oap_rpc_item) { if (oap->oap_request) { ptlrpc_req_finished(oap->oap_request); oap->oap_request = ptlrpc_request_addref(new_req); @@ -1841,12 +1840,12 @@ static int brw_interpret(const struct lu_env *env, } OBDO_FREE(aa->aa_oa); - cfs_list_for_each_entry_safe(ext, tmp, &aa->aa_exts, oe_link) { - cfs_list_del_init(&ext->oe_link); + list_for_each_entry_safe(ext, tmp, &aa->aa_exts, oe_link) { + list_del_init(&ext->oe_link); osc_extent_finish(env, ext, 1, rc); } - LASSERT(cfs_list_empty(&aa->aa_exts)); - LASSERT(cfs_list_empty(&aa->aa_oaps)); + LASSERT(list_empty(&aa->aa_exts)); + LASSERT(list_empty(&aa->aa_oaps)); cl_req_completion(env, aa->aa_clerq, rc < 0 ? rc : req->rq_bulk->bd_nob_transferred); @@ -1892,7 +1891,7 @@ static void brw_commit(struct ptlrpc_request *req) * Extents in the list must be in OES_RPC state. */ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, - cfs_list_t *ext_list, int cmd, pdl_policy_t pol) + struct list_head *ext_list, int cmd, pdl_policy_t pol) { struct ptlrpc_request *req = NULL; struct osc_extent *ext; @@ -1913,18 +1912,18 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, int page_count = 0; int i; int rc; - CFS_LIST_HEAD(rpc_list); + struct list_head rpc_list = LIST_HEAD_INIT(rpc_list); ENTRY; - LASSERT(!cfs_list_empty(ext_list)); + LASSERT(!list_empty(ext_list)); /* add pages into rpc_list to build BRW rpc */ - cfs_list_for_each_entry(ext, ext_list, oe_link) { + list_for_each_entry(ext, ext_list, oe_link) { LASSERT(ext->oe_state == OES_RPC); mem_tight |= ext->oe_memalloc; - cfs_list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { + list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { ++page_count; - cfs_list_add_tail(&oap->oap_rpc_item, &rpc_list); + list_add_tail(&oap->oap_rpc_item, &rpc_list); if (starting_offset > oap->oap_obj_off) starting_offset = oap->oap_obj_off; else @@ -1954,7 +1953,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, GOTO(out, rc = -ENOMEM); i = 0; - cfs_list_for_each_entry(oap, &rpc_list, oap_rpc_item) { + list_for_each_entry(oap, &rpc_list, oap_rpc_item) { struct cl_page *page = oap2cl_page(oap); if (clerq == NULL) { clerq = cl_req_alloc(env, page, crt, @@ -2015,16 +2014,16 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args)); aa = ptlrpc_req_async_args(req); - CFS_INIT_LIST_HEAD(&aa->aa_oaps); - cfs_list_splice_init(&rpc_list, &aa->aa_oaps); - CFS_INIT_LIST_HEAD(&aa->aa_exts); - cfs_list_splice_init(ext_list, &aa->aa_exts); + INIT_LIST_HEAD(&aa->aa_oaps); + list_splice_init(&rpc_list, &aa->aa_oaps); + INIT_LIST_HEAD(&aa->aa_exts); + list_splice_init(ext_list, &aa->aa_exts); aa->aa_clerq = clerq; /* queued sync pages can be torn down while the pages * were between the pending list and the rpc */ tmp = NULL; - cfs_list_for_each_entry(oap, &aa->aa_oaps, oap_rpc_item) { + list_for_each_entry(oap, &aa->aa_oaps, oap_rpc_item) { /* only one oap gets a request reference */ if (tmp == NULL) tmp = oap; @@ -2092,10 +2091,10 @@ out: OBD_FREE(pga, sizeof(*pga) * page_count); /* this should happen rarely and is pretty bad, it makes the * pending list not follow the dirty order */ - while (!cfs_list_empty(ext_list)) { - ext = cfs_list_entry(ext_list->next, struct osc_extent, - oe_link); - cfs_list_del_init(&ext->oe_link); + while (!list_empty(ext_list)) { + ext = list_entry(ext_list->next, struct osc_extent, + oe_link); + list_del_init(&ext->oe_link); osc_extent_finish(env, ext, 0, rc); } if (clerq && !IS_ERR(clerq)) @@ -2839,9 +2838,9 @@ static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp, cli->cl_lru_left = &cli->cl_cache->ccc_lru_left; /* add this osc into entity list */ - LASSERT(cfs_list_empty(&cli->cl_lru_osc)); + LASSERT(list_empty(&cli->cl_lru_osc)); spin_lock(&cli->cl_cache->ccc_lru_lock); - cfs_list_add(&cli->cl_lru_osc, &cli->cl_cache->ccc_lru); + list_add(&cli->cl_lru_osc, &cli->cl_cache->ccc_lru); spin_unlock(&cli->cl_cache->ccc_lru_lock); RETURN(0); @@ -3162,7 +3161,7 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) OST_MAXREQSIZE, ptlrpc_add_rqs_to_pool); - CFS_INIT_LIST_HEAD(&cli->cl_grant_shrink_list); + INIT_LIST_HEAD(&cli->cl_grant_shrink_list); ns_register_cancel(obd->obd_namespace, osc_cancel_weight); RETURN(0); @@ -3242,7 +3241,7 @@ int osc_cleanup(struct obd_device *obd) if (cli->cl_cache != NULL) { LASSERT(atomic_read(&cli->cl_cache->ccc_users) > 0); spin_lock(&cli->cl_cache->ccc_lru_lock); - cfs_list_del_init(&cli->cl_lru_osc); + list_del_init(&cli->cl_lru_osc); spin_unlock(&cli->cl_cache->ccc_lru_lock); cli->cl_lru_left = NULL; atomic_dec(&cli->cl_cache->ccc_users);