struct posix_acl *acl = NULL;
ENTRY;
- spin_lock(&lli->lli_lock);
+ read_lock(&lli->lli_lock);
/* VFS' acl_permission_check->check_acl will release the refcount */
acl = posix_acl_dup(lli->lli_posix_acl);
- spin_unlock(&lli->lli_lock);
+ read_unlock(&lli->lli_lock);
RETURN(acl);
}
/* turn off the kernel's read-ahead */
file->f_ra.ra_pages = 0;
- /* ll_cl_context initialize */
- rwlock_init(&fd->fd_lock);
- INIT_LIST_HEAD(&fd->fd_lccs);
-
RETURN(0);
}
range_locked = true;
}
- ll_cl_add(file, env, io, LCC_RW);
+ ll_cl_add(inode, env, io, LCC_RW);
rc = cl_io_loop(env, io);
- ll_cl_remove(file, env);
+ ll_cl_remove(inode, env);
if (range_locked && !is_parallel_dio) {
CDEBUG(D_VFSTRACE, "Range unlock "RL_FMT"\n",
struct ll_inode_info {
__u32 lli_inode_magic;
- spinlock_t lli_lock;
+ rwlock_t lli_lock;
volatile unsigned long lli_flags;
struct posix_acl *lli_posix_acl;
struct rw_semaphore lli_xattrs_list_rwsem;
struct mutex lli_xattrs_enq_lock;
struct list_head lli_xattrs; /* ll_xattr_entry->xe_list */
+ struct list_head lli_lccs; /* list of ll_cl_context */
};
static inline void ll_trunc_sem_init(struct ll_trunc_sem *sem)
static inline void lli_replace_acl(struct ll_inode_info *lli,
struct lustre_md *md)
{
- spin_lock(&lli->lli_lock);
+ write_lock(&lli->lli_lock);
if (lli->lli_posix_acl)
posix_acl_release(lli->lli_posix_acl);
lli->lli_posix_acl = md->posix_acl;
- spin_unlock(&lli->lli_lock);
+ write_unlock(&lli->lli_lock);
}
#else
static inline void lli_clear_acl(struct ll_inode_info *lli)
* false: unknown failure, should report. */
bool fd_write_failed;
bool ll_lock_no_expand;
- rwlock_t fd_lock; /* protect lcc list */
- struct list_head fd_lccs; /* list of ll_cl_context */
/* Used by mirrored file to lead IOs to a specific mirror, usually
* for mirror resync. 0 means default. */
__u32 fd_designated_mirror;
int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io);
enum lcc_type;
-void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io,
+void ll_cl_add(struct inode *inode, const struct lu_env *env, struct cl_io *io,
enum lcc_type type);
-void ll_cl_remove(struct file *file, const struct lu_env *env);
-struct ll_cl_context *ll_cl_find(struct file *file);
+void ll_cl_remove(struct inode *inode, const struct lu_env *env);
+struct ll_cl_context *ll_cl_find(struct inode *inode);
extern const struct address_space_operations ll_aops;
{
lli->lli_inode_magic = LLI_INODE_MAGIC;
lli->lli_flags = 0;
- spin_lock_init(&lli->lli_lock);
+ rwlock_init(&lli->lli_lock);
lli->lli_posix_acl = NULL;
/* Do not set lli_fid, it has been initialized already. */
fid_zero(&lli->lli_pfid);
}
mutex_init(&lli->lli_layout_mutex);
memset(lli->lli_jobid, 0, sizeof(lli->lli_jobid));
+ /* ll_cl_context initialize */
+ INIT_LIST_HEAD(&lli->lli_lccs);
}
#define MAX_STRING_SIZE 128
*/
static vm_fault_t ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
{
+ struct inode *inode = file_inode(vma->vm_file);
struct lu_env *env;
struct cl_io *io;
struct vvp_io *vio = NULL;
if (IS_ERR(env))
RETURN(PTR_ERR(env));
- if (ll_sbi_has_fast_read(ll_i2sbi(file_inode(vma->vm_file)))) {
+ if (ll_sbi_has_fast_read(ll_i2sbi(inode))) {
/* do fast fault */
bool has_retry = vmf->flags & FAULT_FLAG_RETRY_NOWAIT;
/* To avoid loops, instruct downstream to not drop mmap_sem */
vmf->flags |= FAULT_FLAG_RETRY_NOWAIT;
- ll_cl_add(vma->vm_file, env, NULL, LCC_MMAP);
+ ll_cl_add(inode, env, NULL, LCC_MMAP);
fault_ret = ll_filemap_fault(vma, vmf);
- ll_cl_remove(vma->vm_file, env);
+ ll_cl_remove(inode, env);
if (!has_retry)
vmf->flags &= ~FAULT_FLAG_RETRY_NOWAIT;
result = io->ci_result;
if (result == 0) {
- struct file *vm_file = vma->vm_file;
-
vio = vvp_env_io(env);
vio->u.fault.ft_vma = vma;
vio->u.fault.ft_vmpage = NULL;
vio->u.fault.ft_flags = 0;
vio->u.fault.ft_flags_valid = 0;
- get_file(vm_file);
-
/* May call ll_readpage() */
- ll_cl_add(vm_file, env, io, LCC_MMAP);
+ ll_cl_add(inode, env, io, LCC_MMAP);
result = cl_io_loop(env, io);
- ll_cl_remove(vm_file, env);
- fput(vm_file);
+ ll_cl_remove(inode, env);
+
/* ft_flags are only valid if we reached
* the call to filemap_fault */
if (vio->u.fault.ft_flags_valid)
RETURN(result);
}
-struct ll_cl_context *ll_cl_find(struct file *file)
+struct ll_cl_context *ll_cl_find(struct inode *inode)
{
- struct ll_file_data *fd = file->private_data;
+ struct ll_inode_info *lli = ll_i2info(inode);
struct ll_cl_context *lcc;
struct ll_cl_context *found = NULL;
- read_lock(&fd->fd_lock);
- list_for_each_entry(lcc, &fd->fd_lccs, lcc_list) {
+ read_lock(&lli->lli_lock);
+ list_for_each_entry(lcc, &lli->lli_lccs, lcc_list) {
if (lcc->lcc_cookie == current) {
found = lcc;
break;
}
}
- read_unlock(&fd->fd_lock);
+ read_unlock(&lli->lli_lock);
return found;
}
-void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io,
+void ll_cl_add(struct inode *inode, const struct lu_env *env, struct cl_io *io,
enum lcc_type type)
{
- struct ll_file_data *fd = file->private_data;
+ struct ll_inode_info *lli = ll_i2info(inode);
struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
memset(lcc, 0, sizeof(*lcc));
lcc->lcc_io = io;
lcc->lcc_type = type;
- write_lock(&fd->fd_lock);
- list_add(&lcc->lcc_list, &fd->fd_lccs);
- write_unlock(&fd->fd_lock);
+ write_lock(&lli->lli_lock);
+ list_add(&lcc->lcc_list, &lli->lli_lccs);
+ write_unlock(&lli->lli_lock);
}
-void ll_cl_remove(struct file *file, const struct lu_env *env)
+void ll_cl_remove(struct inode *inode, const struct lu_env *env)
{
- struct ll_file_data *fd = file->private_data;
+ struct ll_inode_info *lli = ll_i2info(inode);
struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
- write_lock(&fd->fd_lock);
+ write_lock(&lli->lli_lock);
list_del_init(&lcc->lcc_list);
- write_unlock(&fd->fd_lock);
+ write_unlock(&lli->lli_lock);
}
int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
int result;
ENTRY;
- lcc = ll_cl_find(file);
+ lcc = ll_cl_find(inode);
if (lcc != NULL) {
env = lcc->lcc_env;
io = lcc->lcc_io;
if (ll_iov_iter_alignment(iter) & ~PAGE_MASK)
RETURN(-EINVAL);
- lcc = ll_cl_find(file);
+ lcc = ll_cl_find(inode);
if (lcc == NULL)
RETURN(-EIO);
const struct lu_env *env = NULL;
struct cl_io *io = NULL;
struct cl_page *page = NULL;
-
+ struct inode *inode = file_inode(file);
struct cl_object *clob = ll_i2info(mapping->host)->lli_clob;
pgoff_t index = pos >> PAGE_SHIFT;
struct page *vmpage = NULL;
CDEBUG(D_VFSTRACE, "Writing %lu of %d to %d bytes\n", index, from, len);
- lcc = ll_cl_find(file);
+ lcc = ll_cl_find(inode);
if (lcc == NULL) {
vmpage = grab_cache_page_nowait(mapping, index);
result = ll_tiny_write_begin(vmpage, mapping);
struct ll_inode_info *lli = ll_i2info(inode);
struct posix_acl *acl;
- spin_lock(&lli->lli_lock);
+ read_lock(&lli->lli_lock);
acl = posix_acl_dup(lli->lli_posix_acl);
- spin_unlock(&lli->lli_lock);
+ read_unlock(&lli->lli_lock);
if (!acl)
RETURN(-ENODATA);