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);
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);
}
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;
*/
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);
}
/**
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;
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++;
{
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;
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 &&
{
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 &&
{
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)) {
{
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;
};
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 {
/**
* 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. */
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);
}
"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 : "<null>";
const char *exp_name = target->ft_exp != NULL ?
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);
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);
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)
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);
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);
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);
}
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,
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);
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;
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;
* 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;
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;
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. */
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;
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;
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;
/* 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 */
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;
}
/********************** 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 */
/* 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);
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;
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) {
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",
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;
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]"
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;
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)
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;
{
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);
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");
}
/* 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);
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);
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;
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 ... */
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);
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;
/* 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);
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); */
}
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...) \
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);
{
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;
}
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);
&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)
/* 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 */
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;
}
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);
}
RETURN(1);
}
/* all read are urgent. */
- if (!cfs_list_empty(&osc->oo_reading_exts))
+ if (!list_empty(&osc->oo_reading_exts))
RETURN(1);
}
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
* - 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;
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)) {
}
*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);
}
* 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;
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))
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;
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;
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;
}
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;
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)
* 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;
}
}
}
- 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);
{
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,
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);
}
}
#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
/* 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));
}
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",
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. */
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);
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()
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;
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;
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
}
}
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);
}
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;
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;
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);
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);
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;
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);
}
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 */
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);
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;
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;
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
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);
}
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
/**
* 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.
/**
* 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;
/**
* 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.
*/
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);
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,
/** 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. */
/** # 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.
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;
}
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;
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);
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);
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;
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;
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,
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;
}
/* 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;
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);
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);
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,
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;
#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);
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);
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,
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);
}
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)
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);
#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) {
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);
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);
}
{
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);
(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));
}
}
{
/* 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);
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;
}
}
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;
}
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))
* 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);
}
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);
}
* @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);