Commit 4f76f0ec authored by wang di's avatar wang di Committed by Greg Kroah-Hartman

staging: lustre: llite: move dir cache to MDC layer

Move directory entries cache from llite to MDC, so client
side dir stripe will use independent hash function(in LMV),
which does not need to be tightly coupled with the backend
storage dir-entry hash function. With striped directory, it
will be 2-tier hash, LMV calculate hash value according to the
name and hash-type in layout, then each MDT will store these
entry in disk by its own hash.
Signed-off-by: default avatarwang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
Reviewed-on: http://review.whamcloud.com/7043Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7ccb7c8f
...@@ -80,17 +80,6 @@ static inline void ll_dir_chain_fini(struct ll_dir_chain *chain) ...@@ -80,17 +80,6 @@ static inline void ll_dir_chain_fini(struct ll_dir_chain *chain)
{ {
} }
static inline unsigned long hash_x_index(__u64 hash, int hash64)
{
if (BITS_PER_LONG == 32 && hash64)
hash >>= 32;
/* save hash 0 as index 0 because otherwise we'll save it at
* page index end (~0UL) and it causes truncate_inode_pages_range()
* to loop forever.
*/
return ~0UL - (hash + !hash);
}
/** @} lite */ /** @} lite */
#endif #endif
This diff is collapsed.
...@@ -665,7 +665,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, ...@@ -665,7 +665,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
int ll_get_mdt_idx(struct inode *inode); int ll_get_mdt_idx(struct inode *inode);
int ll_get_mdt_idx_by_fid(struct ll_sb_info *sbi, const struct lu_fid *fid); int ll_get_mdt_idx_by_fid(struct ll_sb_info *sbi, const struct lu_fid *fid);
struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data, struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data,
__u64 hash, struct ll_dir_chain *chain); __u64 offset, struct ll_dir_chain *chain);
void ll_release_page(struct inode *inode, struct page *page, bool remove); void ll_release_page(struct inode *inode, struct page *page, bool remove);
/* llite/namei.c */ /* llite/namei.c */
......
...@@ -1035,7 +1035,7 @@ static int ll_statahead_thread(void *arg) ...@@ -1035,7 +1035,7 @@ static int ll_statahead_thread(void *arg)
struct ll_statahead_info *sai = ll_sai_get(plli->lli_sai); struct ll_statahead_info *sai = ll_sai_get(plli->lli_sai);
struct ptlrpc_thread *thread = &sai->sai_thread; struct ptlrpc_thread *thread = &sai->sai_thread;
struct ptlrpc_thread *agl_thread = &sai->sai_agl_thread; struct ptlrpc_thread *agl_thread = &sai->sai_agl_thread;
struct page *page; struct page *page = NULL;
__u64 pos = 0; __u64 pos = 0;
int first = 0; int first = 0;
int rc = 0; int rc = 0;
...@@ -1166,8 +1166,7 @@ static int ll_statahead_thread(void *arg) ...@@ -1166,8 +1166,7 @@ static int ll_statahead_thread(void *arg)
if (!list_empty(&sai->sai_entries_received)) if (!list_empty(&sai->sai_entries_received))
goto interpret_it; goto interpret_it;
if (unlikely( if (unlikely(!thread_is_running(thread))) {
!thread_is_running(thread))) {
ll_release_page(dir, page, false); ll_release_page(dir, page, false);
rc = 0; rc = 0;
goto out; goto out;
...@@ -1182,10 +1181,10 @@ static int ll_statahead_thread(void *arg) ...@@ -1182,10 +1181,10 @@ static int ll_statahead_thread(void *arg)
goto keep_it; goto keep_it;
} }
do_it: do_it:
ll_statahead_one(parent, name, namelen); ll_statahead_one(parent, name, namelen);
} }
pos = le64_to_cpu(dp->ldp_hash_end); pos = le64_to_cpu(dp->ldp_hash_end);
if (pos == MDS_DIR_END_OFF) { if (pos == MDS_DIR_END_OFF) {
/* /*
...@@ -1232,14 +1231,12 @@ static int ll_statahead_thread(void *arg) ...@@ -1232,14 +1231,12 @@ static int ll_statahead_thread(void *arg)
* Normal case: continue to the next page. * Normal case: continue to the next page.
*/ */
ll_release_page(dir, page, ll_release_page(dir, page,
le32_to_cpu(dp->ldp_flags) & le32_to_cpu(dp->ldp_flags) & LDF_COLLIDE);
LDF_COLLIDE);
sai->sai_in_readpage = 1; sai->sai_in_readpage = 1;
page = ll_get_dir_page(dir, op_data, pos, &chain); page = ll_get_dir_page(dir, op_data, pos, &chain);
sai->sai_in_readpage = 0; sai->sai_in_readpage = 0;
} }
} }
out: out:
ll_finish_md_op_data(op_data); ll_finish_md_op_data(op_data);
if (sai->sai_agl_valid) { if (sai->sai_agl_valid) {
...@@ -1455,7 +1452,6 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) ...@@ -1455,7 +1452,6 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)
page = ll_get_dir_page(dir, op_data, pos, &chain); page = ll_get_dir_page(dir, op_data, pos, &chain);
} }
} }
out: out:
ll_dir_chain_fini(&chain); ll_dir_chain_fini(&chain);
ll_finish_md_op_data(op_data); ll_finish_md_op_data(op_data);
......
...@@ -135,4 +135,12 @@ static inline int mdc_prep_elc_req(struct obd_export *exp, ...@@ -135,4 +135,12 @@ static inline int mdc_prep_elc_req(struct obd_export *exp,
count); count);
} }
static inline unsigned long hash_x_index(__u64 hash, int hash64)
{
if (BITS_PER_LONG == 32 && hash64)
hash >>= 32;
/* save hash 0 with hash 1 */
return ~0UL - (hash + !hash);
}
#endif #endif
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