page_cache_release(page);
}
+/**
+ * return IF_* type for given lu_dirent entry.
+ * IF_* flag shld be converted to particular OS file type in
+ * platform llite module.
+ */
+static u16 ll_dirent_type_get(struct lu_dirent *ent)
+{
+ u16 type = 0;
+ struct luda_type *lt;
+ int len = 0;
+
+ if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
+ const unsigned align = sizeof(struct luda_type) - 1;
+
+ len = le16_to_cpu(ent->lde_namelen);
+ len = (len + align) & ~align;
+ lt = (void *)ent->lde_name + len;
+ type = IFTODT(le16_to_cpu(lt->lt_type));
+ }
+
+ return type;
+}
+
#ifdef HAVE_DIR_CONTEXT
int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
struct dir_context *ctx)
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/sched.h>
-#include "llite_internal.h"
#include <lustre/ll_fiemap.h>
#include <lustre_ioctl.h>
#include "cl_object.h"
+#include "llite_internal.h"
+#include "vvp_internal.h"
+
static int
ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);
int rc = 0;
ENTRY;
- /* clear group lock, if present */
- if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED))
- ll_put_grouplock(inode, file, fd->fd_grouplock.cg_gid);
+ /* clear group lock, if present */
+ if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED))
+ ll_put_grouplock(inode, file, fd->fd_grouplock.lg_gid);
if (fd->fd_lease_och != NULL) {
bool lease_broken;
{
struct ll_inode_info *lli = ll_i2info(inode);
struct cl_object *obj = lli->lli_clob;
- struct cl_attr *attr = ccc_env_thread_attr(env);
+ struct cl_attr *attr = vvp_env_thread_attr(env);
s64 atime;
s64 mtime;
s64 ctime;
file->f_dentry->d_name.name, iot, *ppos, count);
restart:
- io = ccc_env_thread_io(env);
+ io = vvp_env_thread_io(env);
ll_io_init(io, file, iot == CIT_WRITE);
/* The maximum Lustre file size is variable, based on the
if (IS_ERR(env))
RETURN(PTR_ERR(env));
- args = vvp_env_args(env, IO_NORMAL);
+ args = ll_env_args(env, IO_NORMAL);
args->u.normal.via_iov = (struct iovec *)iov;
args->u.normal.via_nrsegs = nr_segs;
args->u.normal.via_iocb = iocb;
if (IS_ERR(env))
RETURN(PTR_ERR(env));
- local_iov = &vvp_env_info(env)->vti_local_iov;
- kiocb = &vvp_env_info(env)->vti_kiocb;
+ local_iov = &ll_env_info(env)->lti_local_iov;
+ kiocb = &ll_env_info(env)->lti_kiocb;
local_iov->iov_base = (void __user *)buf;
local_iov->iov_len = count;
init_sync_kiocb(kiocb, file);
if (IS_ERR(env))
RETURN(PTR_ERR(env));
- args = vvp_env_args(env, IO_NORMAL);
+ args = ll_env_args(env, IO_NORMAL);
args->u.normal.via_iov = (struct iovec *)iov;
args->u.normal.via_nrsegs = nr_segs;
args->u.normal.via_iocb = iocb;
if (IS_ERR(env))
RETURN(PTR_ERR(env));
- local_iov = &vvp_env_info(env)->vti_local_iov;
- kiocb = &vvp_env_info(env)->vti_kiocb;
+ local_iov = &ll_env_info(env)->lti_local_iov;
+ kiocb = &ll_env_info(env)->lti_kiocb;
local_iov->iov_base = (void __user *)buf;
local_iov->iov_len = count;
init_sync_kiocb(kiocb, file);
if (IS_ERR(env))
RETURN(PTR_ERR(env));
- args = vvp_env_args(env, IO_SPLICE);
+ args = ll_env_args(env, IO_SPLICE);
args->u.splice.via_pipe = pipe;
args->u.splice.via_flags = flags;
{
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
- struct ccc_grouplock grouplock;
+ struct ll_grouplock grouplock;
int rc;
ENTRY;
spin_lock(&lli->lli_lock);
if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
CWARN("group lock already existed with gid %lu\n",
- fd->fd_grouplock.cg_gid);
+ fd->fd_grouplock.lg_gid);
spin_unlock(&lli->lli_lock);
RETURN(-EINVAL);
}
- LASSERT(fd->fd_grouplock.cg_lock == NULL);
+ LASSERT(fd->fd_grouplock.lg_lock == NULL);
spin_unlock(&lli->lli_lock);
rc = cl_get_grouplock(ll_i2info(inode)->lli_clob,
{
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
- struct ccc_grouplock grouplock;
+ struct ll_grouplock grouplock;
ENTRY;
spin_lock(&lli->lli_lock);
CWARN("no group lock held\n");
RETURN(-EINVAL);
}
- LASSERT(fd->fd_grouplock.cg_lock != NULL);
- if (fd->fd_grouplock.cg_gid != arg) {
- CWARN("group lock %lu doesn't match current id %lu\n",
- arg, fd->fd_grouplock.cg_gid);
+ LASSERT(fd->fd_grouplock.lg_lock != NULL);
+
+ if (fd->fd_grouplock.lg_gid != arg) {
+ CWARN("group lock %lu doesn't match current id %lu\n",
+ arg, fd->fd_grouplock.lg_gid);
spin_unlock(&lli->lli_lock);
RETURN(-EINVAL);
}
capa = ll_osscapa_get(inode, CAPA_OPC_OSS_WRITE);
- io = ccc_env_thread_io(env);
+ io = vvp_env_thread_io(env);
io->ci_obj = ll_i2info(inode)->lli_clob;
io->ci_ignore_layout = ignore_layout;
#include "cl_object.h"
#include "llite_internal.h"
+#include "vvp_internal.h"
static const struct cl_lock_descr whole_file = {
.cld_start = 0,
CDEBUG(D_DLMTRACE, "Glimpsing inode "DFID"\n", PFID(fid));
if (lli->lli_has_smd) {
- struct cl_lock *lock = ccc_env_lock(env);
+ struct cl_lock *lock = vvp_env_lock(env);
struct cl_lock_descr *descr = &lock->cll_descr;
/* NOTE: this looks like DLM lock request, but it may
if (S_ISREG(inode->i_mode)) {
env = cl_env_get(refcheck);
if (!IS_ERR(env)) {
- io = ccc_env_thread_io(env);
+ io = vvp_env_thread_io(env);
io->ci_obj = clob;
*envout = env;
*ioout = io;
if (result > 0)
result = io->ci_result;
else if (result == 0) {
- struct cl_lock *lock = ccc_env_lock(env);
+ struct cl_lock *lock = vvp_env_lock(env);
lock->cll_descr = whole_file;
lock->cll_descr.cld_enq_flags = CEF_PEEK;
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*
- * cl code shared between vvp and liblustre (and other Lustre clients in the
- * future).
- *
* Author: Nikita Danilov <nikita.danilov@sun.com>
*/
#include <cl_object.h>
#include "llite_internal.h"
-
-/*
- * ccc_ prefix stands for "Common Client Code".
- */
-
-static struct kmem_cache *ccc_thread_kmem;
-
-static struct lu_kmem_descr ccc_caches[] = {
- {
- .ckd_cache = &ccc_thread_kmem,
- .ckd_name = "ccc_thread_kmem",
- .ckd_size = sizeof (struct ccc_thread_info),
- },
- {
- .ckd_cache = NULL
- }
-};
-
-/*****************************************************************************
- *
- * Vvp device and device type functions.
- *
- */
-
-void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key)
-{
- struct ccc_thread_info *info;
-
- OBD_SLAB_ALLOC_PTR_GFP(info, ccc_thread_kmem, GFP_NOFS);
- if (info == NULL)
- info = ERR_PTR(-ENOMEM);
- return info;
-}
-
-void ccc_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
-{
- struct ccc_thread_info *info = data;
- OBD_SLAB_FREE_PTR(info, ccc_thread_kmem);
-}
-
-struct lu_context_key ccc_key = {
- .lct_tags = LCT_CL_THREAD,
- .lct_init = ccc_key_init,
- .lct_fini = ccc_key_fini
-};
+#include "vvp_internal.h"
/**
- * An `emergency' environment used by ccc_inode_fini() when cl_env_get()
- * fails. Access to this environment is serialized by ccc_inode_fini_guard
+ * An `emergency' environment used by cl_inode_fini() when cl_env_get()
+ * fails. Access to this environment is serialized by cl_inode_fini_guard
* mutex.
*/
-static struct lu_env *ccc_inode_fini_env = NULL;
+struct lu_env *cl_inode_fini_env;
+int cl_inode_fini_refcheck;
/**
* A mutex serializing calls to slp_inode_fini() under extreme memory
* pressure, when environments cannot be allocated.
*/
-static DEFINE_MUTEX(ccc_inode_fini_guard);
-static int dummy_refcheck;
-
-int ccc_global_init(struct lu_device_type *device_type)
-{
- int result;
-
- result = lu_kmem_init(ccc_caches);
- if (result)
- return result;
-
- result = lu_device_type_init(device_type);
- if (result)
- goto out_kmem;
-
- ccc_inode_fini_env = cl_env_alloc(&dummy_refcheck,
- LCT_REMEMBER|LCT_NOREF);
- if (IS_ERR(ccc_inode_fini_env)) {
- result = PTR_ERR(ccc_inode_fini_env);
- goto out_device;
- }
-
- ccc_inode_fini_env->le_ctx.lc_cookie = 0x4;
- return 0;
-out_device:
- lu_device_type_fini(device_type);
-out_kmem:
- lu_kmem_fini(ccc_caches);
- return result;
-}
-
-void ccc_global_fini(struct lu_device_type *device_type)
-{
- if (ccc_inode_fini_env != NULL) {
- cl_env_put(ccc_inode_fini_env, &dummy_refcheck);
- ccc_inode_fini_env = NULL;
- }
- lu_device_type_fini(device_type);
- lu_kmem_fini(ccc_caches);
-}
+static DEFINE_MUTEX(cl_inode_fini_guard);
int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
struct obd_capa *capa)
if (IS_ERR(env))
RETURN(PTR_ERR(env));
- io = ccc_env_thread_io(env);
+ io = vvp_env_thread_io(env);
io->ci_obj = ll_i2info(inode)->lli_clob;
io->u.ci_setattr.sa_attr.lvb_atime = LTIME_S(attr->ia_atime);
cookie = cl_env_reenter();
env = cl_env_get(&refcheck);
emergency = IS_ERR(env);
- if (emergency) {
- mutex_lock(&ccc_inode_fini_guard);
- LASSERT(ccc_inode_fini_env != NULL);
- cl_env_implant(ccc_inode_fini_env, &refcheck);
- env = ccc_inode_fini_env;
- }
+ if (emergency) {
+ mutex_lock(&cl_inode_fini_guard);
+ LASSERT(cl_inode_fini_env != NULL);
+ cl_env_implant(cl_inode_fini_env, &refcheck);
+ env = cl_inode_fini_env;
+ }
+
/*
* cl_object cache is a slave to inode cache (which, in turn
* is a slave to dentry cache), don't keep cl_object in memory
lu_object_ref_del(&clob->co_lu, "inode", inode);
cl_object_put_last(env, clob);
lli->lli_clob = NULL;
- if (emergency) {
- cl_env_unplant(ccc_inode_fini_env, &refcheck);
- mutex_unlock(&ccc_inode_fini_guard);
- } else
- cl_env_put(env, &refcheck);
+ if (emergency) {
+ cl_env_unplant(cl_inode_fini_env, &refcheck);
+ mutex_unlock(&cl_inode_fini_guard);
+ } else {
+ cl_env_put(env, &refcheck);
+ }
+
cl_env_reexit(cookie);
}
}
/**
- * return IF_* type for given lu_dirent entry.
- * IF_* flag shld be converted to particular OS file type in
- * platform llite module.
- */
-__u16 ll_dirent_type_get(struct lu_dirent *ent)
-{
- __u16 type = 0;
- struct luda_type *lt;
- int len = 0;
-
- if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
- const unsigned align = sizeof(struct luda_type) - 1;
-
- len = le16_to_cpu(ent->lde_namelen);
- len = (len + align) & ~align;
- lt = (void *)ent->lde_name + len;
- type = IFTODT(le16_to_cpu(lt->lt_type));
- }
- return type;
-}
-
-/**
* build inode number from passed @fid */
__u64 cl_fid_build_ino(const struct lu_fid *fid, int api32)
{
#include "llite_internal.h"
-
/* Initialize the default and maximum LOV EA and cookie sizes. This allows
* us to make MDS RPCs with large enough reply buffers to hold the
* maximum-sized (= maximum striped) EA and cookie without having to
* calculate this (via a call into the LOV + OSCs) each time we make an RPC. */
-int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
+static int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
{
struct lov_stripe_md lsm = { .lsm_magic = LOV_MAGIC_V3 };
__u32 valsize = sizeof(struct lov_desc);
#define GROUPLOCK_SCOPE "grouplock"
int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
- struct ccc_grouplock *cg)
+ struct ll_grouplock *lg)
{
struct lu_env *env;
struct cl_io *io;
if (IS_ERR(env))
return PTR_ERR(env);
- io = ccc_env_thread_io(env);
+ io = vvp_env_thread_io(env);
io->ci_obj = obj;
io->ci_ignore_layout = 1;
return rc;
}
- lock = ccc_env_lock(env);
+ lock = vvp_env_lock(env);
descr = &lock->cll_descr;
descr->cld_obj = obj;
descr->cld_start = 0;
return rc;
}
- cg->cg_env = cl_env_get(&refcheck);
- cg->cg_io = io;
- cg->cg_lock = lock;
- cg->cg_gid = gid;
- LASSERT(cg->cg_env == env);
+ lg->lg_env = cl_env_get(&refcheck);
+ lg->lg_io = io;
+ lg->lg_lock = lock;
+ lg->lg_gid = gid;
+ LASSERT(lg->lg_env == env);
- cl_env_unplant(env, &refcheck);
- return 0;
+ cl_env_unplant(env, &refcheck);
+ return 0;
}
-void cl_put_grouplock(struct ccc_grouplock *cg)
+void cl_put_grouplock(struct ll_grouplock *lg)
{
- struct lu_env *env = cg->cg_env;
- struct cl_io *io = cg->cg_io;
- struct cl_lock *lock = cg->cg_lock;
+ struct lu_env *env = lg->lg_env;
+ struct cl_io *io = lg->lg_io;
+ struct cl_lock *lock = lg->lg_lock;
int refcheck;
- LASSERT(cg->cg_env);
- LASSERT(cg->cg_gid);
+ LASSERT(lg->lg_env != NULL);
+ LASSERT(lg->lg_gid != 0);
cl_env_implant(env, &refcheck);
cl_env_put(env, &refcheck);
cl_io_fini(env, io);
cl_env_put(env, NULL);
}
-
lrp_fsuid/lrp_fsgid. */
};
+struct ll_grouplock {
+ struct lu_env *lg_env;
+ struct cl_io *lg_io;
+ struct cl_lock *lg_lock;
+ unsigned long lg_gid;
+};
+
enum lli_flags {
/* File data is modified. */
LLIF_DATA_MODIFIED = 1 << 0,
struct lustre_handle;
struct ll_file_data {
struct ll_readahead_state fd_ras;
- struct ccc_grouplock fd_grouplock;
+ struct ll_grouplock fd_grouplock;
__u64 lfd_pos;
__u32 fd_flags;
fmode_t fd_omode;
void ll_ras_enter(struct file *f);
+/* llite/lcommon_misc.c */
+int cl_ocd_update(struct obd_device *host, struct obd_device *watched,
+ enum obd_notify_event ev, void *owner, void *data);
+int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
+ struct ll_grouplock *lg);
+void cl_put_grouplock(struct ll_grouplock *lg);
+
/* llite/lproc_llite.c */
#ifdef CONFIG_PROC_FS
int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
int ll_get_max_cookiesize(struct ll_sb_info *sbi, int *max_cookiesize);
int ll_get_default_cookiesize(struct ll_sb_info *sbi, int *default_cookiesize);
int ll_process_config(struct lustre_cfg *lcfg);
+
+enum {
+ LUSTRE_OPC_MKDIR = 0,
+ LUSTRE_OPC_SYMLINK = 1,
+ LUSTRE_OPC_MKNOD = 2,
+ LUSTRE_OPC_CREATE = 3,
+ LUSTRE_OPC_ANY = 5,
+};
+
struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
struct inode *i1, struct inode *i2,
const char *name, size_t namelen,
struct cl_page *lcc_page;
};
-struct vvp_thread_info {
- struct iovec vti_local_iov;
- struct vvp_io_args vti_args;
- struct ra_io_arg vti_ria;
- struct kiocb vti_kiocb;
- struct ll_cl_context vti_io_ctx;
+struct ll_thread_info {
+ struct iovec lti_local_iov;
+ struct vvp_io_args lti_args;
+ struct ra_io_arg lti_ria;
+ struct kiocb lti_kiocb;
+ struct ll_cl_context lti_io_ctx;
};
-extern struct lu_context_key vvp_key;
+extern struct lu_context_key ll_thread_key;
-static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env)
+static inline struct ll_thread_info *ll_env_info(const struct lu_env *env)
{
- struct vvp_thread_info *info;
+ struct ll_thread_info *lti;
+
+ lti = lu_context_key_get(&env->le_ctx, &ll_thread_key);
+ LASSERT(lti != NULL);
- info = lu_context_key_get(&env->le_ctx, &vvp_key);
- LASSERT(info != NULL);
- return info;
+ return lti;
}
-static inline struct vvp_io_args *vvp_env_args(const struct lu_env *env,
- enum vvp_io_subtype type)
+static inline struct vvp_io_args *ll_env_args(const struct lu_env *env,
+ enum vvp_io_subtype type)
{
- struct vvp_io_args *ret = &vvp_env_info(env)->vti_args;
+ struct vvp_io_args *via = &ll_env_info(env)->lti_args;
- ret->via_io_subtype = type;
+ via->via_io_subtype = type;
- return ret;
+ return via;
}
-int vvp_global_init(void);
-void vvp_global_fini(void);
-
/* llite/llite_mmap.c */
int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last);
void ll_clear_inode_capas(struct inode *inode);
void ll_print_capa_stat(struct ll_sb_info *sbi);
-/* llite/llite_cl.c */
-extern struct lu_device_type vvp_device_type;
-
/**
* Common IO arguments for various VFS I/O interfaces.
*/
void ll_authorize_statahead(struct inode *dir, void *key);
void ll_deauthorize_statahead(struct inode *dir, void *key);
+/* glimpse.c */
+blkcnt_t dirty_cnt(struct inode *inode);
+
+int cl_glimpse_size0(struct inode *inode, int agl);
+int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
+ struct inode *inode, struct cl_object *clob, int agl);
+
+static inline int cl_glimpse_size(struct inode *inode)
+{
+ return cl_glimpse_size0(inode, 0);
+}
+
+static inline int cl_agl(struct inode *inode)
+{
+ return cl_glimpse_size0(inode, 1);
+}
+
static inline int ll_glimpse_size(struct inode *inode)
{
struct ll_inode_info *lli = ll_i2info(inode);
int ll_getparent(struct file *file, struct getparent __user *arg);
+/* lcommon_cl.c */
+int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
+ struct obd_capa *capa);
+
+extern struct lu_env *cl_inode_fini_env;
+extern int cl_inode_fini_refcheck;
+
+int cl_file_inode_init(struct inode *inode, struct lustre_md *md);
+void cl_inode_fini(struct inode *inode);
+int cl_local_size(struct inode *inode);
+
+u64 cl_fid_build_ino(const struct lu_fid *fid, int api32);
+u32 cl_fid_build_gen(const struct lu_fid *fid);
+
#endif /* LLITE_INTERNAL_H */
{
char *buf, *path = NULL;
struct dentry *dentry = NULL;
- struct vvp_object *obj = cl_inode2vvp(page->mapping->host);
+ struct inode *inode = page->mapping->host;
/* this can be called inside spin lock so use GFP_ATOMIC. */
buf = (char *)__get_free_page(GFP_ATOMIC);
"%s: dirty page discard: %s/fid: "DFID"/%s may get corrupted "
"(rc %d)\n", ll_get_fsname(page->mapping->host->i_sb, NULL, 0),
s2lsi(page->mapping->host->i_sb)->lsi_lmd->lmd_dev,
- PFID(&obj->vob_header.coh_lu.loh_fid),
+ PFID(ll_inode2fid(inode)),
(path && !IS_ERR(path)) ? path : "", ioret);
if (dentry != NULL)
*env_ret = env;
- io = ccc_env_thread_io(env);
+ io = vvp_env_thread_io(env);
io->ci_obj = ll_i2info(inode)->lli_clob;
LASSERT(io->ci_obj != NULL);
struct ll_readahead_state *ras, bool hit)
{
struct vvp_io *vio = vvp_env_io(env);
- struct vvp_thread_info *vti = vvp_env_info(env);
- struct cl_attr *attr = ccc_env_thread_attr(env);
+ struct ll_thread_info *lti = ll_env_info(env);
+ struct cl_attr *attr = vvp_env_thread_attr(env);
unsigned long len, mlen = 0, reserved;
pgoff_t ra_end, start = 0, end = 0;
struct inode *inode;
- struct ra_io_arg *ria = &vti->vti_ria;
+ struct ra_io_arg *ria = <i->lti_ria;
struct cl_object *clob;
int ret = 0;
__u64 kms;
clob = ll_i2info(inode)->lli_clob;
LASSERT(clob != NULL);
- io = ccc_env_thread_io(env);
+ io = vvp_env_thread_io(env);
io->ci_obj = clob;
io->ci_ignore_layout = 1;
result = cl_io_init(env, io, CIT_MISC, clob);
void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io)
{
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
- struct ll_cl_context *lcc = &vvp_env_info(env)->vti_io_ctx;
+ struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
memset(lcc, 0, sizeof(*lcc));
INIT_LIST_HEAD(&lcc->lcc_list);
void ll_cl_remove(struct file *file, const struct lu_env *env)
{
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
- struct ll_cl_context *lcc = &vvp_env_info(env)->vti_io_ctx;
+ struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
write_lock(&fd->fd_lock);
list_del_init(&lcc->lcc_list);
static int ll_prepare_partial_page(const struct lu_env *env, struct cl_io *io,
struct cl_page *pg)
{
- struct cl_attr *attr = ccc_env_thread_attr(env);
+ struct cl_attr *attr = vvp_env_thread_attr(env);
struct cl_object *obj = io->ci_obj;
struct vvp_page *vpg = cl_object_page_slice(obj, pg);
loff_t offset = cl_offset(obj, vvp_index(vpg));
#include <linux/fs.h>
#include <lprocfs_status.h>
#include "llite_internal.h"
+#include "vvp_internal.h"
static struct kmem_cache *ll_inode_cachep;
if (rc != 0)
GOTO(out_capa, rc);
+ cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck,
+ LCT_REMEMBER | LCT_NOREF);
+ if (IS_ERR(cl_inode_fini_env))
+ GOTO(out_vvp, rc = PTR_ERR(cl_inode_fini_env));
+
+ cl_inode_fini_env->le_ctx.lc_cookie = 0x4;
+
rc = ll_xattr_init();
if (rc != 0)
- GOTO(out_vvp, rc);
+ GOTO(out_inode_fini_env, rc);
lustre_register_client_fill_super(ll_fill_super);
lustre_register_kill_super_cb(ll_kill_super);
RETURN(0);
+out_inode_fini_env:
+ cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
out_vvp:
vvp_global_fini();
out_capa:
lprocfs_remove(&proc_lustre_fs_root);
ll_xattr_fini();
+ cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
vvp_global_fini();
del_timer(&ll_capa_timer);
ll_capa_thread_stop();
#define DEBUG_SUBSYSTEM S_LLITE
-
#include <obd.h>
#include "llite_internal.h"
#include "vvp_internal.h"
* "llite_" (var. "ll_") prefix.
*/
+static struct kmem_cache *ll_thread_kmem;
struct kmem_cache *vvp_lock_kmem;
struct kmem_cache *vvp_object_kmem;
struct kmem_cache *vvp_req_kmem;
-static struct kmem_cache *vvp_thread_kmem;
static struct kmem_cache *vvp_session_kmem;
+static struct kmem_cache *vvp_thread_kmem;
+
static struct lu_kmem_descr vvp_caches[] = {
{
+ .ckd_cache = &ll_thread_kmem,
+ .ckd_name = "ll_thread_kmem",
+ .ckd_size = sizeof(struct ll_thread_info),
+ },
+ {
.ckd_cache = &vvp_lock_kmem,
.ckd_name = "vvp_lock_kmem",
.ckd_size = sizeof(struct vvp_lock),
.ckd_size = sizeof(struct vvp_req),
},
{
- .ckd_cache = &vvp_thread_kmem,
- .ckd_name = "vvp_thread_kmem",
- .ckd_size = sizeof (struct vvp_thread_info),
- },
- {
.ckd_cache = &vvp_session_kmem,
.ckd_name = "vvp_session_kmem",
.ckd_size = sizeof (struct vvp_session)
},
+ {
+ .ckd_cache = &vvp_thread_kmem,
+ .ckd_name = "vvp_thread_kmem",
+ .ckd_size = sizeof(struct vvp_thread_info),
+ },
{
.ckd_cache = NULL
}
};
-static void *vvp_key_init(const struct lu_context *ctx,
- struct lu_context_key *key)
+static void *ll_thread_key_init(const struct lu_context *ctx,
+ struct lu_context_key *key)
{
- struct vvp_thread_info *info;
+ struct ll_thread_info *lti;
+
+ OBD_SLAB_ALLOC_PTR_GFP(lti, ll_thread_kmem, GFP_NOFS);
+ if (lti == NULL)
+ lti = ERR_PTR(-ENOMEM);
- OBD_SLAB_ALLOC_PTR_GFP(info, vvp_thread_kmem, GFP_NOFS);
- if (info == NULL)
- info = ERR_PTR(-ENOMEM);
- return info;
+ return lti;
}
-static void vvp_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
+static void ll_thread_key_fini(const struct lu_context *ctx,
+ struct lu_context_key *key, void *data)
{
- struct vvp_thread_info *info = data;
- OBD_SLAB_FREE_PTR(info, vvp_thread_kmem);
+ struct ll_thread_info *lti = data;
+
+ OBD_SLAB_FREE_PTR(lti, ll_thread_kmem);
}
+struct lu_context_key ll_thread_key = {
+ .lct_tags = LCT_CL_THREAD,
+ .lct_init = ll_thread_key_init,
+ .lct_fini = ll_thread_key_fini,
+};
+
static void *vvp_session_key_init(const struct lu_context *ctx,
struct lu_context_key *key)
{
OBD_SLAB_FREE_PTR(session, vvp_session_kmem);
}
-
-struct lu_context_key vvp_key = {
- .lct_tags = LCT_CL_THREAD,
- .lct_init = vvp_key_init,
- .lct_fini = vvp_key_fini
-};
-
struct lu_context_key vvp_session_key = {
.lct_tags = LCT_SESSION,
.lct_init = vvp_session_key_init,
.lct_fini = vvp_session_key_fini
};
+static void *vvp_thread_key_init(const struct lu_context *ctx,
+ struct lu_context_key *key)
+{
+ struct vvp_thread_info *vti;
+
+ OBD_SLAB_ALLOC_PTR_GFP(vti, vvp_thread_kmem, GFP_NOFS);
+ if (vti == NULL)
+ vti = ERR_PTR(-ENOMEM);
+ return vti;
+}
+
+static void vvp_thread_key_fini(const struct lu_context *ctx,
+ struct lu_context_key *key, void *data)
+{
+ struct vvp_thread_info *vti = data;
+ OBD_SLAB_FREE_PTR(vti, vvp_thread_kmem);
+}
+
+struct lu_context_key vvp_thread_key = {
+ .lct_tags = LCT_CL_THREAD,
+ .lct_init = vvp_thread_key_init,
+ .lct_fini = vvp_thread_key_fini,
+};
+
/* type constructor/destructor: vvp_type_{init,fini,start,stop}(). */
-LU_TYPE_INIT_FINI(vvp, &ccc_key, &vvp_key, &vvp_session_key);
+LU_TYPE_INIT_FINI(vvp, &ll_thread_key, &vvp_session_key, &vvp_thread_key);
static const struct lu_device_operations vvp_lu_ops = {
.ldo_object_alloc = vvp_object_alloc
*/
int vvp_global_init(void)
{
- int result;
+ int rc;
- result = lu_kmem_init(vvp_caches);
- if (result == 0) {
- result = ccc_global_init(&vvp_device_type);
- if (result != 0)
- lu_kmem_fini(vvp_caches);
- }
- return result;
+ rc = lu_kmem_init(vvp_caches);
+ if (rc != 0)
+ return rc;
+
+ rc = lu_device_type_init(&vvp_device_type);
+ if (rc != 0)
+ goto out_kmem;
+
+ return 0;
+
+out_kmem:
+ lu_kmem_fini(vvp_caches);
+
+ return rc;
}
void vvp_global_fini(void)
{
- ccc_global_fini(&vvp_device_type);
- lu_kmem_fini(vvp_caches);
+ lu_device_type_fini(&vvp_device_type);
+ lu_kmem_fini(vvp_caches);
}
-
/*****************************************************************************
*
* mirror obd-devices into cl devices.
struct obd_export;
struct page;
-blkcnt_t dirty_cnt(struct inode *inode);
-
-int cl_glimpse_size0(struct inode *inode, int agl);
-int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
- struct inode *inode, struct cl_object *clob, int agl);
-
-static inline int cl_glimpse_size(struct inode *inode)
-{
- return cl_glimpse_size0(inode, 0);
-}
-
-static inline int cl_agl(struct inode *inode)
-{
- return cl_glimpse_size0(inode, 1);
-}
-
-/**
- * Locking policy for setattr.
- */
-enum ccc_setattr_lock_type {
- /** Locking is done by server */
- SETATTR_NOLOCK,
- /** Extent lock is enqueued */
- SETATTR_EXTENT_LOCK,
- /** Existing local extent lock is used */
- SETATTR_MATCH_LOCK
-};
-
enum vvp_io_subtype {
/** normal IO */
IO_NORMAL,
bool ft_flags_valid;
} fault;
struct {
- enum ccc_setattr_lock_type vui_local_lock;
- } setattr;
- struct {
struct pipe_inode_info *vui_pipe;
unsigned int vui_flags;
} splice;
bool vui_ra_valid;
};
-extern struct lu_context_key ccc_key;
+extern struct lu_device_type vvp_device_type;
+
extern struct lu_context_key vvp_session_key;
+extern struct lu_context_key vvp_thread_key;
extern struct kmem_cache *vvp_lock_kmem;
extern struct kmem_cache *vvp_object_kmem;
extern struct kmem_cache *vvp_req_kmem;
-struct ccc_thread_info {
- struct cl_lock cti_lock;
- struct cl_lock_descr cti_descr;
- struct cl_io cti_io;
- struct cl_attr cti_attr;
+struct vvp_thread_info {
+ struct cl_lock vti_lock;
+ struct cl_lock_descr vti_descr;
+ struct cl_io vti_io;
+ struct cl_attr vti_attr;
};
-static inline struct ccc_thread_info *ccc_env_info(const struct lu_env *env)
+static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env)
{
- struct ccc_thread_info *info;
+ struct vvp_thread_info *vti;
- info = lu_context_key_get(&env->le_ctx, &ccc_key);
- LASSERT(info != NULL);
+ vti = lu_context_key_get(&env->le_ctx, &vvp_thread_key);
+ LASSERT(vti != NULL);
- return info;
+ return vti;
}
-static inline struct cl_lock *ccc_env_lock(const struct lu_env *env)
+static inline struct cl_lock *vvp_env_lock(const struct lu_env *env)
{
- struct cl_lock *lock = &ccc_env_info(env)->cti_lock;
+ struct cl_lock *lock = &vvp_env_info(env)->vti_lock;
memset(lock, 0, sizeof(*lock));
return lock;
}
-static inline struct cl_attr *ccc_env_thread_attr(const struct lu_env *env)
+static inline struct cl_attr *vvp_env_thread_attr(const struct lu_env *env)
{
- struct cl_attr *attr = &ccc_env_info(env)->cti_attr;
+ struct cl_attr *attr = &vvp_env_info(env)->vti_attr;
memset(attr, 0, sizeof(*attr));
return attr;
}
-static inline struct cl_io *ccc_env_thread_io(const struct lu_env *env)
+static inline struct cl_io *vvp_env_thread_io(const struct lu_env *env)
{
- struct cl_io *io = &ccc_env_info(env)->cti_io;
+ struct cl_io *io = &vvp_env_info(env)->vti_io;
memset(io, 0, sizeof(*io));
}
struct vvp_session {
- struct vvp_io cs_ios;
+ struct vvp_io vs_ios;
};
static inline struct vvp_session *vvp_env_session(const struct lu_env *env)
static inline struct vvp_io *vvp_env_io(const struct lu_env *env)
{
- return &vvp_env_session(env)->cs_ios;
+ return &vvp_env_session(env)->vs_ios;
}
/**
- * ccc-private object state.
+ * VPP-private object state.
*/
struct vvp_object {
struct cl_object_header vob_header;
struct cl_req_slice vrq_cl;
};
-void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key);
-void ccc_key_fini(const struct lu_context *ctx, struct lu_context_key *key,
- void *data);
-
-void ccc_umount(const struct lu_env *env, struct cl_device *dev);
-int ccc_global_init(struct lu_device_type *device_type);
-void ccc_global_fini(struct lu_device_type *device_type);
-
static inline struct lu_device *vvp2lu_dev(struct vvp_device *vdv)
{
return &vdv->vdv_cl.cd_lu_dev;
return container_of(slice, struct vvp_lock, vlk_cl);
}
-int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
- struct obd_capa *capa);
-
-int cl_file_inode_init(struct inode *inode, struct lustre_md *md);
-void cl_inode_fini(struct inode *inode);
-int cl_local_size(struct inode *inode);
-
-__u16 ll_dirent_type_get(struct lu_dirent *ent);
-__u64 cl_fid_build_ino(const struct lu_fid *fid, int api32);
-__u32 cl_fid_build_gen(const struct lu_fid *fid);
-
#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK
# define CLOBINVRNT(env, clob, expr) \
do { \
((void)sizeof(env), (void)sizeof(clob), (void)sizeof !!(expr))
#endif /* CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */
-int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp);
-int cl_ocd_update(struct obd_device *host,
- struct obd_device *watched,
- enum obd_notify_event ev, void *owner, void *data);
-
-struct ccc_grouplock {
- struct lu_env *cg_env;
- struct cl_io *cg_io;
- struct cl_lock *cg_lock;
- unsigned long cg_gid;
-};
-
-int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
- struct ccc_grouplock *cg);
-void cl_put_grouplock(struct ccc_grouplock *cg);
-
/**
* New interfaces to get and put lov_stripe_md from lov layer. This violates
* layering because lov_stripe_md is supposed to be a private data in lov.
struct lov_stripe_md *ccc_inode_lsm_get(struct inode *inode);
void ccc_inode_lsm_put(struct inode *inode, struct lov_stripe_md *lsm);
-enum {
- LUSTRE_OPC_MKDIR = 0,
- LUSTRE_OPC_SYMLINK = 1,
- LUSTRE_OPC_MKNOD = 2,
- LUSTRE_OPC_CREATE = 3,
- LUSTRE_OPC_ANY = 5,
-};
-
int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
struct cl_io *io);
int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io);
const struct lu_object_header *hdr,
struct lu_device *dev);
+int vvp_global_init(void);
+void vvp_global_fini(void);
+
extern const struct file_operations vvp_dump_pgcache_file_ops;
#endif /* VVP_INTERNAL_H */
struct cl_io *io, loff_t start, size_t count,
int *exceed)
{
- struct cl_attr *attr = ccc_env_thread_attr(env);
+ struct cl_attr *attr = vvp_env_thread_attr(env);
struct inode *inode = vvp_object_inode(obj);
loff_t pos = start + count - 1;
loff_t kms;
if (vio->vui_fd && (vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
descr->cld_mode = CLM_GROUP;
- descr->cld_gid = vio->vui_fd->fd_grouplock.cg_gid;
+ descr->cld_gid = vio->vui_fd->fd_grouplock.lg_gid;
} else {
descr->cld_mode = mode;
}
static int vvp_mmap_locks(const struct lu_env *env,
struct vvp_io *vio, struct cl_io *io)
{
- struct ccc_thread_info *cti = ccc_env_info(env);
+ struct vvp_thread_info *vti = vvp_env_info(env);
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
- struct cl_lock_descr *descr = &cti->cti_descr;
+ struct cl_lock_descr *descr = &vti->vti_descr;
ldlm_policy_data_t policy;
unsigned long addr;
unsigned long seg;
static int vvp_io_setattr_lock(const struct lu_env *env,
const struct cl_io_slice *ios)
{
- struct vvp_io *vio = vvp_env_io(env);
struct cl_io *io = ios->cis_io;
__u64 new_size;
__u32 enqflags = 0;
new_size = 0;
}
- vio->u.setattr.vui_local_lock = SETATTR_EXTENT_LOCK;
-
return vvp_io_one_lock(env, io, enqflags, CLM_WRITE,
new_size, OBD_OBJECT_EOF);
}
{
struct cl_io *io = ios->cis_io;
struct cl_object *obj = io->ci_obj;
- struct cl_attr *attr = ccc_env_thread_attr(env);
+ struct cl_attr *attr = vvp_env_thread_attr(env);
int result;
unsigned valid = CAT_CTIME;