*/
struct list_head cob_pending_list;
- /**
- * Access this counter is protected by inode->i_sem. Now that
- * the lifetime of transient pages must be covered by inode sem,
- * we don't need to hold any lock..
- */
- int cob_transient_pages;
+ /**
+ * Number of transient pages. This is no longer protected by i_sem,
+ * and needs to be atomic. This is not actually used for anything,
+ * and can probably be removed.
+ */
+ atomic_t cob_transient_pages;
/**
* Number of outstanding mmaps on this file.
*
}
int ccc_object_init0(const struct lu_env *env,
- struct ccc_object *vob,
- const struct cl_object_conf *conf)
+ struct ccc_object *vob,
+ const struct cl_object_conf *conf)
{
- vob->cob_inode = conf->coc_inode;
- vob->cob_transient_pages = 0;
+ vob->cob_inode = conf->coc_inode;
+ atomic_set(&vob->cob_transient_pages, 0);
cl_object_page_init(&vob->cob_cl, sizeof(struct ccc_page));
- return 0;
+ return 0;
}
int ccc_object_init(const struct lu_env *env, struct lu_object *obj,
struct cl_io *io;
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
- struct ccc_object *obj = cl_inode2ccc(inode);
long count = iov_length(iov, nr_segs);
long tot_bytes = 0, result = 0;
struct ll_inode_info *lli = ll_i2info(inode);
io = ccc_env_io(env)->cui_cl.cis_io;
LASSERT(io != NULL);
- LASSERT(obj->cob_transient_pages == 0);
for (seg = 0; seg < nr_segs; seg++) {
long iov_left = iov[seg].iov_len;
unsigned long user_addr = (unsigned long)iov[seg].iov_base;
}
}
out:
- LASSERT(obj->cob_transient_pages == 0);
-
if (tot_bytes > 0) {
struct ccc_io *cio = ccc_env_io(env);
(*p)(env, cookie, "(%s %d %d) inode: %p ",
list_empty(&obj->cob_pending_list) ? "-" : "+",
- obj->cob_transient_pages, atomic_read(&obj->cob_mmap_cnt),
+ atomic_read(&obj->cob_transient_pages),
+ atomic_read(&obj->cob_mmap_cnt),
inode);
if (inode) {
lli = ll_i2info(inode);
struct ccc_object *clobj = cl2ccc(clp->cp_obj);
vvp_page_fini_common(cp);
- clobj->cob_transient_pages--;
+ atomic_dec(&clobj->cob_transient_pages);
}
static const struct cl_page_operations vvp_transient_page_ops = {
cl_page_slice_add(page, &cpg->cpg_cl, obj, index,
&vvp_transient_page_ops);
- clobj->cob_transient_pages++;
+ atomic_inc(&clobj->cob_transient_pages);
}
return 0;
}