Whamcloud - gitweb
LU-3963 libcfs: convert link list to linux api fld,mdc,osc,mgc
[fs/lustre-release.git] / lustre / osc / osc_page.c
index 594b13a..eb054a9 100644 (file)
@@ -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);