/** * delete given node from list. */ 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); cache->fci_cache_count--; OBD_FREE_PTR(node); }
void ksocknal_tx_fini_callback(ksock_conn_t * conn, ksock_tx_t * tx) { /* remove tx/conn from conn's outgoing queue */ spin_lock_bh(&conn->ksnc_scheduler->kss_lock); cfs_list_del(&tx->tx_list); if (cfs_list_empty(&conn->ksnc_tx_queue)) cfs_list_del(&conn->ksnc_tx_list); spin_unlock_bh(&conn->ksnc_scheduler->kss_lock); /* complete send; tx -ref */ ksocknal_tx_decref(tx); }
void lwt_fini () { int i; lwt_control(0, 0); for (i = 0; i < cfs_num_online_cpus(); i++) while (lwt_cpus[i].lwtc_current_page != NULL) { lwt_page_t *lwtp = lwt_cpus[i].lwtc_current_page; if (cfs_list_empty (&lwtp->lwtp_list)) { lwt_cpus[i].lwtc_current_page = NULL; } else { lwt_cpus[i].lwtc_current_page = cfs_list_entry (lwtp->lwtp_list.next, lwt_page_t, lwtp_list); cfs_list_del (&lwtp->lwtp_list); } __free_page (lwtp->lwtp_page); LIBCFS_FREE (lwtp, sizeof (*lwtp)); } }
void remove_shrinker(struct shrinker *s) { struct shrinker *tmp; spin_lock(&shrinker_guard); #if TRUE cfs_list_for_each_entry_typed(tmp, &shrinker_hdr, struct shrinker, list) { if (tmp == s) { cfs_list_del(&tmp->list); break; } } #else cfs_list_del(&s->list); #endif spin_unlock(&shrinker_guard); kfree(s); }
/** * Frees range_expr structures of \a list. * * \retval none */ static void free_range_exprs(cfs_list_t *list) { cfs_list_t *pos, *next; cfs_list_for_each_safe(pos, next, list) { cfs_list_del(pos); LIBCFS_FREE(cfs_list_entry(pos, struct range_expr, re_link), sizeof(struct range_expr)); }
/** * Frees nidrange strutures of \a list. * * For each struct nidrange structure found on \a list it frees * addrrange list attached to it and frees the nidrange itself. * * \retval none */ void cfs_free_nidlist(cfs_list_t *list) { cfs_list_t *pos, *next; struct nidrange *nr; cfs_list_for_each_safe(pos, next, list) { nr = cfs_list_entry(pos, struct nidrange, nr_link); free_addrranges(&nr->nr_addrranges); cfs_list_del(pos); LIBCFS_FREE(nr, sizeof(struct nidrange)); }
/* Return the first tx from tx_list with piggybacked zc_ack * from zcack_list when possible. If tx_list is empty, return * brand new noop tx for zc_ack from zcack_list. Return NULL * if an error happened */ usock_tx_t * usocklnd_try_piggyback(cfs_list_t *tx_list_p, cfs_list_t *zcack_list_p) { usock_tx_t *tx; usock_zc_ack_t *zc_ack; /* assign tx and zc_ack */ if (cfs_list_empty(tx_list_p)) tx = NULL; else { tx = cfs_list_entry(tx_list_p->next, usock_tx_t, tx_list); cfs_list_del(&tx->tx_list); /* already piggybacked or partially send */ if (tx->tx_msg.ksm_zc_cookies[1] != 0 || tx->tx_resid != tx->tx_nob) return tx; } if (cfs_list_empty(zcack_list_p)) { /* nothing to piggyback */ return tx; } else { zc_ack = cfs_list_entry(zcack_list_p->next, usock_zc_ack_t, zc_list); cfs_list_del(&zc_ack->zc_list); } if (tx != NULL) /* piggyback the zc-ack cookie */ tx->tx_msg.ksm_zc_cookies[1] = zc_ack->zc_cookie; else /* cannot piggyback, need noop */ tx = usocklnd_create_noop_tx(zc_ack->zc_cookie); LIBCFS_FREE (zc_ack, sizeof(*zc_ack)); return tx; }
/** * Frees addrrange structures of \a list. * * For each struct addrrange structure found on \a list it frees * cfs_expr_list list attached to it and frees the addrrange itself. * * \retval none */ static void free_addrranges(cfs_list_t *list) { while (!cfs_list_empty(list)) { struct addrrange *ar; ar = cfs_list_entry(list->next, struct addrrange, ar_link); cfs_expr_list_free_list(&ar->ar_numaddr_ranges); cfs_list_del(&ar->ar_link); LIBCFS_FREE(ar, sizeof(struct addrrange)); } }
static void osd_object_delete(const struct lu_env *env, struct lu_object *l) { struct osd_object *obj = osd_obj(l); if (obj->oo_db != NULL) { osd_object_sa_fini(obj); if (obj->oo_sa_xattr) { nvlist_free(obj->oo_sa_xattr); obj->oo_sa_xattr = NULL; } sa_buf_rele(obj->oo_db, osd_obj_tag); cfs_list_del(&obj->oo_sa_linkage); obj->oo_db = NULL; } }
static int lcw_dispatch_main(void *data) { int rc = 0; unsigned long flags; struct lc_watchdog *lcw; CFS_LIST_HEAD (zombies); ENTRY; cfs_daemonize("lc_watchdogd"); SIGNAL_MASK_LOCK(current, flags); sigfillset(¤t->blocked); RECALC_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags); cfs_complete(&lcw_start_completion); while (1) { int dumplog = 1; cfs_wait_event_interruptible(lcw_event_waitq, is_watchdog_fired(), rc); CDEBUG(D_INFO, "Watchdog got woken up...\n"); if (cfs_test_bit(LCW_FLAG_STOP, &lcw_flags)) { CDEBUG(D_INFO, "LCW_FLAG_STOP was set, shutting down...\n"); cfs_spin_lock_bh(&lcw_pending_timers_lock); rc = !cfs_list_empty(&lcw_pending_timers); cfs_spin_unlock_bh(&lcw_pending_timers_lock); if (rc) { CERROR("pending timers list was not empty at " "time of watchdog dispatch shutdown\n"); } break; } cfs_spin_lock_bh(&lcw_pending_timers_lock); while (!cfs_list_empty(&lcw_pending_timers)) { int is_dumplog; lcw = cfs_list_entry(lcw_pending_timers.next, struct lc_watchdog, lcw_list); /* +1 ref for callback to make sure lwc wouldn't be * deleted after releasing lcw_pending_timers_lock */ lcw->lcw_refcount++; cfs_spin_unlock_bh(&lcw_pending_timers_lock); /* lock ordering */ cfs_spin_lock_bh(&lcw->lcw_lock); cfs_spin_lock_bh(&lcw_pending_timers_lock); if (cfs_list_empty(&lcw->lcw_list)) { /* already removed from pending list */ lcw->lcw_refcount--; /* -1 ref for callback */ if (lcw->lcw_refcount == 0) cfs_list_add(&lcw->lcw_list, &zombies); cfs_spin_unlock_bh(&lcw->lcw_lock); /* still hold lcw_pending_timers_lock */ continue; } cfs_list_del_init(&lcw->lcw_list); lcw->lcw_refcount--; /* -1 ref for pending list */ cfs_spin_unlock_bh(&lcw_pending_timers_lock); cfs_spin_unlock_bh(&lcw->lcw_lock); CDEBUG(D_INFO, "found lcw for pid " LPPID "\n", lcw->lcw_pid); lcw_dump_stack(lcw); is_dumplog = lcw->lcw_callback == lc_watchdog_dumplog; if (lcw->lcw_state != LC_WATCHDOG_DISABLED && (dumplog || !is_dumplog)) { lcw->lcw_callback(lcw->lcw_pid, lcw->lcw_data); if (dumplog && is_dumplog) dumplog = 0; } cfs_spin_lock_bh(&lcw_pending_timers_lock); lcw->lcw_refcount--; /* -1 ref for callback */ if (lcw->lcw_refcount == 0) cfs_list_add(&lcw->lcw_list, &zombies); } cfs_spin_unlock_bh(&lcw_pending_timers_lock); while (!cfs_list_empty(&zombies)) { lcw = cfs_list_entry(lcw_pending_timers.next, struct lc_watchdog, lcw_list); cfs_list_del(&lcw->lcw_list); LIBCFS_FREE(lcw, sizeof(*lcw)); } } cfs_complete(&lcw_stop_completion); RETURN(rc); }