From: James Simmons Date: Tue, 15 Jul 2014 16:01:27 +0000 (-0400) Subject: LU-3963 ofd: convert to linux list api X-Git-Tag: 2.6.51~63 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F21%2F10921%2F3;p=fs%2Flustre-release.git LU-3963 ofd: convert to linux list api Move from the cfs_[h]list api to the native linux api for all the code related to OFD. Change-Id: I83ee0ed2bff48a517174113859cc3f4c07fd797e Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/10921 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c index 00218c4..035feb5 100644 --- a/lustre/ofd/lproc_ofd.c +++ b/lustre/ofd/lproc_ofd.c @@ -188,7 +188,7 @@ static int ofd_last_id_seq_show(struct seq_file *m, void *data) ofd = ofd_dev(obd->obd_lu_dev); read_lock(&ofd->ofd_seq_list_lock); - cfs_list_for_each_entry(oseq, &ofd->ofd_seq_list, os_list) { + list_for_each_entry(oseq, &ofd->ofd_seq_list, os_list) { __u64 seq; seq = ostid_seq(&oseq->os_oi) == 0 ? diff --git a/lustre/ofd/ofd_capa.c b/lustre/ofd/ofd_capa.c index 7e5fd88..26c86d4 100644 --- a/lustre/ofd/ofd_capa.c +++ b/lustre/ofd/ofd_capa.c @@ -106,7 +106,7 @@ int ofd_update_capa_key(struct ofd_device *ofd, struct lustre_capa_key *new) OBD_ALLOC_PTR(k); if (!k) RETURN(-ENOMEM); - CFS_INIT_LIST_HEAD(&k->k_list); + INIT_LIST_HEAD(&k->k_list); } spin_lock(&capa_lock); diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index f758e1e..2ca33bb 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -761,13 +761,13 @@ int ofd_fiemap_get(const struct lu_env *env, struct ofd_device *ofd, } struct locked_region { - cfs_list_t list; + struct list_head list; struct lustre_handle lh; }; static int lock_region(struct ldlm_namespace *ns, struct ldlm_res_id *res_id, unsigned long long begin, unsigned long long end, - cfs_list_t *locked) + struct list_head *locked) { struct locked_region *region = NULL; __u64 flags = 0; @@ -785,7 +785,7 @@ static int lock_region(struct ldlm_namespace *ns, struct ldlm_res_id *res_id, CDEBUG(D_OTHER, "ost lock [%llu,%llu], lh=%p\n", begin, end, ®ion->lh); - cfs_list_add(®ion->list, locked); + list_add(®ion->list, locked); return 0; } @@ -793,7 +793,7 @@ static int lock_region(struct ldlm_namespace *ns, struct ldlm_res_id *res_id, static int lock_zero_regions(struct ldlm_namespace *ns, struct ldlm_res_id *res_id, struct ll_user_fiemap *fiemap, - cfs_list_t *locked) + struct list_head *locked) { __u64 begin = fiemap->fm_start; unsigned int i; @@ -826,14 +826,15 @@ static int lock_zero_regions(struct ldlm_namespace *ns, RETURN(rc); } -static void unlock_zero_regions(struct ldlm_namespace *ns, cfs_list_t *locked) +static void +unlock_zero_regions(struct ldlm_namespace *ns, struct list_head *locked) { struct locked_region *entry, *temp; - cfs_list_for_each_entry_safe(entry, temp, locked, list) { + list_for_each_entry_safe(entry, temp, locked, list) { CDEBUG(D_OTHER, "ost unlock lh=%p\n", &entry->lh); tgt_extent_unlock(&entry->lh, LCK_PR); - cfs_list_del(&entry->list); + list_del(&entry->list); OBD_FREE_PTR(entry); } } @@ -911,13 +912,14 @@ int ofd_get_info_hdl(struct tgt_session_info *tsi) * flushed back from client, then call fiemap again. */ if (fm_key->oa.o_valid & OBD_MD_FLFLAGS && fm_key->oa.o_flags & OBD_FL_SRVLOCK) { - cfs_list_t locked = CFS_LIST_HEAD_INIT(locked); + struct list_head locked; + INIT_LIST_HEAD(&locked); ost_fid_build_resid(fid, &fti->fti_resid); rc = lock_zero_regions(ofd->ofd_namespace, &fti->fti_resid, fiemap, &locked); - if (rc == 0 && !cfs_list_empty(&locked)) { + if (rc == 0 && !list_empty(&locked)) { rc = ofd_fiemap_get(tsi->tsi_env, ofd, fid, fiemap); unlock_zero_regions(ofd->ofd_namespace, @@ -2147,7 +2149,7 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m, init_rwsem(&m->ofd_lastid_rwsem); obd->u.filter.fo_fl_oss_capa = 0; - CFS_INIT_LIST_HEAD(&obd->u.filter.fo_capa_keys); + INIT_LIST_HEAD(&obd->u.filter.fo_capa_keys); obd->u.filter.fo_capa_hash = init_capa_hash(); if (obd->u.filter.fo_capa_hash == NULL) RETURN(-ENOMEM); diff --git a/lustre/ofd/ofd_dlm.c b/lustre/ofd/ofd_dlm.c index 6337548..03bd7b6 100644 --- a/lustre/ofd/ofd_dlm.c +++ b/lustre/ofd/ofd_dlm.c @@ -61,7 +61,7 @@ static enum interval_iter ofd_intent_cb(struct interval_node *n, void *args) if (interval_high(n) <= size) return INTERVAL_ITER_STOP; - cfs_list_for_each_entry(lck, &node->li_group, l_sl_policy) { + list_for_each_entry(lck, &node->li_group, l_sl_policy) { /* Don't send glimpse ASTs to liblustre clients. * They aren't listening for them, and they do * entirely synchronous I/O anyways. */ @@ -107,9 +107,10 @@ int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp, [DLM_REPLY_REC_OFF] = sizeof(*reply_lvb) }; struct ldlm_glimpse_work gl_work; - CFS_LIST_HEAD(gl_list); + struct list_head gl_list; ENTRY; + INIT_LIST_HEAD(&gl_list); lock->l_lvb_type = LVB_T_OST; policy = ldlm_get_processing_policy(res); LASSERT(policy != NULL); @@ -242,7 +243,7 @@ int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp, gl_work.gl_lock = LDLM_LOCK_GET(l); /* The glimpse callback is sent to one single extent lock. As a result, * the gl_work list is just composed of one element */ - cfs_list_add_tail(&gl_work.gl_list, &gl_list); + list_add_tail(&gl_work.gl_list, &gl_list); /* There is actually no need for a glimpse descriptor when glimpsing * extent locks */ gl_work.gl_desc = NULL; @@ -251,7 +252,7 @@ int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp, rc = ldlm_glimpse_locks(res, &gl_list); /* this will update the LVB */ - if (!cfs_list_empty(&gl_list)) + if (!list_empty(&gl_list)) LDLM_LOCK_RELEASE(l); lock_res(res); diff --git a/lustre/ofd/ofd_fmd.c b/lustre/ofd/ofd_fmd.c index 63433e8..bdcf663 100644 --- a/lustre/ofd/ofd_fmd.c +++ b/lustre/ofd/ofd_fmd.c @@ -53,7 +53,7 @@ static inline void ofd_fmd_put_nolock(struct obd_export *exp, /* XXX when we have persistent reservations and the handle * is stored herein we need to drop it here. */ fed->fed_mod_count--; - cfs_list_del(&fmd->fmd_list); + list_del(&fmd->fmd_list); OBD_SLAB_FREE(fmd, ll_fmd_cachep, sizeof(*fmd)); } } @@ -82,7 +82,7 @@ static void ofd_fmd_expire_nolock(struct obd_export *exp, cfs_time_t now = cfs_time_current(); - cfs_list_for_each_entry_safe(fmd, tmp, &fed->fed_mod_list, fmd_list) { + list_for_each_entry_safe(fmd, tmp, &fed->fed_mod_list, fmd_list) { if (fmd == keep) break; @@ -90,7 +90,7 @@ static void ofd_fmd_expire_nolock(struct obd_export *exp, fed->fed_mod_count < ofd->ofd_fmd_max_num) break; - cfs_list_del_init(&fmd->fmd_list); + list_del_init(&fmd->fmd_list); ofd_fmd_put_nolock(exp, fmd); /* list reference */ } } @@ -117,11 +117,11 @@ static struct ofd_mod_data *ofd_fmd_find_nolock(struct obd_export *exp, assert_spin_locked(&fed->fed_lock); - cfs_list_for_each_entry_reverse(fmd, &fed->fed_mod_list, fmd_list) { + list_for_each_entry_reverse(fmd, &fed->fed_mod_list, fmd_list) { if (lu_fid_eq(&fmd->fmd_fid, fid)) { found = fmd; - cfs_list_del(&fmd->fmd_list); - cfs_list_add_tail(&fmd->fmd_list, &fed->fed_mod_list); + list_del(&fmd->fmd_list); + list_add_tail(&fmd->fmd_list, &fed->fed_mod_list); fmd->fmd_expire = cfs_time_add(now, ofd->ofd_fmd_max_age); break; } @@ -167,8 +167,8 @@ struct ofd_mod_data *ofd_fmd_get(struct obd_export *exp, const struct lu_fid *fi found = ofd_fmd_find_nolock(exp, fid); if (fmd_new) { if (found == NULL) { - cfs_list_add_tail(&fmd_new->fmd_list, - &fed->fed_mod_list); + list_add_tail(&fmd_new->fmd_list, + &fed->fed_mod_list); fmd_new->fmd_fid = *fid; fmd_new->fmd_refcount++; /* list reference */ found = fmd_new; @@ -200,7 +200,7 @@ void ofd_fmd_drop(struct obd_export *exp, const struct lu_fid *fid) spin_lock(&fed->fed_lock); found = ofd_fmd_find_nolock(exp, fid); if (found) { - cfs_list_del_init(&found->fmd_list); + list_del_init(&found->fmd_list); ofd_fmd_put_nolock(exp, found); } spin_unlock(&fed->fed_lock); @@ -214,8 +214,8 @@ void ofd_fmd_cleanup(struct obd_export *exp) struct ofd_mod_data *fmd = NULL, *tmp; spin_lock(&fed->fed_lock); - cfs_list_for_each_entry_safe(fmd, tmp, &fed->fed_mod_list, fmd_list) { - cfs_list_del_init(&fmd->fmd_list); + list_for_each_entry_safe(fmd, tmp, &fed->fed_mod_list, fmd_list) { + list_del_init(&fmd->fmd_list); if (fmd->fmd_refcount > 1) { CDEBUG(D_INFO, "fmd %p still referenced (refcount = %d)\n", fmd, fmd->fmd_refcount); diff --git a/lustre/ofd/ofd_grant.c b/lustre/ofd/ofd_grant.c index ff205f5..b3e38bd 100644 --- a/lustre/ofd/ofd_grant.c +++ b/lustre/ofd/ofd_grant.c @@ -122,7 +122,7 @@ void ofd_grant_sanity_check(struct obd_device *obd, const char *func) obd_size fo_tot_pending; obd_size fo_tot_dirty; - if (cfs_list_empty(&obd->obd_exports)) + if (list_empty(&obd->obd_exports)) return; /* We don't want to do this for large machines that do lots of @@ -134,7 +134,7 @@ void ofd_grant_sanity_check(struct obd_device *obd, const char *func) spin_lock(&obd->obd_dev_lock); spin_lock(&ofd->ofd_grant_lock); - cfs_list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) { + list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) { struct filter_export_data *fed; int error = 0; diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h index 1533963..e41dde8 100644 --- a/lustre/ofd/ofd_internal.h +++ b/lustre/ofd/ofd_internal.h @@ -58,11 +58,11 @@ /* per-client-per-object persistent state (LRU) */ struct ofd_mod_data { - cfs_list_t fmd_list; /* linked to fed_mod_list */ - struct lu_fid fmd_fid; /* FID being written to */ - __u64 fmd_mactime_xid; /* xid highest {m,a,c}time setattr */ - cfs_time_t fmd_expire; /* time when the fmd should expire */ - int fmd_refcount; /* reference counter - list holds 1 */ + struct list_head fmd_list; /* linked to fed_mod_list */ + struct lu_fid fmd_fid; /* FID being written to */ + __u64 fmd_mactime_xid; /* xid highest {m,a,c}time setattr */ + cfs_time_t fmd_expire; /* time when the fmd should expire */ + int fmd_refcount; /* reference counter - list holds 1 */ }; #define OFD_FMD_MAX_NUM_DEFAULT 128 @@ -105,7 +105,7 @@ static inline void ofd_counter_incr(struct obd_export *exp, int opcode, } struct ofd_seq { - cfs_list_t os_list; + struct list_head os_list; struct ost_id os_oi; spinlock_t os_last_oid_lock; struct mutex os_create_lock; @@ -130,7 +130,7 @@ struct ofd_device { __u64 ofd_inconsistency_self_detected; __u64 ofd_inconsistency_self_repaired; - cfs_list_t ofd_seq_list; + struct list_head ofd_seq_list; rwlock_t ofd_seq_list_lock; int ofd_seq_count; int ofd_precreate_batch; diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 3d7e60a..2c83be3 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -799,7 +799,7 @@ static int ofd_soft_sync_cb_add(struct thandle *th, struct obd_export *exp) dcb = &ossc->ossc_cb; dcb->dcb_func = ofd_cb_soft_sync; - CFS_INIT_LIST_HEAD(&dcb->dcb_linkage); + INIT_LIST_HEAD(&dcb->dcb_linkage); strlcpy(dcb->dcb_name, "ofd_cb_soft_sync", sizeof(dcb->dcb_name)); rc = dt_trans_cb_add(th, dcb); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index cd14949..ac2e0e1 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -348,7 +348,7 @@ static int ofd_init_export(struct obd_export *exp) int rc; spin_lock_init(&exp->exp_filter_data.fed_lock); - CFS_INIT_LIST_HEAD(&exp->exp_filter_data.fed_mod_list); + INIT_LIST_HEAD(&exp->exp_filter_data.fed_mod_list); atomic_set(&exp->exp_filter_data.fed_soft_sync_count, 0); spin_lock(&exp->exp_lock); exp->exp_connecting = 1; @@ -403,7 +403,7 @@ static int ofd_destroy_export(struct obd_export *exp) if (!(exp->exp_flags & OBD_OPT_FORCE)) ofd_grant_sanity_check(exp->exp_obd, __FUNCTION__); - LASSERT(cfs_list_empty(&exp->exp_filter_data.fed_mod_list)); + LASSERT(list_empty(&exp->exp_filter_data.fed_mod_list)); return 0; }