Commit d2995737 authored by John L. Hammond's avatar John L. Hammond Committed by Greg Kroah-Hartman

staging/lustre/llite: remove lli_lvb

In struct ll_inode_info remove the struct ost_lvb lli_lvb member and
replace it with obd_time lli_{a,m,c}time. Rename ll_merge_lvb() to
ll_merge_attr(). Remove cl_merge_lvb() and replace calls to it with
calls to ll_merge_attr().
Signed-off-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/12849
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675Reviewed-by: default avatarBobi Jam <bobijam@gmail.com>
Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fd7444fe
...@@ -994,50 +994,57 @@ int ll_inode_getattr(struct inode *inode, struct obdo *obdo, ...@@ -994,50 +994,57 @@ int ll_inode_getattr(struct inode *inode, struct obdo *obdo,
return rc; return rc;
} }
int ll_merge_lvb(const struct lu_env *env, struct inode *inode) int ll_merge_attr(const struct lu_env *env, struct inode *inode)
{ {
struct ll_inode_info *lli = ll_i2info(inode); struct ll_inode_info *lli = ll_i2info(inode);
struct cl_object *obj = lli->lli_clob; struct cl_object *obj = lli->lli_clob;
struct cl_attr *attr = ccc_env_thread_attr(env); struct cl_attr *attr = ccc_env_thread_attr(env);
struct ost_lvb lvb; s64 atime;
s64 mtime;
s64 ctime;
int rc = 0; int rc = 0;
ll_inode_size_lock(inode); ll_inode_size_lock(inode);
/* merge timestamps the most recently obtained from mds with /* merge timestamps the most recently obtained from mds with
* timestamps obtained from osts * timestamps obtained from osts
*/ */
LTIME_S(inode->i_atime) = lli->lli_lvb.lvb_atime; LTIME_S(inode->i_atime) = lli->lli_atime;
LTIME_S(inode->i_mtime) = lli->lli_lvb.lvb_mtime; LTIME_S(inode->i_mtime) = lli->lli_mtime;
LTIME_S(inode->i_ctime) = lli->lli_lvb.lvb_ctime; LTIME_S(inode->i_ctime) = lli->lli_ctime;
lvb.lvb_size = i_size_read(inode); mtime = LTIME_S(inode->i_mtime);
lvb.lvb_blocks = inode->i_blocks; atime = LTIME_S(inode->i_atime);
lvb.lvb_mtime = LTIME_S(inode->i_mtime); ctime = LTIME_S(inode->i_ctime);
lvb.lvb_atime = LTIME_S(inode->i_atime);
lvb.lvb_ctime = LTIME_S(inode->i_ctime);
cl_object_attr_lock(obj); cl_object_attr_lock(obj);
rc = cl_object_attr_get(env, obj, attr); rc = cl_object_attr_get(env, obj, attr);
cl_object_attr_unlock(obj); cl_object_attr_unlock(obj);
if (rc == 0) { if (rc != 0)
if (lvb.lvb_atime < attr->cat_atime) goto out_size_unlock;
lvb.lvb_atime = attr->cat_atime;
if (lvb.lvb_ctime < attr->cat_ctime) if (atime < attr->cat_atime)
lvb.lvb_ctime = attr->cat_ctime; atime = attr->cat_atime;
if (lvb.lvb_mtime < attr->cat_mtime)
lvb.lvb_mtime = attr->cat_mtime; if (ctime < attr->cat_ctime)
ctime = attr->cat_ctime;
if (mtime < attr->cat_mtime)
mtime = attr->cat_mtime;
CDEBUG(D_VFSTRACE, DFID " updating i_size %llu\n", CDEBUG(D_VFSTRACE, DFID " updating i_size %llu\n",
PFID(&lli->lli_fid), attr->cat_size); PFID(&lli->lli_fid), attr->cat_size);
cl_isize_write_nolock(inode, attr->cat_size); cl_isize_write_nolock(inode, attr->cat_size);
inode->i_blocks = attr->cat_blocks; inode->i_blocks = attr->cat_blocks;
LTIME_S(inode->i_mtime) = lvb.lvb_mtime; LTIME_S(inode->i_mtime) = mtime;
LTIME_S(inode->i_atime) = lvb.lvb_atime; LTIME_S(inode->i_atime) = atime;
LTIME_S(inode->i_ctime) = lvb.lvb_ctime; LTIME_S(inode->i_ctime) = ctime;
}
out_size_unlock:
ll_inode_size_unlock(inode); ll_inode_size_unlock(inode);
return rc; return rc;
...@@ -1936,7 +1943,7 @@ int ll_hsm_release(struct inode *inode) ...@@ -1936,7 +1943,7 @@ int ll_hsm_release(struct inode *inode)
goto out; goto out;
} }
ll_merge_lvb(env, inode); ll_merge_attr(env, inode);
cl_env_nested_put(&nest, env); cl_env_nested_put(&nest, env);
/* Release the file. /* Release the file.
...@@ -3001,9 +3008,9 @@ static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits) ...@@ -3001,9 +3008,9 @@ static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
/* if object isn't regular file, don't validate size */ /* if object isn't regular file, don't validate size */
if (!S_ISREG(inode->i_mode)) { if (!S_ISREG(inode->i_mode)) {
LTIME_S(inode->i_atime) = ll_i2info(inode)->lli_lvb.lvb_atime; LTIME_S(inode->i_atime) = ll_i2info(inode)->lli_atime;
LTIME_S(inode->i_mtime) = ll_i2info(inode)->lli_lvb.lvb_mtime; LTIME_S(inode->i_mtime) = ll_i2info(inode)->lli_mtime;
LTIME_S(inode->i_ctime) = ll_i2info(inode)->lli_lvb.lvb_ctime; LTIME_S(inode->i_ctime) = ll_i2info(inode)->lli_ctime;
} else { } else {
/* In case of restore, the MDT has the right size and has /* In case of restore, the MDT has the right size and has
* already send it back without granting the layout lock, * already send it back without granting the layout lock,
......
...@@ -139,7 +139,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, ...@@ -139,7 +139,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
LASSERT(agl == 0); LASSERT(agl == 0);
result = cl_wait(env, lock); result = cl_wait(env, lock);
if (result == 0) { if (result == 0) {
cl_merge_lvb(env, inode); ll_merge_attr(env, inode);
if (cl_isize_read(inode) > 0 && if (cl_isize_read(inode) > 0 &&
inode->i_blocks == 0) { inode->i_blocks == 0) {
/* /*
...@@ -155,7 +155,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, ...@@ -155,7 +155,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
cl_lock_release(env, lock, "glimpse", current); cl_lock_release(env, lock, "glimpse", current);
} else { } else {
CDEBUG(D_DLMTRACE, "No objects for inode\n"); CDEBUG(D_DLMTRACE, "No objects for inode\n");
cl_merge_lvb(env, inode); ll_merge_attr(env, inode);
} }
} }
...@@ -259,7 +259,7 @@ int cl_local_size(struct inode *inode) ...@@ -259,7 +259,7 @@ int cl_local_size(struct inode *inode)
descr->cld_obj = clob; descr->cld_obj = clob;
lock = cl_lock_peek(env, io, descr, "localsize", current); lock = cl_lock_peek(env, io, descr, "localsize", current);
if (lock) { if (lock) {
cl_merge_lvb(env, inode); ll_merge_attr(env, inode);
cl_unuse(env, lock); cl_unuse(env, lock);
cl_lock_release(env, lock, "localsize", current); cl_lock_release(env, lock, "localsize", current);
result = 0; result = 0;
......
...@@ -591,7 +591,7 @@ void ccc_lock_state(const struct lu_env *env, ...@@ -591,7 +591,7 @@ void ccc_lock_state(const struct lu_env *env,
*/ */
if (lock->cll_descr.cld_start == 0 && if (lock->cll_descr.cld_start == 0 &&
lock->cll_descr.cld_end == CL_PAGE_EOF) lock->cll_descr.cld_end == CL_PAGE_EOF)
cl_merge_lvb(env, inode); ll_merge_attr(env, inode);
} }
} }
......
...@@ -161,7 +161,9 @@ struct ll_inode_info { ...@@ -161,7 +161,9 @@ struct ll_inode_info {
struct inode lli_vfs_inode; struct inode lli_vfs_inode;
/* the most recent timestamps obtained from mds */ /* the most recent timestamps obtained from mds */
struct ost_lvb lli_lvb; s64 lli_atime;
s64 lli_mtime;
s64 lli_ctime;
spinlock_t lli_agl_lock; spinlock_t lli_agl_lock;
/* Try to make the d::member and f::member are aligned. Before using /* Try to make the d::member and f::member are aligned. Before using
...@@ -752,7 +754,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, ...@@ -752,7 +754,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp,
int *lmm_size, struct ptlrpc_request **request); int *lmm_size, struct ptlrpc_request **request);
int ll_fsync(struct file *file, loff_t start, loff_t end, int data); int ll_fsync(struct file *file, loff_t start, loff_t end, int data);
int ll_merge_lvb(const struct lu_env *env, struct inode *inode); int ll_merge_attr(const struct lu_env *env, struct inode *inode);
int ll_fid2path(struct inode *inode, void __user *arg); int ll_fid2path(struct inode *inode, void __user *arg);
int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock); int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock);
int ll_hsm_release(struct inode *inode); int ll_hsm_release(struct inode *inode);
...@@ -1319,11 +1321,6 @@ static inline void cl_isize_write(struct inode *inode, loff_t kms) ...@@ -1319,11 +1321,6 @@ static inline void cl_isize_write(struct inode *inode, loff_t kms)
#define cl_isize_read(inode) i_size_read(inode) #define cl_isize_read(inode) i_size_read(inode)
static inline int cl_merge_lvb(const struct lu_env *env, struct inode *inode)
{
return ll_merge_lvb(env, inode);
}
#define cl_inode_atime(inode) LTIME_S((inode)->i_atime) #define cl_inode_atime(inode) LTIME_S((inode)->i_atime)
#define cl_inode_ctime(inode) LTIME_S((inode)->i_ctime) #define cl_inode_ctime(inode) LTIME_S((inode)->i_ctime)
#define cl_inode_mtime(inode) LTIME_S((inode)->i_mtime) #define cl_inode_mtime(inode) LTIME_S((inode)->i_mtime)
......
...@@ -1551,7 +1551,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) ...@@ -1551,7 +1551,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
if (body->valid & OBD_MD_FLATIME) { if (body->valid & OBD_MD_FLATIME) {
if (body->atime > LTIME_S(inode->i_atime)) if (body->atime > LTIME_S(inode->i_atime))
LTIME_S(inode->i_atime) = body->atime; LTIME_S(inode->i_atime) = body->atime;
lli->lli_lvb.lvb_atime = body->atime; lli->lli_atime = body->atime;
} }
if (body->valid & OBD_MD_FLMTIME) { if (body->valid & OBD_MD_FLMTIME) {
if (body->mtime > LTIME_S(inode->i_mtime)) { if (body->mtime > LTIME_S(inode->i_mtime)) {
...@@ -1560,12 +1560,12 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) ...@@ -1560,12 +1560,12 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
body->mtime); body->mtime);
LTIME_S(inode->i_mtime) = body->mtime; LTIME_S(inode->i_mtime) = body->mtime;
} }
lli->lli_lvb.lvb_mtime = body->mtime; lli->lli_mtime = body->mtime;
} }
if (body->valid & OBD_MD_FLCTIME) { if (body->valid & OBD_MD_FLCTIME) {
if (body->ctime > LTIME_S(inode->i_ctime)) if (body->ctime > LTIME_S(inode->i_ctime))
LTIME_S(inode->i_ctime) = body->ctime; LTIME_S(inode->i_ctime) = body->ctime;
lli->lli_lvb.lvb_ctime = body->ctime; lli->lli_ctime = body->ctime;
} }
if (body->valid & OBD_MD_FLMODE) if (body->valid & OBD_MD_FLMODE)
inode->i_mode = (inode->i_mode & S_IFMT)|(body->mode & ~S_IFMT); inode->i_mode = (inode->i_mode & S_IFMT)|(body->mode & ~S_IFMT);
......
...@@ -739,7 +739,7 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io) ...@@ -739,7 +739,7 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io)
} }
/* update inode size */ /* update inode size */
ll_merge_lvb(env, inode); ll_merge_attr(env, inode);
/* Now the pages in queue were failed to commit, discard them /* Now the pages in queue were failed to commit, discard them
* unless they were dirtied before. * unless they were dirtied before.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment