* @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;
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;
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)
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);
}
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);
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",
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);
}
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);
* 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;
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
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,
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;
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))
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);
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);
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);