*/
struct cl_page {
/** Reference counter. */
- atomic_t cp_ref;
+ refcount_t cp_ref;
/** layout_entry + stripe index, composed using lov_comp_index() */
unsigned int cp_lov_index;
/** page->index of the page within the whole file */
*/
static inline bool __page_in_use(const struct cl_page *page, int refc)
{
- return (atomic_read(&page->cp_ref) > refc + 1);
+ return (refcount_read(&page->cp_ref) > refc + 1);
}
/**
*/
static void cl_page_get_trust(struct cl_page *page)
{
- LASSERT(atomic_read(&page->cp_ref) > 0);
- atomic_inc(&page->cp_ref);
+ LASSERT(refcount_read(&page->cp_ref) > 0);
+ refcount_inc(&page->cp_ref);
}
static struct cl_page_slice *
*/
BUILD_BUG_ON((1 << CP_STATE_BITS) < CPS_NR); /* cp_state */
BUILD_BUG_ON((1 << CP_TYPE_BITS) < CPT_NR); /* cp_type */
- atomic_set(&cl_page->cp_ref, 1);
+ refcount_set(&cl_page->cp_ref, 1);
cl_page->cp_obj = o;
if (type != CPT_TRANSIENT)
cl_object_get(o);
{
ENTRY;
CL_PAGE_HEADER(D_TRACE, env, page, "%d\n",
- atomic_read(&page->cp_ref));
+ refcount_read(&page->cp_ref));
- if (atomic_dec_and_test(&page->cp_ref)) {
+ if (refcount_dec_and_test(&page->cp_ref)) {
LASSERT(page->cp_state == CPS_FREEING);
- LASSERT(atomic_read(&page->cp_ref) == 0);
+ LASSERT(refcount_read(&page->cp_ref) == 0);
PASSERT(env, page, page->cp_owner == NULL);
PASSERT(env, page, list_empty(&page->cp_batch));
/*
{
struct page *vmpage;
const struct cl_page_slice *slice;
- int refc;
int i;
ENTRY;
get_page(vmpage);
} else {
/* Drop the reference count held in vvp_page_init */
- refc = atomic_dec_return(&cp->cp_ref);
- LASSERTF(refc >= 1, "page = %p, refc = %d\n", cp, refc);
+ refcount_dec(&cp->cp_ref);
ClearPagePrivate(vmpage);
vmpage->private = 0;
{
(*printer)(env, cookie,
"page@%p[%d %p %d %d %p]\n",
- pg, atomic_read(&pg->cp_ref), pg->cp_obj,
+ pg, refcount_read(&pg->cp_ref), pg->cp_obj,
pg->cp_state, pg->cp_type,
pg->cp_owner);
}