staging: lustre: majority of missing fixes for 2.6 release
cover staging: lustre: majority of missing fixes for 2.6 release
This is the combination of two previous patch sets that cover missing fixes for lustre version 2.5.56 to the 2.6 release minus a few patches that have some bug regressions. Also in this update are the latest LNet fixes.
Alexander Boyko (1):
staging: lustre: lnet: make connection more stable with packet loss
Andriy Skulysh (1):
staging: lustre: ptlrpc: request gets stuck in UNREGISTERING phase
Brian Behlendorf (1):
staging: lustre: obd: limit lu_object cache
Chris Horn (1):
staging: lustre: ptlrpc: Early replies need to honor at_max
Christopher J. Morrone (1):
staging: lustre: Remove static declaration in anonymous union
Dmitry Eremin (2):
staging: lustre: lmv: fix issue found by Klocwork Insight tool
staging: lustre: lmv: build error with gcc 4.7.0 20110509
Doug Oucharek (3):
staging: lustre: lnet: Do not drop message when shutting down LNet
staging: lustre: lnet: Correct position of lnet_ni_decref()
staging: lustre: lnet: Stop Infinite CON RACE Condition
Emoly Liu (1):
staging: lustre: ldlm: improve ldlm_lock_create() return value
Fan Yong (6):
staging: lustre: obdclass: bug fixes for lu_device_type handling
staging: lustre: llite: enable clients to inject error for lfsck
staging: lustre: obdclass: unified flow control interfaces
staging: lustre: reorder LOV_MAGIC_* definition
staging: lustre: lov: new pattern flag for partially repaired file
staging: lustre: lmv: build master LMV EA dynamically build via readdir
Gregoire Pichon (1):
staging: lustre: llite: fix inconsistencies of root squash feature
Hongchao Zhang (2):
staging: lustre: llite: set dir LOV xattr length variable
staging: lustre: osc: Automatically increase the max_dirty_mb
James Simmons (3):
staging: lustre: obdclass: compile issues with variable not being initialized
staging: lustre: include: fix one off errors in lustre_id.h
staging: lustre: llite: remove assert for acl refcount
Jian Yu (1):
staging: lustre: obdclass: fix lmd_parse() to handle comma-separated NIDs
Jinshan Xiong (7):
staging: lustre: osc: allow to call brw_commit() multiple times
staging: lustre: llite: avoid a deadlock in page write
staging: lustre: lov: handle the case of stripe size is not power 2
staging: lustre: llite: Fix the deadlock in balance_dirty_pages()
staging: lustre: llite: Change readdir BRW metrics
staging: lustre: clio: Reduce memory overhead of per-page allocation
staging: lustre: osc: revise unstable pages accounting
John L. Hammond (13):
staging: lustre: mdc: fixup MDS_SWAP_LAYOUTS ELC handling
staging: lustre: don't need to const __u64 parameters for lustre_idl.h
staging: lustre: const correct FID/OSTID/... helpers
staging: lustre: use bool for several function in lustre_idl.h/lustre_fid.h
staging: lustre: simplify inline functions in lustre_fid.h
staging: lustre: lmv: access lum_stripe_offset as little endian
staging: lustre: lmv: cleanup req in lmv_getattr_name()
staging: lustre: lmv: rename request to preq in lmv_getattr_name()
staging: lustre: move ioctls to lustre_ioctl.h
staging: lustre: llite: validate names
staging: lustre: uapi: reduce scope of lustre_idl.h
staging: lustre: mdt: add mbo_ prefix to members of struct mdt_body
staging: lustre: obd: validate open handle cookies
Lai Siyao (2):
staging: lustre: fid: do open-by-fid by default
staging: lustre: ptlrpc: add OBD_CONNECT_UNLINK_CLOSE flag
Liang Zhen (1):
staging: lustre: lnet: lock improvement for ko2iblnd
Mikhail Pershin (1):
staging: lustre: llog: keep llog ctxt indices constant
Nathaniel Clark (1):
staging: lustre: lmv: Ensure lmv_intent_lookup cleans up reqp
Niu Yawei (1):
staging: lustre: obd: rename lsr_padding to lsr_valid
Patrick Farrell (1):
staging: lustre: fld: add fld description documentation
Ryan Haasken (1):
staging: lustre: libcfs: Only dump log once per sec. to avoid EEXIST
Vitaly Fertman (1):
staging: lustre: ldlm: flock completion fixes.
wang di (27):
staging: lustre: llite: add md_op_data parameter to ll_get_dir_page
staging: lustre: llite: remove comment from ll_dir_read
staging: lustre: llite: style cleanup for llite_internal.h
staging: lustre: llite: pass inode to ll_release_page
staging: lustre: llite: change remove parameter to bool
staging: lustre: mdc: don't take rpc lock for readdir case
staging: lustre: lmv: remove unused lmv_get_mea function
staging: lustre: lmv: remove duplicate MAX_HASH_*
staging: lustre: lmv: change handling of lmv striping information
staging: lustre: lmv: remove lmv_get_easize
staging: lustre: lmv: replace obd_free_memmd with lmv_free_memmd
staging: lustre: create striped directory
staging: lustre: llite: fix "getdirstripe" to show stripe info
staging: lustre: delete striped directory
staging: lustre: add ability to migrate inodes.
staging: lustre: llite: a few fixes for migration.
staging: lustre: lmv: lookup remote migrating object in LMV
staging: lustre: llite: add error handler in inode prepare phase
staging: lustre: lmv: separate master object with master stripe
staging: lustre: llite: a few fixes about readdir of striped dir.
staging: lustre: lmv: validate lock with correct stripe FID
staging: lustre: lmv: Match MDT where the FID locates first
staging: lustre: llite: use the correct mode for striped directory
staging: lustre: mdc: always use D_INFO for debug info when mdc_put_rpc_lock fails
staging: lustre: lmv: try all stripes for unknown hash functions
staging: lustre: obd: implement md_read_page
staging: lustre: llite: set op_max_pages
.../lustre/include/linux/libcfs/libcfs_fail.h | 3 + .../lustre/include/linux/libcfs/libcfs_private.h | 9 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 78 +- drivers/staging/lustre/lnet/libcfs/debug.c | 9 +- drivers/staging/lustre/lnet/libcfs/fail.c | 6 +- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 2 - drivers/staging/lustre/lnet/lnet/lib-move.c | 3 + drivers/staging/lustre/lustre/fld/fld_internal.h | 19 + drivers/staging/lustre/lustre/fld/fld_request.c | 55 +-- drivers/staging/lustre/lustre/include/cl_object.h | 75 +- .../staging/lustre/lustre/include/lprocfs_status.h | 6 + drivers/staging/lustre/lustre/include/lu_object.h | 19 +- .../lustre/lustre/include/lustre/lustre_idl.h | 341 +++++---- .../lustre/lustre/include/lustre/lustre_ioctl.h | 412 ++++++++++ .../lustre/lustre/include/lustre/lustre_user.h | 73 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 11 +- .../lustre/lustre/include/lustre_dlm_flags.h | 36 +- drivers/staging/lustre/lustre/include/lustre_fid.h | 30 +- .../staging/lustre/lustre/include/lustre_handles.h | 3 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 286 +------- .../staging/lustre/lustre/include/lustre_lite.h | 1 - drivers/staging/lustre/lustre/include/lustre_lmv.h | 67 ++- drivers/staging/lustre/lustre/include/lustre_mdc.h | 23 +- drivers/staging/lustre/lustre/include/lustre_mds.h | 3 - drivers/staging/lustre/lustre/include/lustre_ver.h | 13 +- drivers/staging/lustre/lustre/include/obd.h | 123 ++-- drivers/staging/lustre/lustre/include/obd_class.h | 66 ++- .../staging/lustre/lustre/include/obd_support.h | 9 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 102 ++- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 16 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 53 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 29 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 33 +- drivers/staging/lustre/lustre/llite/dir.c | 382 ++++++--- drivers/staging/lustre/lustre/llite/file.c | 311 ++++++-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 57 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 434 ++++++++-- drivers/staging/lustre/lustre/llite/llite_nfs.c | 57 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 109 +++- drivers/staging/lustre/lustre/llite/namei.c | 162 +++-- drivers/staging/lustre/lustre/llite/rw.c | 4 + drivers/staging/lustre/lustre/llite/rw26.c | 7 + drivers/staging/lustre/lustre/llite/statahead.c | 46 +- drivers/staging/lustre/lustre/llite/symlink.c | 6 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 6 - drivers/staging/lustre/lustre/llite/vvp_internal.h | 6 +- drivers/staging/lustre/lustre/llite/vvp_req.c | 2 + drivers/staging/lustre/lustre/llite/xattr.c | 29 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 12 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 339 +++++++-- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 127 ++- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 865 ++++++++++++++++---- .../staging/lustre/lustre/lov/lov_cl_internal.h | 4 +- drivers/staging/lustre/lustre/lov/lov_io.c | 22 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 1 + drivers/staging/lustre/lustre/lov/lov_object.c | 1 + drivers/staging/lustre/lustre/lov/lov_page.c | 12 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 17 +- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 7 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 200 ++--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 69 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 12 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 73 +- drivers/staging/lustre/lustre/obdclass/cl_io.c | 10 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 12 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 10 +- drivers/staging/lustre/lustre/obdclass/genops.c | 134 +++- .../lustre/lustre/obdclass/linux/linux-module.c | 1 + drivers/staging/lustre/lustre/obdclass/llog_swab.c | 1 + .../lustre/lustre/obdclass/lprocfs_status.c | 144 ++++ drivers/staging/lustre/lustre/obdclass/lu_object.c | 125 ++- .../lustre/lustre/obdclass/lustre_handles.c | 4 +- .../staging/lustre/lustre/obdclass/obd_config.c | 1 + drivers/staging/lustre/lustre/obdclass/obd_mount.c | 23 +- .../staging/lustre/lustre/obdecho/echo_client.c | 1 + drivers/staging/lustre/lustre/osc/lproc_osc.c | 10 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 135 +--- drivers/staging/lustre/lustre/osc/osc_internal.h | 3 +- drivers/staging/lustre/lustre/osc/osc_io.c | 7 +- drivers/staging/lustre/lustre/osc/osc_page.c | 208 ++++- drivers/staging/lustre/lustre/osc/osc_request.c | 64 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 12 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 12 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 93 ++- drivers/staging/lustre/lustre/ptlrpc/service.c | 18 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 346 +++++---- 88 files changed, 4588 insertions(+), 2183 deletions(-) create mode 100644 drivers/staging/lustre/lustre/include/lustre/lustre_ioctl.h
PATCH 1/80 staging: lustre: llite: add md_op_data parameter to ll_get_dir_page
From: wang di <[email protected]>
Pass in struct md_op_data for ll_get_dir_page function.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/llite/dir.c | 8 ++++---- .../staging/lustre/lustre/llite/llite_internal.h | 4 ++-- drivers/staging/lustre/lustre/llite/statahead.c | 15 +++++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +4 -4
@@ -322,8 +322,8 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 *hash,return page; } -struct page *ll_get_dir_page (struct inode *dir,__u64 hash, -struct ll_dir_chain *chain) +struct page *ll_get_dir_page (struct inode *dir,struct md_op_data *op_data, +__u64 hash,struct ll_dir_chain *chain) {ldlm_policy_data_t policy = {.l_inodebits = {MDS_INODELOCK_UPDATE } };struct address_space *mapping = dir->i_mapping;
@@ -503,7 +503,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,ll_dir_chain_init (&chain); - page =ll_get_dir_page (inode, pos, &chain); + page =ll_get_dir_page (inode, op_data, pos, &chain);while (rc ==0 && !done) {struct lu_dirpage *dp;
@@ -585,7 +585,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,le32_to_cpu (dp->ldp_flags) & LDF_COLLIDE); next = pos; - page =ll_get_dir_page (inode, pos, + page =ll_get_dir_page (inode, op_data, pos, &chain); } }
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -2
@@ -651,8 +651,8 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,void ll_release_page (struct page *page,int remove);extern const struct file_operations ll_dir_operations;extern const struct inode_operations ll_dir_inode_operations; -struct page *ll_get_dir_page (struct inode *dir,__u64 hash, -struct ll_dir_chain *chain); +struct page *ll_get_dir_page (struct inode *dir,struct md_op_data *op_data, +__u64 hash,struct ll_dir_chain *chain);int ll_dir_read (struct inode *inode,__u64 *ppos,struct md_op_data *op_data,struct dir_context *ctx);
drivers/staging/lustre/lustre/llite/statahead.c +11 -4
@@ -1067,7 +1067,7 @@ static int ll_statahead_thread(void *arg)wake_up (&thread->t_ctl_waitq);ll_dir_chain_init (&chain); - page =ll_get_dir_page (dir, pos, &chain); + page =ll_get_dir_page (dir, op_data, pos, &chain);while (1 ) {struct lu_dirpage *dp;
@@ -1232,7 +1232,7 @@ do_it:ll_release_page (page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); sai->sai_in_readpage =1 ; - page =ll_get_dir_page (dir, pos, &chain); + page =ll_get_dir_page (dir, op_data, pos, &chain); sai->sai_in_readpage =0 ; } }
@@ -1344,13 +1344,19 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) {struct ll_dir_chain chain;const struct qstr *target = &dentry->d_name; +struct md_op_data *op_data;struct page *page;__u64 pos =0 ;int dot_de;int rc =LS_NONE_FIRST_DE ; + op_data =ll_prep_md_op_data (NULL , dir, dir,NULL ,0 ,0 , +LUSTRE_OPC_ANY , dir); +if (IS_ERR (op_data)) +return PTR_ERR (op_data); +ll_dir_chain_init (&chain); - page =ll_get_dir_page (dir, pos, &chain); + page =ll_get_dir_page (dir, op_data, pos, &chain);while (1 ) {struct lu_dirpage *dp;
@@ -1438,12 +1444,13 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)*/ ll_release_page (page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); - page =ll_get_dir_page (dir, pos, &chain); + page =ll_get_dir_page (dir, op_data, pos, &chain); } } out:ll_dir_chain_fini (&chain); +ll_finish_md_op_data (op_data);return rc; }
Signature · 1 line
1.7.1
PATCH 2/80 staging: lustre: llite: remove comment from ll_dir_read
In reply to James SimmonsFrom: wang di <[email protected]>
Remove comment about fixing swabbing that is not needed.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/llite/dir.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +0 -4
@@ -526,10 +526,6 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,__u64 lhash;__u64 ino; -/* -* XXX: implement correct swabbing here. -*/ - hash =le64_to_cpu (ent->lde_hash);if (hash < pos)/*
Signature · 1 line
1.7.1
PATCH 3/80 staging: lustre: llite: style cleanup for llite_internal.h
In reply to James SimmonsFrom: wang di <[email protected]>
Group function prototypes together related to dir.c. Move ll_release_page to be with function declarations.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- .../staging/lustre/lustre/llite/llite_internal.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +4 -4
@@ -648,15 +648,15 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, size_t count, int rw);/* llite/dir.c */ -void ll_release_page (struct page *page,int remove);extern const struct file_operations ll_dir_operations;extern const struct inode_operations ll_dir_inode_operations; -struct page *ll_get_dir_page (struct inode *dir,struct md_op_data *op_data, -__u64 hash,struct ll_dir_chain *chain);int ll_dir_read (struct inode *inode,__u64 *ppos,struct md_op_data *op_data,struct dir_context *ctx); -int ll_get_mdt_idx (struct inode *inode); +struct page *ll_get_dir_page (struct inode *dir,struct md_op_data *op_data, +__u64 hash,struct ll_dir_chain *chain); +void ll_release_page (struct page *page,int remove); +/* llite/namei.c */ extern const struct inode_operations ll_special_inode_operations;
Signature · 1 line
1.7.1
PATCH 4/80 staging: lustre: llite: pass inode to ll_release_page
In reply to James SimmonsFrom: wang di <[email protected]>
Add a inode parameter to ll_release_page. This will be used in the future.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/llite/dir.c | 17 +++++++++-------- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/statahead.c | 20 +++++++++++--------- 3 files changed, 21 insertions(+), 18 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +9 -8
@@ -236,7 +236,7 @@ static int ll_dir_filler(void *_hash, struct page *page0)return rc; } -void ll_release_page (struct page *page,int remove) +void ll_release_page (struct inode *inode,struct page *page,int remove) {kunmap (page);if (remove) {
@@ -297,7 +297,7 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 *hash,CDEBUG (D_VFSTRACE ,"page %lu [%llu %llu], hash %llu\n" , offset, *start, *end, *hash);if (*hash > *end) { -ll_release_page (page,0 ); +ll_release_page (dir, page,0 ); page =NULL ; }else if (*end != *start && *hash == *end) {/*
@@ -306,8 +306,9 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 *hash,* ll_get_dir_page() will issue RPC to fetch * the page we want. */ -ll_release_page (page, -le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); +ll_release_page (dir, page, +le32_to_cpu (dp->ldp_flags) & +LDF_COLLIDE ); page =NULL ; } }else {
@@ -462,7 +463,7 @@ out_unlock:return page; fail: -ll_release_page (page,1 ); +ll_release_page (dir, page,1 ); page =ERR_PTR (-EIO ); goto out_unlock; }
@@ -560,7 +561,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,if (done) { pos = hash; -ll_release_page (page,0 ); +ll_release_page (inode, page,0 );break ; }
@@ -571,13 +572,13 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,* End of directory reached. */ done =1 ; -ll_release_page (page,0 ); +ll_release_page (inode, page,0 ); }else {/* * Normal case: continue to the next * page. */ -ll_release_page (page, +ll_release_page (inode, page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); next = pos;
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -1
@@ -655,7 +655,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,int ll_get_mdt_idx (struct inode *inode);struct page *ll_get_dir_page (struct inode *dir,struct md_op_data *op_data,__u64 hash,struct ll_dir_chain *chain); -void ll_release_page (struct page *page,int remove); +void ll_release_page (struct inode *inode,struct page *page,int remove);/* llite/namei.c */ extern const struct inode_operations ll_special_inode_operations;
drivers/staging/lustre/lustre/llite/statahead.c +11 -9
@@ -1142,7 +1142,7 @@ interpret_it:ll_post_statahead (sai);if (unlikely (!thread_is_running (thread))) { -ll_release_page (page,0 ); +ll_release_page (dir, page,0 ); rc =0 ; goto out; }
@@ -1166,7 +1166,7 @@ interpret_it:if (unlikely ( !thread_is_running (thread))) { -ll_release_page (page,0 ); +ll_release_page (dir, page,0 ); rc =0 ; goto out; }
@@ -1189,7 +1189,7 @@ do_it:/* * End of directory reached. */ -ll_release_page (page,0 ); +ll_release_page (dir, page,0 );while (1 ) { l_wait_event(thread->t_ctl_waitq, !list_empty(&sai->sai_entries_received) ||
@@ -1229,8 +1229,9 @@ do_it:* chain is exhausted. * Normal case: continue to the next page. */ -ll_release_page (page,le32_to_cpu (dp->ldp_flags) & -LDF_COLLIDE ); +ll_release_page (dir, page, +le32_to_cpu (dp->ldp_flags) & +LDF_COLLIDE ); sai->sai_in_readpage =1 ; page =ll_get_dir_page (dir, op_data, pos, &chain); sai->sai_in_readpage =0 ;
@@ -1427,7 +1428,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)else rc =LS_FIRST_DOT_DE ; -ll_release_page (page,0 ); +ll_release_page (dir, page,0 ); goto out; } pos =le64_to_cpu (dp->ldp_hash_end);
@@ -1435,15 +1436,16 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)/* * End of directory reached. */ -ll_release_page (page,0 ); +ll_release_page (dir, page,0 ); goto out; }else {/* * chain is exhausted * Normal case: continue to the next page. */ -ll_release_page (page,le32_to_cpu (dp->ldp_flags) & -LDF_COLLIDE ); +ll_release_page (dir, page, +le32_to_cpu (dp->ldp_flags) & +LDF_COLLIDE ); page =ll_get_dir_page (dir, op_data, pos, &chain); } }
Signature · 1 line
1.7.1
PATCH 5/80 staging: lustre: llite: change remove parameter to bool
In reply to James SimmonsFrom: wang di <[email protected]>
Change the 3rd parameter remove to a bool for ll_release_page function.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/llite/dir.c | 10 +++++----- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/statahead.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +5 -5
@@ -236,7 +236,7 @@ static int ll_dir_filler(void *_hash, struct page *page0)return rc; } -void ll_release_page (struct inode *inode,struct page *page,int remove) +void ll_release_page (struct inode *inode,struct page *page,bool remove) {kunmap (page);if (remove) {
@@ -297,7 +297,7 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 *hash,CDEBUG (D_VFSTRACE ,"page %lu [%llu %llu], hash %llu\n" , offset, *start, *end, *hash);if (*hash > *end) { -ll_release_page (dir, page,0 ); +ll_release_page (dir, page, false); page =NULL ; }else if (*end != *start && *hash == *end) {/*
@@ -463,7 +463,7 @@ out_unlock:return page; fail: -ll_release_page (dir, page,1 ); +ll_release_page (dir, page, true); page =ERR_PTR (-EIO ); goto out_unlock; }
@@ -561,7 +561,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,if (done) { pos = hash; -ll_release_page (inode, page,0 ); +ll_release_page (inode, page, false);break ; }
@@ -572,7 +572,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,* End of directory reached. */ done =1 ; -ll_release_page (inode, page,0 ); +ll_release_page (inode, page, false); }else {/* * Normal case: continue to the next
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -1
@@ -655,7 +655,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,int ll_get_mdt_idx (struct inode *inode);struct page *ll_get_dir_page (struct inode *dir,struct md_op_data *op_data,__u64 hash,struct ll_dir_chain *chain); -void ll_release_page (struct inode *inode,struct page *page,int remove); +void ll_release_page (struct inode *inode,struct page *page,bool remove);/* llite/namei.c */ extern const struct inode_operations ll_special_inode_operations;
drivers/staging/lustre/lustre/llite/statahead.c +5 -5
@@ -1142,7 +1142,7 @@ interpret_it:ll_post_statahead (sai);if (unlikely (!thread_is_running (thread))) { -ll_release_page (dir, page,0 ); +ll_release_page (dir, page, false); rc =0 ; goto out; }
@@ -1166,7 +1166,7 @@ interpret_it:if (unlikely ( !thread_is_running (thread))) { -ll_release_page (dir, page,0 ); +ll_release_page (dir, page, false); rc =0 ; goto out; }
@@ -1189,7 +1189,7 @@ do_it:/* * End of directory reached. */ -ll_release_page (dir, page,0 ); +ll_release_page (dir, page, false);while (1 ) { l_wait_event(thread->t_ctl_waitq, !list_empty(&sai->sai_entries_received) ||
@@ -1428,7 +1428,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)else rc =LS_FIRST_DOT_DE ; -ll_release_page (dir, page,0 ); +ll_release_page (dir, page, false); goto out; } pos =le64_to_cpu (dp->ldp_hash_end);
@@ -1436,7 +1436,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)/* * End of directory reached. */ -ll_release_page (dir, page,0 ); +ll_release_page (dir, page, false); goto out; }else {/*
Signature · 1 line
1.7.1
PATCH 6/80 staging: lustre: mdc: don't take rpc lock for readdir case
In reply to James SimmonsFrom: wang di <[email protected]>
If the operation is IT_READDIR don't need to handle the mdc RPC lock.
Reviewed-on: http://review.whamcloud.com/10761
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4906
--- drivers/staging/lustre/lustre/include/lustre_mdc.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/lustre_mdc.h +2 -2
@@ -96,7 +96,7 @@ static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck, struct lookup_intent *it) {if (it && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || - it->it_op ==IT_LAYOUT )) + it->it_op ==IT_LAYOUT || it->it_op ==IT_READDIR ))return ;/* This would normally block until the existing request finishes.
@@ -136,7 +136,7 @@ static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck, struct lookup_intent *it) {if (it && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || - it->it_op ==IT_LAYOUT )) + it->it_op ==IT_LAYOUT || it->it_op ==IT_READDIR ))return ;if (lck->rpcl_it ==MDC_FAKE_RPCL_IT ) {/* OBD_FAIL_MDC_RPCS_SEM */
Signature · 1 line
1.7.1
PATCH 7/80 staging: lustre: lmv: remove unused lmv_get_mea function
In reply to James SimmonsFrom: wang di <[email protected]>
The function lmv_get_mea() is not used so remove it.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 24 ---------------------- 1 files changed, 0 insertions(+), 24 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_internal.h +0 -24
@@ -55,30 +55,6 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds);int lmv_fid_alloc (struct obd_export *exp,struct lu_fid *fid,struct md_op_data *op_data); -static inline struct lmv_stripe_md *lmv_get_mea (struct ptlrpc_request *req) -{ -struct mdt_body *body; -struct lmv_stripe_md *mea; - -LASSERT (req); - - body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); - -if (!body || !S_ISDIR (body->mode) || !body->eadatasize) -return NULL ; - - mea =req_capsule_server_sized_get (&req->rq_pill, &RMF_MDT_MD , - body->eadatasize); -if (mea->mea_count ==0 ) -return NULL ; -if (mea->mea_magic !=MEA_MAGIC_LAST_CHAR && - mea->mea_magic !=MEA_MAGIC_ALL_CHARS && - mea->mea_magic !=MEA_MAGIC_HASH_SEGMENT ) -return NULL ; - -return mea; -} -static inline int lmv_get_easize (struct lmv_obd *lmv) { return sizeof(struct lmv_stripe_md) +
Signature · 1 line
1.7.1
PATCH 8/80 staging: lustre: lmv: remove duplicate MAX_HASH_*
In reply to James SimmonsFrom: wang di <[email protected]>
The MAX_HASH_* macros already exist in obd.h. Remove the duplicated defines in lustre_idl.h.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- .../lustre/lustre/include/lustre/lustre_idl.h | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +0 -4
@@ -2486,10 +2486,6 @@ struct lmv_desc {#define MEA_MAGIC_ALL_CHARS 0xb222a11c#define MEA_MAGIC_HASH_SEGMENT 0xb222a11b -#define MAX_HASH_SIZE_32 0x7fffffffUL -#define MAX_HASH_SIZE 0x7fffffffffffffffULL -#define MAX_HASH_HIGHEST_BIT 0x1000000000000000ULL -/* lmv structures */ #define LMV_MAGIC_V1 0x0CD10CD0/* normal stripe lmv magic */ #define LMV_USER_MAGIC 0x0CD20CD0/* default lmv magic*/
Signature · 1 line
1.7.1
PATCH 9/80 staging: lustre: lmv: change handling of lmv striping information
In reply to James SimmonsFrom: wang di <[email protected]>
The lmv_[un]pack_md function are used to calculate the size of the data used to represent the LMV striping data. The original code was straight forward in its calculate with lmv_get_easize since only one type of data format could exist. We want to be able to support different version of this data in the future so this patch moves to generating the size of the data using the stripe count and which LMV_MAGIC_* version.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- .../lustre/lustre/include/lustre/lustre_idl.h | 4 - drivers/staging/lustre/lustre/include/lustre_lmv.h | 15 +- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 7 + drivers/staging/lustre/lustre/lmv/lmv_obd.c | 245 +++++++++++++++----- 4 files changed, 198 insertions(+), 73 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +0 -4
@@ -2482,10 +2482,6 @@ struct lmv_desc {struct obd_uuid ld_uuid; }; -#define MEA_MAGIC_LAST_CHAR 0xb2221ca1 -#define MEA_MAGIC_ALL_CHARS 0xb222a11c -#define MEA_MAGIC_HASH_SEGMENT 0xb222a11b -/* lmv structures */ #define LMV_MAGIC_V1 0x0CD10CD0/* normal stripe lmv magic */ #define LMV_USER_MAGIC 0x0CD20CD0/* default lmv magic*/
drivers/staging/lustre/lustre/include/lustre_lmv.h +9 -6
@@ -41,12 +41,15 @@ struct lmv_oinfo { };struct lmv_stripe_md { -__u32 mea_magic; -__u32 mea_count; -__u32 mea_master; -__u32 mea_padding; -char mea_pool_name[LOV_MAXPOOLNAME ]; -struct lu_fid mea_ids[0 ]; +__u32 lsm_md_magic; +__u32 lsm_md_stripe_count; +__u32 lsm_md_master_mdt_index; +__u32 lsm_md_hash_type; +__u32 lsm_md_layout_version; +__u32 lsm_md_default_count; +__u32 lsm_md_default_index; +char lsm_md_pool_name[LOV_MAXPOOLNAME ]; +struct lmv_oinfo lsm_md_oinfo[0 ]; };union lmv_mds_md ;
drivers/staging/lustre/lustre/lmv/lmv_internal.h +7 -0
@@ -94,6 +94,13 @@ lmv_find_target(struct lmv_obd *lmv, const struct lu_fid *fid)return lmv_get_target (lmv, mds); } +static inline int lmv_stripe_md_size (int stripe_count) +{ +struct lmv_stripe_md *lsm; + +return sizeof (*lsm) + stripe_count *sizeof (lsm->lsm_md_oinfo[0 ]); +} +struct lmv_tgt_desc *lmv_locate_mds (struct lmv_obd *lmv,struct md_op_data *op_data,struct lu_fid *fid);
drivers/staging/lustre/lustre/lmv/lmv_obd.c +182 -63
287 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 10/80 staging: lustre: lmv: remove lmv_get_easize
In reply to James SimmonsFrom: wang di <[email protected]>
Completely replace lmv_get_easize with lmv_mds_md_size. With this change we can delete lmv_get_easize.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 7 ------- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 2 files changed, 1 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_internal.h +0 -7
@@ -55,13 +55,6 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds);int lmv_fid_alloc (struct obd_export *exp,struct lu_fid *fid,struct md_op_data *op_data); -static inline int lmv_get_easize (struct lmv_obd *lmv) -{ -return sizeof (struct lmv_stripe_md ) + - lmv->desc.ld_tgt_count * -sizeof (struct lu_fid ); -} -static inline struct lmv_tgt_desc *lmv_get_target (struct lmv_obd *lmv,u32 mds) {
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -1
@@ -558,7 +558,7 @@ int lmv_check_connect(struct obd_device *obd)lmv_set_timeouts (obd);class_export_put (lmv->exp); lmv->connected =1 ; - easize =lmv_get_easize (lmv); + easize =lmv_mds_md_size (lmv->desc.ld_tgt_count,LMV_MAGIC );lmv_init_ea_size (obd->obd_self_export, easize,0 ,0 ,0 );mutex_unlock (&lmv->lmv_init_mutex);return 0 ;
Signature · 1 line
1.7.1
PATCH 11/80 staging: lustre: lmv: replace obd_free_memmd with lmv_free_memmd
In reply to James SimmonsFrom: wang di <[email protected]>
Use lmv_free_memmd for proper cleanup instead of the generic obd_free_memmd.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -1
@@ -2692,7 +2692,7 @@ static int lmv_free_lustre_md(struct obd_export *exp, struct lustre_md *md)struct lmv_tgt_desc *tgt = lmv->tgts[0 ];if (md->lmv) -obd_free_memmd (exp, (void *)&md->lmv); +lmv_free_memmd (md->lmv);if (!tgt || !tgt->ltd_exp)return -EINVAL ;return md_free_lustre_md (tgt->ltd_exp, md);
Signature · 1 line
1.7.1
PATCH 12/80 staging: lustre: create striped directory
In reply to James SimmonsFrom: wang di <[email protected]>
1. client send create request to the master MDT, which will allocate FIDs and create slaves. for all of slaves.
2. Client needs to revalidate slaves during intent getattr and open request.
3. lmv_stripe_md will include attributes(size, nlink etc) from all of stripe, which will be protected by UPDATE lock. client needs to merge these attributes when update inode.
4. send create request to the MDT where the file is located, which can help creating master stripe of striped directory.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3529
Reviewed-on: http://review.whamcloud.com/7196
--- drivers/staging/lustre/lustre/include/cl_object.h | 3 + .../lustre/lustre/include/lustre/lustre_idl.h | 40 +++- .../lustre/lustre/include/lustre/lustre_user.h | 16 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 + drivers/staging/lustre/lustre/include/lustre_lmv.h | 59 +++++ drivers/staging/lustre/lustre/include/obd.h | 16 +- drivers/staging/lustre/lustre/include/obd_class.h | 19 ++ drivers/staging/lustre/lustre/llite/dir.c | 26 ++- drivers/staging/lustre/lustre/llite/file.c | 40 +++- .../staging/lustre/lustre/llite/llite_internal.h | 12 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 193 +++++++++++++++- drivers/staging/lustre/lustre/llite/llite_nfs.c | 7 +- drivers/staging/lustre/lustre/llite/namei.c | 42 +++- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 244 +++++++++++++++++--- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 32 +++ drivers/staging/lustre/lustre/lmv/lmv_obd.c | 221 +++++++++++++++--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 3 + .../staging/lustre/lustre/ptlrpc/pack_generic.c | 11 + 18 files changed, 880 insertions(+), 106 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +3 -0
@@ -191,6 +191,9 @@ struct cl_attr {* Group identifier for quota purposes. */ gid_t cat_gid; + +/* nlink of the directory */ +__u64 cat_nlink; };/**
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +39 -1
@@ -1610,6 +1610,7 @@ static inline void lmm_oi_cpu_to_le(struct ost_id *dst_oi,#define XATTR_NAME_LOV "trusted.lov"#define XATTR_NAME_LMA "trusted.lma"#define XATTR_NAME_LMV "trusted.lmv" +#define XATTR_NAME_DEFAULT_LMV "trusted.dmv"#define XATTR_NAME_LINK "trusted.link"#define XATTR_NAME_FID "trusted.fid"#define XATTR_NAME_VERSION "trusted.version"
@@ -2472,7 +2473,7 @@ struct lmv_desc {__u32 ld_tgt_count;/* how many MDS's */ __u32 ld_active_tgt_count;/* how many active */ __u32 ld_default_stripe_count;/* how many objects are used */ -__u32 ld_pattern;/* default MEA_MAGIC_* */ +__u32 ld_pattern;/* default hash pattern */ __u64 ld_default_hash_size;__u64 ld_padding_1;/* also fix lustre_swab_lmv_desc */ __u32 ld_padding_2;/* also fix lustre_swab_lmv_desc */
@@ -2486,6 +2487,43 @@ struct lmv_desc {#define LMV_MAGIC_V1 0x0CD10CD0/* normal stripe lmv magic */ #define LMV_USER_MAGIC 0x0CD20CD0/* default lmv magic*/ #define LMV_MAGIC LMV_MAGIC_V1 + +enum lmv_hash_type { +LMV_HASH_TYPE_ALL_CHARS =1 , +LMV_HASH_TYPE_FNV_1A_64 =2 , +}; + +#define LMV_HASH_NAME_ALL_CHARS "all_char" +#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64" + +/** +* The FNV-1a hash algorithm is as follows: +* hash = FNV_offset_basis +* for each octet_of_data to be hashed +* hash = hash XOR octet_of_data +* hash = hash ?? FNV_prime +* return hash +* http://en.wikipedia.org/wiki/Fowler???Noll???Vo_hash_function#FNV-1a_hash +* +* http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-reference-source +* FNV_prime is 2^40 + 2^8 + 0xb3 = 0x100000001b3ULL +**/ +#define LUSTRE_FNV_1A_64_PRIME 0x100000001b3ULL +#define LUSTRE_FNV_1A_64_OFFSET_BIAS 0xcbf29ce484222325ULL +static inline __u64 lustre_hash_fnv_1a_64 (const void *buf,size_t size) +{ +__u64 hash =LUSTRE_FNV_1A_64_OFFSET_BIAS ; +const unsigned char *p = buf; +size_t i; + +for (i =0 ; i < size; i++) { + hash ^= p[i]; + hash *=LUSTRE_FNV_1A_64_PRIME ; + } + +return hash; +} +struct lmv_mds_md_v1 {__u32 lmv_magic;__u32 lmv_stripe_count;/* stripe count */
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +8 -8
@@ -374,19 +374,17 @@ struct lov_user_mds_data_v3 { } __packed;#endif -/* keep this to be the same size as lov_user_ost_data_v1 */ struct lmv_user_mds_data {struct lu_fid lum_fid;__u32 lum_padding;__u32 lum_mds; }; -/* lum_type */ -enum { -LMV_STRIPE_TYPE =0 , -LMV_DEFAULT_TYPE =1 , -}; - +/* +* Got this according to how get LOV_MAX_STRIPE_COUNT, see above, +* (max buffer size - lmv+rpc header) / sizeof(struct lmv_user_mds_data) +*/ +#define LMV_MAX_STRIPE_COUNT 2000/* ((12 * 4096 - 256) / 24) */ #define lmv_user_md lmv_user_md_v1struct lmv_user_md_v1 {__u32 lum_magic;/* must be the first field */
@@ -399,7 +397,7 @@ struct lmv_user_md_v1 {__u32 lum_padding3;char lum_pool_name[LOV_MAXPOOLNAME ];struct lmv_user_mds_data lum_objects[0 ]; -}; +} __packed;static inline int lmv_user_md_size (int stripes,int lmm_magic) {
@@ -407,6 +405,8 @@ static inline int lmv_user_md_size(int stripes, int lmm_magic) stripes * sizeof(struct lmv_user_mds_data); } +void lustre_swab_lmv_user_md (struct lmv_user_md *lum); +struct ll_recreate_obj {__u64 lrc_id;__u32 lrc_ost_idx;
drivers/staging/lustre/lustre/include/lustre_lib.h +2 -0
@@ -391,6 +391,8 @@ static inline void obd_ioctl_freedata(char *buf, int len)#define LOVEA_DELETE_VALUES (size, count, offset) (size == 0 && count == 0 && \ offset == (typeof(offset))(-1)) +#define LMVEA_DELETE_VALUES (count, offset) ((count) == 0 && \ + (offset) == (typeof(offset))(-1))/* #define POISON_BULK 0 */ /*
drivers/staging/lustre/lustre/include/lustre_lmv.h +59 -0
63 lines not on this page · raw message
drivers/staging/lustre/lustre/include/obd.h +8 -8
@@ -1022,14 +1022,6 @@ enum { };/* lmv structures */ -#define MEA_MAGIC_LAST_CHAR 0xb2221ca1 -#define MEA_MAGIC_ALL_CHARS 0xb222a11c -#define MEA_MAGIC_HASH_SEGMENT 0xb222a11b - -#define MAX_HASH_SIZE_32 0x7fffffffUL -#define MAX_HASH_SIZE 0x7fffffffffffffffULL -#define MAX_HASH_HIGHEST_BIT 0x1000000000000000ULL -struct lustre_md {struct mdt_body *body;struct lov_stripe_md *lsm;
@@ -1049,6 +1041,7 @@ struct md_open_data { };struct lookup_intent ; +struct cl_attr ;struct md_ops {int (*getstatus)(struct obd_export *,struct lu_fid *);
@@ -1109,6 +1102,13 @@ struct md_ops {int (*free_lustre_md)(struct obd_export *,struct lustre_md *); +int (*merge_attr)(struct obd_export *, +const struct lmv_stripe_md *lsm, +struct cl_attr *attr); + +int (*update_lsm_md)(struct obd_export *,struct lmv_stripe_md *lsm, +struct mdt_body *,ldlm_blocking_callback ); +int (*set_open_replay_data)(struct obd_export *,struct obd_client_handle *,struct lookup_intent *);
drivers/staging/lustre/lustre/include/obd_class.h +19 -0
@@ -1559,6 +1559,25 @@ static inline int md_free_lustre_md(struct obd_export *exp,return MDP (exp->exp_obd, free_lustre_md)(exp, md); } +static inline int md_update_lsm_md (struct obd_export *exp, +struct lmv_stripe_md *lsm, +struct mdt_body *body, +ldlm_blocking_callback cb) +{ +EXP_CHECK_MD_OP (exp, update_lsm_md); +EXP_MD_COUNTER_INCREMENT (exp, update_lsm_md); +return MDP (exp->exp_obd, update_lsm_md)(exp, lsm, body, cb); +} + +static inline int md_merge_attr (struct obd_export *exp, +const struct lmv_stripe_md *lsm, +struct cl_attr *attr) +{ +EXP_CHECK_MD_OP (exp, merge_attr); +EXP_MD_COUNTER_INCREMENT (exp, merge_attr); +return MDP (exp->exp_obd, merge_attr)(exp, lsm, attr); +} + static inline int md_setxattr(struct obd_export *exp, const struct lu_fid *fid, u64 valid, const char *name, const char *input, int input_size,
drivers/staging/lustre/lustre/llite/dir.c +21 -5
@@ -668,7 +668,7 @@ static int ll_send_mgc_param(struct obd_export *mgc, char *string) }static int ll_dir_setdirstripe (struct inode *dir,struct lmv_user_md *lump, -char *filename) +const char *filename) {struct ptlrpc_request *request =NULL ;struct md_op_data *op_data;
@@ -676,6 +676,26 @@ static int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump,int mode;int err; +if (unlikely (lump->lum_magic !=LMV_USER_MAGIC )) +return -EINVAL ; + +if (lump->lum_stripe_offset == (__u32)-1 ) { +int mdtidx; + + mdtidx =ll_get_mdt_idx (dir); +if (mdtidx <0 ) +return mdtidx; + + lump->lum_stripe_offset = mdtidx; + } + +CDEBUG (D_VFSTRACE ,"VFS Op:inode=" DFID "(%p) name %s stripe_offset %d, stripe_count: %u\n" , +PFID (ll_inode2fid (dir)), dir, filename, + (int )lump->lum_stripe_offset, lump->lum_stripe_count); + +if (lump->lum_magic !=cpu_to_le32 (LMV_USER_MAGIC )) +lustre_swab_lmv_user_md (lump); + mode = (~current_umask () &0755 ) |S_IFDIR ; op_data = ll_prep_md_op_data(NULL, dir, NULL, filename, strlen(filename), mode, LUSTRE_OPC_MKDIR,
@@ -745,9 +765,6 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,if (IS_ERR (op_data))return PTR_ERR (op_data); -if (lump && lump->lmm_magic ==cpu_to_le32 (LMV_USER_MAGIC )) - op_data->op_cli_flags |=CLI_SET_MEA ; -/* swabbing is done in lov_setstripe() on server side */ rc =md_setattr (sbi->ll_md_exp, op_data, lump, lum_size,NULL ,0 , &req,NULL );
@@ -1424,7 +1441,6 @@ lmv_out_free: } *tmp = lum; - tmp->lum_type =LMV_STRIPE_TYPE ; tmp->lum_stripe_count =1 ; mdtindex =ll_get_mdt_idx (inode);if (mdtindex <0 ) {
drivers/staging/lustre/lustre/llite/file.c +37 -3
@@ -3015,6 +3015,27 @@ out:return rc; } +static int ll_merge_md_attr (struct inode *inode) +{ +struct cl_attr attr = {0 }; +int rc; + +LASSERT (ll_i2info (inode)->lli_lsm_md); + rc =md_merge_attr (ll_i2mdexp (inode),ll_i2info (inode)->lli_lsm_md, + &attr); +if (rc) +return rc; + +ll_i2info (inode)->lli_stripe_dir_size = attr.cat_size; +ll_i2info (inode)->lli_stripe_dir_nlink = attr.cat_nlink; + +ll_i2info (inode)->lli_atime = attr.cat_atime; +ll_i2info (inode)->lli_mtime = attr.cat_mtime; +ll_i2info (inode)->lli_ctime = attr.cat_ctime; + +return 0 ; +} +static int ll_inode_revalidate (struct dentry *dentry,__u64 ibits) {struct inode *inode =d_inode (dentry);
@@ -3026,6 +3047,13 @@ static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits)/* if object isn't regular file, don't validate size */ if (!S_ISREG (inode->i_mode)) { +if (S_ISDIR (inode->i_mode) && +ll_i2info (inode)->lli_lsm_md) { + rc =ll_merge_md_attr (inode); +if (rc) +return rc; + } +LTIME_S (inode->i_atime) =ll_i2info (inode)->lli_atime;LTIME_S (inode->i_mtime) =ll_i2info (inode)->lli_mtime;LTIME_S (inode->i_ctime) =ll_i2info (inode)->lli_ctime;
@@ -3063,7 +3091,6 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat)else stat->ino = inode->i_ino; stat->mode = inode->i_mode; - stat->nlink = inode->i_nlink; stat->uid = inode->i_uid; stat->gid = inode->i_gid; stat->rdev = inode->i_rdev;
@@ -3071,10 +3098,17 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) stat->mtime = inode->i_mtime; stat->ctime = inode->i_ctime; stat->blksize =1 << inode->i_blkbits; - - stat->size =i_size_read (inode); stat->blocks = inode->i_blocks; +if (S_ISDIR (inode->i_mode) && +ll_i2info (inode)->lli_lsm_md) { + stat->nlink = lli->lli_stripe_dir_nlink; + stat->size = lli->lli_stripe_dir_size; + }else { + stat->nlink = inode->i_nlink; + stat->size =i_size_read (inode); + } +return 0 ; }
drivers/staging/lustre/lustre/llite/llite_internal.h +10 -2
@@ -39,6 +39,7 @@/* for struct cl_lock_descr and struct cl_io */ #include "../include/cl_object.h" +#include "../include/lustre_lmv.h" #include "../include/lustre_mdc.h" #include "../include/lustre_intent.h" #include <linux/compat.h>
@@ -174,7 +175,11 @@ struct ll_inode_info {*/ pid_t d_opendir_pid;/* directory stripe information */ -struct lmv_stripe_md *d_lmv_md; +struct lmv_stripe_md *d_lsm_md; +/* striped directory size */ +loff_t d_stripe_size; +/* striped directory nlink */ +__u64 d_stripe_nlink; } d;#define lli_readdir_mutex u.d.d_readdir_mutex
@@ -182,7 +187,9 @@ struct ll_inode_info {#define lli_sai u.d.d_sai#define lli_sa_lock u.d.d_sa_lock#define lli_opendir_pid u.d.d_opendir_pid -#define lli_lmv_md u.d.d_lmv_md +#define lli_lsm_md u.d.d_lsm_md +#define lli_stripe_dir_size u.d.d_stripe_size +#define lli_stripe_dir_nlink u.d.d_stripe_nlink/* for non-directory */ struct {
@@ -664,6 +671,7 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir);struct inode *ll_iget (struct super_block *sb,ino_t hash,struct lustre_md *lic); +int ll_test_inode_by_fid (struct inode *inode,void *opaque);int ll_md_blocking_ast (struct ldlm_lock *,struct ldlm_lock_desc *,void *data,int flag);struct dentry *ll_splice_alias (struct inode *inode,struct dentry *de);
drivers/staging/lustre/lustre/llite/llite_lib.c +190 -3
221 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_nfs.c +1 -6
@@ -73,11 +73,6 @@ void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid) fsid->val[1 ] = key >>32 ; } -static int ll_nfs_test_inode (struct inode *inode,void *opaque) -{ -return lu_fid_eq (&ll_i2info (inode)->lli_fid, opaque); -} -struct inode *search_inode_for_lustre (struct super_block *sb,const struct lu_fid *fid) {
@@ -92,7 +87,7 @@ struct inode *search_inode_for_lustre(struct super_block *sb,CDEBUG (D_INFO ,"searching inode for:(%lu," DFID ")\n" , hash,PFID (fid)); - inode =ilookup5 (sb, hash, ll_nfs_test_inode, (void *)fid); + inode =ilookup5 (sb, hash, ll_test_inode_by_fid, (void *)fid);if (inode)return inode;
drivers/staging/lustre/lustre/llite/namei.c +39 -3
55 lines not on this page · raw message
drivers/staging/lustre/lustre/lmv/lmv_intent.c +211 -33
277 lines not on this page · raw message
drivers/staging/lustre/lustre/lmv/lmv_internal.h +32 -0
@@ -55,6 +55,14 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds);int lmv_fid_alloc (struct obd_export *exp,struct lu_fid *fid,struct md_op_data *op_data); +int lmv_unpack_md (struct obd_export *exp,struct lmv_stripe_md **lsmp, +const union lmv_mds_md *lmm,int stripe_count); + +int lmv_revalidate_slaves (struct obd_export *exp,struct mdt_body *mbody, +struct lmv_stripe_md *lsm, +ldlm_blocking_callback cb_blocking, +int extra_lock_flags); +static inline struct lmv_tgt_desc *lmv_get_target (struct lmv_obd *lmv,u32 mds) {
@@ -94,6 +102,30 @@ static inline int lmv_stripe_md_size(int stripe_count)return sizeof (*lsm) + stripe_count *sizeof (lsm->lsm_md_oinfo[0 ]); } +int lmv_name_to_stripe_index (enum lmv_hash_type hashtype, +unsigned int max_mdt_index, +const char *name,int namelen); + +static inline const struct lmv_oinfo * +lsm_name_to_stripe_info (const struct lmv_stripe_md *lsm,const char *name, +int namelen) +{ +int stripe_index; + + stripe_index =lmv_name_to_stripe_index (lsm->lsm_md_hash_type, + lsm->lsm_md_stripe_count, + name, namelen); +if (stripe_index <0 ) +return ERR_PTR (stripe_index); + +LASSERTF (stripe_index < lsm->lsm_md_stripe_count, +"stripe_index = %d, stripe_count = %d hash_type = %x name = %.*s\n" , + stripe_index, lsm->lsm_md_stripe_count, + lsm->lsm_md_hash_type, namelen, name); + +return &lsm->lsm_md_oinfo[stripe_index]; +} +struct lmv_tgt_desc *lmv_locate_mds (struct lmv_obd *lmv,struct md_op_data *op_data,struct lu_fid *fid);
drivers/staging/lustre/lustre/lmv/lmv_obd.c +187 -34
314 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_locks.c +3 -0
@@ -325,6 +325,9 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp,mdc_open_pack (req, op_data, it->it_create_mode,0 , it->it_flags, lmm, lmmsize); +req_capsule_set_size (&req->rq_pill, &RMF_MDT_MD ,RCL_SERVER , + obddev->u.cli.cl_max_mds_easize); +ptlrpc_request_set_replen (req);return req; }
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +11 -0
@@ -1878,6 +1878,17 @@ void lustre_swab_lov_desc(struct lov_desc *ld) }EXPORT_SYMBOL (lustre_swab_lov_desc); +void lustre_swab_lmv_user_md (struct lmv_user_md *lum) +{ +__swab32s (&lum->lum_magic); +__swab32s (&lum->lum_stripe_count); +__swab32s (&lum->lum_stripe_offset); +__swab32s (&lum->lum_hash_type); +__swab32s (&lum->lum_type); +CLASSERT (offsetof(typeof (*lum),lum_padding1 )); +} +EXPORT_SYMBOL (lustre_swab_lmv_user_md); +static void print_lum (struct lov_user_md *lum) {CDEBUG (D_OTHER ,"lov_user_md %p:\n" , lum);
Signature · 1 line
1.7.1
PATCH 13/80 staging: lustre: llite: fix "getdirstripe" to show stripe info
In reply to James SimmonsFrom: wang di <[email protected]>
Fix "lfs getdirstripe", so it can show layout information of striped directory
[root at testnode tests]# ../utils/lfs getdirstripe /mnt/lustre/test1 /mnt/lustre/test1lmv_stripe_count: 2lmv_stripe_offset: 0
mdtidx FID[seq:oid:ver]
0 [0x280000400:0x1:0x0]
1 [0x2c0000400:0x1:0x0]Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
Reviewed-on: http://review.whamcloud.com/7228
--- .../lustre/lustre/include/lustre/lustre_idl.h | 4 + .../lustre/lustre/include/lustre/lustre_user.h | 1 + drivers/staging/lustre/lustre/llite/dir.c | 184 +++++++++++++++----- .../staging/lustre/lustre/llite/llite_internal.h | 4 +- drivers/staging/lustre/lustre/llite/xattr.c | 7 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 26 +++ 6 files changed, 180 insertions(+), 46 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +4 -0
@@ -1728,6 +1728,8 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)#define OBD_MD_FLDATAVERSION (0x0010000000000000ULL)/* iversion sum */ #define OBD_MD_FLRELEASED (0x0020000000000000ULL)/* file released */ +#define OBD_MD_DEFAULT_MEA (0x0040000000000000ULL)/* default MEA */ +#define OBD_MD_FLGETATTR (OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME | \ OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLKSZ | \ OBD_MD_FLMODE | OBD_MD_FLTYPE | OBD_MD_FLUID | \
@@ -2543,6 +2545,8 @@ union lmv_mds_md {struct lmv_user_md lmv_user_md; }; +void lustre_swab_lmv_mds_md (union lmv_mds_md *lmm); +static inline ssize_t lmv_mds_md_size (int stripe_count,unsigned int lmm_magic) {ssize_t len = -EINVAL ;
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +1 -0
@@ -242,6 +242,7 @@ struct ost_id {#define LL_IOC_SET_LEASE _IOWR('f', 243, long)#define LL_IOC_GET_LEASE _IO('f', 244)#define LL_IOC_HSM_IMPORT _IOWR('f', 245, struct hsm_user_import) +#define LL_IOC_LMV_SET_DEFAULT_STRIPE _IOWR('f', 246, struct lmv_user_md)#define LL_STATFS_LMV 1#define LL_STATFS_LOV 2
drivers/staging/lustre/lustre/llite/dir.c +143 -41
269 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -2
@@ -728,8 +728,8 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, struct ptlrpc_request **request);int ll_dir_setstripe (struct inode *inode,struct lov_user_md *lump,int set_default); -int ll_dir_getstripe (struct inode *inode,struct lov_mds_md **lmmp, -int *lmm_size,struct ptlrpc_request **request); +int ll_dir_getstripe (struct inode *inode,void **lmmp,int *lmm_size, +struct ptlrpc_request **request,u64 valid);int ll_fsync (struct file *file,loff_t start,loff_t end,int data);int ll_merge_attr (const struct lu_env *env,struct inode *inode);int ll_fid2path (struct inode *inode,void __user *arg);
drivers/staging/lustre/lustre/llite/xattr.c +4 -3
@@ -390,8 +390,8 @@ static int ll_xattr_get(const struct xattr_handler *handler, lsm =ccc_inode_lsm_get (inode);if (!lsm) {if (S_ISDIR (inode->i_mode)) { - rc =ll_dir_getstripe (inode, &lmm, - &lmmsize, &request); + rc =ll_dir_getstripe (inode, (void **)&lmm, + &lmmsize, &request,0 ); }else { rc = -ENODATA ; }
@@ -491,7 +491,8 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)if (!ll_i2info (inode)->lli_has_smd) rc2 =-1 ; }else if (S_ISDIR (inode->i_mode)) { - rc2 =ll_dir_getstripe (inode, &lmm, &lmmsize, &request); + rc2 =ll_dir_getstripe (inode, (void **)&lmm, &lmmsize, + &request,0 ); }if (rc2 <0 ) {
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +26 -0
@@ -1878,6 +1878,32 @@ void lustre_swab_lov_desc(struct lov_desc *ld) }EXPORT_SYMBOL (lustre_swab_lov_desc); +/* This structure is always in little-endian */ +static void lustre_swab_lmv_mds_md_v1 (struct lmv_mds_md_v1 *lmm1) +{ +int i; + +__swab32s (&lmm1->lmv_magic); +__swab32s (&lmm1->lmv_stripe_count); +__swab32s (&lmm1->lmv_master_mdt_index); +__swab32s (&lmm1->lmv_hash_type); +__swab32s (&lmm1->lmv_layout_version); +for (i =0 ; i < lmm1->lmv_stripe_count; i++) +lustre_swab_lu_fid (&lmm1->lmv_stripe_fids[i]); +} + +void lustre_swab_lmv_mds_md (union lmv_mds_md *lmm) +{ +switch (lmm->lmv_magic) { +case LMV_MAGIC_V1 : +lustre_swab_lmv_mds_md_v1 (&lmm->lmv_md_v1); +break ; +default : +break ; + } +} +EXPORT_SYMBOL (lustre_swab_lmv_mds_md); +void lustre_swab_lmv_user_md (struct lmv_user_md *lum) {__swab32s (&lum->lum_magic);
Signature · 1 line
1.7.1
PATCH 14/80 staging: lustre: delete striped directory
In reply to James SimmonsFrom: wang di <[email protected]>
Add delete striped directory, it includes
1. enable sync log between MDTs, so slave objects will be delete by unlink log, which is similar as deleting ost object.
2. retrieve layout information of striped directory on MDT, then lock all of the slave objects before unlink.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
Reviewed-on: http://review.whamcloud.com/7445
--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 1 + drivers/staging/lustre/lustre/include/lustre_fid.h | 1 + drivers/staging/lustre/lustre/llite/dir.c | 10 --- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 5 ++ drivers/staging/lustre/lustre/lmv/lmv_obd.c | 75 +++++++++++++++----- 5 files changed, 65 insertions(+), 27 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +1 -0
@@ -968,6 +968,7 @@ struct ldlm_enqueue_info {void *ei_cb_cp;/** lock completion callback */ void *ei_cb_gl;/** lock glimpse callback */ void *ei_cbdata;/** Data to be passed into callbacks. */ + unsigned int ei_enq_slave:1; /* whether enqueue slave stripes */ };extern struct obd_ops ldlm_obd_ops;
drivers/staging/lustre/lustre/include/lustre_fid.h +1 -0
@@ -229,6 +229,7 @@ enum local_oid {MDD_LOV_OBJ_OSEQ =4121UL ,LFSCK_NAMESPACE_OID =4122UL ,REMOTE_PARENT_DIR_OID =4123UL , + SLAVE_LLOG_CATALOGS_OID = 4124UL, };static inline void lu_local_obj_fid (struct lu_fid *fid,__u32 oid)
drivers/staging/lustre/lustre/llite/dir.c +0 -10
@@ -679,16 +679,6 @@ static int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump,if (unlikely (lump->lum_magic !=LMV_USER_MAGIC ))return -EINVAL ; -if (lump->lum_stripe_offset == (__u32)-1 ) { -int mdtidx; - - mdtidx =ll_get_mdt_idx (dir); -if (mdtidx <0 ) -return mdtidx; - - lump->lum_stripe_offset = mdtidx; - } -CDEBUG (D_VFSTRACE ,"VFS Op:inode=" DFID "(%p) name %s stripe_offset %d, stripe_count: %u\n" ,PFID (ll_inode2fid (dir)), dir, filename, (int )lump->lum_stripe_offset, lump->lum_stripe_count);
drivers/staging/lustre/lustre/lmv/lmv_intent.c +5 -0
@@ -244,6 +244,11 @@ update:if (req)ptlrpc_req_finished (req); +if (it.it_lock_mode && lockh) { +ldlm_lock_decref (lockh, it.it_lock_mode); + it.it_lock_mode =0 ; + } + rc = -EIO ; goto cleanup; }
drivers/staging/lustre/lustre/lmv/lmv_obd.c +58 -17
124 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 15/80 staging: lustre: obdclass: fix lmd_parse() to handle comma-separated NIDs
In reply to James SimmonsFrom: Jian Yu <[email protected]>
This patch handles the upgrade situation that old mountdata already contains comma-separated NIDs. The correct way to fix the original issue is to parse comma-separated NIDs in lmd_parse().
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4460
Reviewed-on: http://review.whamcloud.com/8918
--- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/obdclass/obd_mount.c +16 -4
@@ -880,7 +880,7 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)*/ static int lmd_parse (char *options,struct lustre_mount_data *lmd) { -char *s1, *s2, *devname =NULL ; +char *s1, *s2, *s3, *devname =NULL ;struct lustre_mount_data *raw = (struct lustre_mount_data *)options;int rc =0 ;
@@ -913,6 +913,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)/* Skip whitespace and extra commas */ while (*s1 ==' ' || *s1 ==',' ) s1++; + s3 = s1;/* Client options are parsed in ll_options: eg. flock, * user_xattr, acl
@@ -970,6 +971,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) rc =lmd_parse_mgssec (lmd, s1 +7 );if (rc) goto invalid; + s3 = s2; clear++;/* ost exclusion list */ }else if (strncmp (s1,"exclude=" ,8 ) ==0 ) {
@@ -990,10 +992,19 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)size_t length, params_length;char *tail =strchr (s1 +6 ,',' ); -if (!tail) +if (!tail) { length =strlen (s1); -else - length = tail - s1; + }else { +lnet_nid_t nid; +char *param_str = tail +1 ; +int supplementary =1 ; + +while (!class_parse_nid_quiet (param_str, &nid, + ¶m_str)) { + supplementary =0 ; + } + length = param_str - s1 - supplementary; + } length -=6 ; params_length =strlen (lmd->lmd_params);if (params_length + length +1 >=LMD_PARAMS_MAXLEN )
@@ -1001,6 +1012,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)strncat (lmd->lmd_params, s1 +6 , length); lmd->lmd_params[params_length + length] ='\0' ;strlcat (lmd->lmd_params," " ,LMD_PARAMS_MAXLEN ); + s3 = s1 +6 + length; clear++; }else if (strncmp (s1,"osd=" ,4 ) ==0 ) { rc =lmd_parse_string (&lmd->lmd_osd_type, s1 +4 );
Signature · 1 line
1.7.1
PATCH 16/80 staging: lustre: obdclass: bug fixes for lu_device_type handling
In reply to James SimmonsFrom: Fan Yong <[email protected]>
There was no protection when inc/dec lu_device_type::ldt_device_nr, which may caused the ldt_device_nr to be wrong and trigger assert. This patch redefine lu_device_type::ldt_device_nr as atomic type.
There was no protection when add/del lu_device_type::ldt_linkage into/from the global lu_device_types list, which may caused bad address accessing. This patch uses the existing obd_types_lock to protect related operations.
We do NOT need lu_types_stop() any longer. Such function scans the global lu_device_types list, and for each type item on it which has zerod lu_device_type::ldt_device_nr, call its stop() method. In fact, the lu_device_type::ldt_device_nr only will be zero when the last lu_device_fini() is called, and at that time, inside the lu_device_fini(), its stop() method will be called. So it is unnecessary to call the stop() again via lu_types_stop().
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4604
Reviewed-on: http://review.whamcloud.com/8694
--- drivers/staging/lustre/lustre/include/lu_object.h | 3 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 6 --- drivers/staging/lustre/lustre/obdclass/lu_object.c | 34 ++++++++++---------- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 1 - 4 files changed, 18 insertions(+), 26 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +1 -2
@@ -327,7 +327,7 @@ struct lu_device_type {/** * Number of existing device type instances. */ -unsigned ldt_device_nr; +atomic_t ldt_device_nr;/** * Linkage into a global list of all device types. *
@@ -673,7 +673,6 @@ void lu_object_add(struct lu_object *before, struct lu_object *o);int lu_device_type_init (struct lu_device_type *ldt);void lu_device_type_fini (struct lu_device_type *ldt); -void lu_types_stop (void );/** @} ctors */
drivers/staging/lustre/lustre/llite/vvp_dev.c +0 -6
@@ -368,12 +368,6 @@ int cl_sb_fini(struct super_block *sb)CERROR ("Cannot cleanup cl-stack due to memory shortage.\n" ); result =PTR_ERR (env); } -/* -* If mount failed (sbi->ll_cl == NULL), and this there are no other -* mounts, stop device types manually (this usually happens -* automatically when last device is destroyed). -*/ -lu_types_stop ();return result; }
drivers/staging/lustre/lustre/obdclass/lu_object.c +17 -17
@@ -726,34 +726,31 @@ int lu_device_type_init(struct lu_device_type *ldt) {int result =0 ; +atomic_set (&ldt->ldt_device_nr,0 );INIT_LIST_HEAD (&ldt->ldt_linkage);if (ldt->ldt_ops->ldto_init) result = ldt->ldt_ops->ldto_init (ldt); -if (result ==0 ) + +if (!result) { +spin_lock (&obd_types_lock);list_add (&ldt->ldt_linkage, &lu_device_types); +spin_unlock (&obd_types_lock); + } +return result; }EXPORT_SYMBOL (lu_device_type_init);void lu_device_type_fini (struct lu_device_type *ldt) { +spin_lock (&obd_types_lock);list_del_init (&ldt->ldt_linkage); +spin_unlock (&obd_types_lock);if (ldt->ldt_ops->ldto_fini) ldt->ldt_ops->ldto_fini (ldt); }EXPORT_SYMBOL (lu_device_type_fini); -void lu_types_stop (void ) -{ -struct lu_device_type *ldt; - -list_for_each_entry (ldt, &lu_device_types, ldt_linkage) { -if (ldt->ldt_device_nr ==0 && ldt->ldt_ops->ldto_stop) - ldt->ldt_ops->ldto_stop (ldt); - } -} -EXPORT_SYMBOL (lu_types_stop); -/** * Global list of all sites on this node */
@@ -1082,8 +1079,10 @@ EXPORT_SYMBOL(lu_device_put);*/ int lu_device_init (struct lu_device *d,struct lu_device_type *t) { -if (t->ldt_device_nr++ ==0 && t->ldt_ops->ldto_start) +if (atomic_inc_return (&t->ldt_device_nr) ==1 && + t->ldt_ops->ldto_start) t->ldt_ops->ldto_start (t); +memset (d,0 ,sizeof (*d));atomic_set (&d->ld_ref,0 ); d->ld_type = t;
@@ -1098,9 +1097,8 @@ EXPORT_SYMBOL(lu_device_init);*/ void lu_device_fini (struct lu_device *d) { -struct lu_device_type *t; +struct lu_device_type *t = d->ld_type; - t = d->ld_type;if (d->ld_obd) { d->ld_obd->obd_lu_dev =NULL ; d->ld_obd =NULL ;
@@ -1109,8 +1107,10 @@ void lu_device_fini(struct lu_device *d)lu_ref_fini (&d->ld_reference);LASSERTF (atomic_read (&d->ld_ref) ==0 ,"Refcount is %u\n" ,atomic_read (&d->ld_ref)); -LASSERT (t->ldt_device_nr >0 ); -if (--t->ldt_device_nr ==0 && t->ldt_ops->ldto_stop) +LASSERT (atomic_read (&t->ldt_device_nr) >0 ); + +if (atomic_dec_and_test (&t->ldt_device_nr) && + t->ldt_ops->ldto_stop) t->ldt_ops->ldto_stop (t); }EXPORT_SYMBOL (lu_device_fini);
drivers/staging/lustre/lustre/obdclass/obd_mount.c +0 -1
@@ -670,7 +670,6 @@ int lustre_common_put_super(struct super_block *sb) }/* Drop a ref to the mounted disk */ lustre_put_lsi (sb); -lu_types_stop ();return rc; }EXPORT_SYMBOL (lustre_common_put_super);
Signature · 1 line
1.7.1
PATCH 17/80 staging: lustre: add ability to migrate inodes.
In reply to James SimmonsFrom: wang di <[email protected]>
Add client support to migrate the individual inodes from one MDT to another MDT, and this functionality will only migrate inode layout on MDT but not touch data object on OST.
The directory will be migrated from top to the bottom, i.e. migrating parent first, then migrating the child.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2430
Reviewed-on: http://review.whamcloud.com/6662
--- .../lustre/lustre/include/lustre/lustre_idl.h | 11 +- .../lustre/lustre/include/lustre/lustre_user.h | 1 + drivers/staging/lustre/lustre/include/lustre_lmv.h | 2 + drivers/staging/lustre/lustre/include/obd.h | 12 +-- drivers/staging/lustre/lustre/llite/dir.c | 43 +++++- drivers/staging/lustre/lustre/llite/file.c | 113 ++++++++++++- .../staging/lustre/lustre/llite/llite_internal.h | 14 ++- drivers/staging/lustre/lustre/llite/llite_lib.c | 33 ++++- drivers/staging/lustre/lustre/llite/namei.c | 3 +- drivers/staging/lustre/lustre/llite/rw.c | 4 + drivers/staging/lustre/lustre/llite/statahead.c | 1 + drivers/staging/lustre/lustre/lmv/lmv_intent.c | 32 +++- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 176 ++++++++++++++------ drivers/staging/lustre/lustre/mdc/mdc_lib.c | 2 + drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 4 +- 15 files changed, 368 insertions(+), 83 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +9 -2
@@ -1482,6 +1482,7 @@ enum obdo_flags {#define LOV_MAGIC LOV_MAGIC_V1#define LOV_MAGIC_JOIN_V1 0x0BD20BD0#define LOV_MAGIC_V3 0x0BD30BD0 +#define LOV_MAGIC_MIGRATE 0x0BD40BD0/* * magic for fully defined striping
@@ -1987,7 +1988,7 @@ enum mdt_reint_cmd {REINT_OPEN =6 ,REINT_SETXATTR =7 ,REINT_RMENTRY =8 , -/* REINT_WRITE = 9, */ +REINT_MIGRATE =9 , REINT_MAX };
@@ -2280,6 +2281,7 @@ enum mds_op_bias {MDS_CREATE_VOLATILE =1 <<10 ,MDS_OWNEROVERRIDE =1 <<11 ,MDS_HSM_RELEASE =1 <<12 , + MDS_RENAME_MIGRATE = BIT(13), };/* instance of mdt_reint_rec */
@@ -2488,11 +2490,13 @@ struct lmv_desc {/* lmv structures */ #define LMV_MAGIC_V1 0x0CD10CD0/* normal stripe lmv magic */ #define LMV_USER_MAGIC 0x0CD20CD0/* default lmv magic*/ +#define LMV_MAGIC_MIGRATE 0x0CD30CD0/* migrate stripe lmv magic */ #define LMV_MAGIC LMV_MAGIC_V1enum lmv_hash_type {LMV_HASH_TYPE_ALL_CHARS =1 ,LMV_HASH_TYPE_FNV_1A_64 =2 , +LMV_HASH_TYPE_MIGRATION =3 , };#define LMV_HASH_NAME_ALL_CHARS "all_char"
@@ -2552,7 +2556,8 @@ static inline ssize_t lmv_mds_md_size(int stripe_count, unsigned int lmm_magic)ssize_t len = -EINVAL ;switch (lmm_magic) { -case LMV_MAGIC_V1 : { +case LMV_MAGIC_V1 : +case LMV_MAGIC_MIGRATE : {struct lmv_mds_md_v1 *lmm1; len =sizeof (*lmm1);
@@ -2568,6 +2573,7 @@ static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm) {switch (le32_to_cpu (lmm->lmv_magic)) {case LMV_MAGIC_V1 : +case LMV_MAGIC_MIGRATE :return le32_to_cpu (lmm->lmv_md_v1.lmv_stripe_count);case LMV_USER_MAGIC :return le32_to_cpu (lmm->lmv_user_md.lum_stripe_count);
@@ -2583,6 +2589,7 @@ static inline int lmv_mds_md_stripe_count_set(union lmv_mds_md *lmm,switch (le32_to_cpu (lmm->lmv_magic)) {case LMV_MAGIC_V1 : +case LMV_MAGIC_MIGRATE : lmm->lmv_md_v1.lmv_stripe_count =cpu_to_le32 (stripe_count);break ;case LMV_USER_MAGIC :
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +1 -0
@@ -243,6 +243,7 @@ struct ost_id {#define LL_IOC_GET_LEASE _IO('f', 244)#define LL_IOC_HSM_IMPORT _IOWR('f', 245, struct hsm_user_import)#define LL_IOC_LMV_SET_DEFAULT_STRIPE _IOWR('f', 246, struct lmv_user_md) +#define LL_IOC_MIGRATE _IOR('f', 247, int)#define LL_STATFS_LMV 1#define LL_STATFS_LOV 2
drivers/staging/lustre/lustre/include/lustre_lmv.h +2 -0
@@ -106,6 +106,7 @@ static inline void lmv_cpu_to_le(union lmv_mds_md *lmv_dst, {switch (lmv_src->lmv_magic) {case LMV_MAGIC_V1 : +case LMV_MAGIC_MIGRATE :lmv1_cpu_to_le (&lmv_dst->lmv_md_v1, &lmv_src->lmv_md_v1);break ;default :
@@ -118,6 +119,7 @@ static inline void lmv_le_to_cpu(union lmv_mds_md *lmv_dst, {switch (le32_to_cpu (lmv_src->lmv_magic)) {case LMV_MAGIC_V1 : +case LMV_MAGIC_MIGRATE :lmv1_le_to_cpu (&lmv_dst->lmv_md_v1, &lmv_src->lmv_md_v1);break ;default :
drivers/staging/lustre/lustre/include/obd.h +1 -11
@@ -847,9 +847,6 @@ struct md_op_data {/* Various operation flags. */ enum mds_op_bias op_bias; -/* Operation type */ -__u32 op_opc; -/* Used by readdir */ __u64 op_offset;
@@ -871,6 +868,7 @@ enum op_cli_flags {CLI_RM_ENTRY =1 <<1 ,CLI_HASH64 =BIT (2 ),CLI_API32 =BIT (3 ), + CLI_MIGRATE = BIT(4), };struct md_enqueue_info ;
@@ -1013,14 +1011,6 @@ struct obd_ops {*/ }; -enum { -LUSTRE_OPC_MKDIR = (1 <<0 ), -LUSTRE_OPC_SYMLINK = (1 <<1 ), -LUSTRE_OPC_MKNOD = (1 <<2 ), -LUSTRE_OPC_CREATE = (1 <<3 ), -LUSTRE_OPC_ANY = (1 <<4 ) -}; -/* lmv structures */ struct lustre_md {struct mdt_body *body;
drivers/staging/lustre/lustre/llite/dir.c +41 -2
61 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/file.c +109 -4
131 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +13 -1
@@ -660,6 +660,7 @@ extern const struct inode_operations ll_dir_inode_operations;int ll_dir_read (struct inode *inode,__u64 *ppos,struct md_op_data *op_data,struct dir_context *ctx);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);struct page *ll_get_dir_page (struct inode *dir,struct md_op_data *op_data,__u64 hash,struct ll_dir_chain *chain);void ll_release_page (struct inode *inode,struct page *page,bool remove);
@@ -675,6 +676,7 @@ int ll_test_inode_by_fid(struct inode *inode, void *opaque);int ll_md_blocking_ast (struct ldlm_lock *,struct ldlm_lock_desc *,void *data,int flag);struct dentry *ll_splice_alias (struct inode *inode,struct dentry *de); +void ll_update_times (struct ptlrpc_request *request,struct inode *inode);/* llite/rw.c */ int ll_writepage (struct page *page,struct writeback_control *wbc);
@@ -717,7 +719,8 @@ void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data, struct lustre_handle *fh);int ll_getattr (struct vfsmount *mnt,struct dentry *de,struct kstat *stat);struct posix_acl *ll_get_acl (struct inode *inode,int type); - +int ll_migrate (struct inode *parent,struct file *file,int mdtidx, +const char *name,int namelen);int ll_inode_permission (struct inode *inode,int mask); int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
@@ -777,6 +780,15 @@ int ll_obd_statfs(struct inode *inode, void __user *arg);int ll_get_max_mdsize (struct ll_sb_info *sbi,int *max_mdsize);int ll_get_default_mdsize (struct ll_sb_info *sbi,int *default_mdsize);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, int namelen,
drivers/staging/lustre/lustre/llite/llite_lib.c +30 -3
@@ -1114,8 +1114,34 @@ static void ll_update_lsm_md(struct inode *inode, struct lustre_md *md)struct lmv_stripe_md *lsm = md->lmv;int idx; -LASSERT (lsm);LASSERT (S_ISDIR (inode->i_mode)); +CDEBUG (D_INODE ,"update lsm %p of " DFID "\n" , lli->lli_lsm_md, +PFID (ll_inode2fid (inode))); + +/* no striped information from request. */ +if (!lsm) { +if (!lli->lli_lsm_md) { +return ; + }else if (lli->lli_lsm_md->lsm_md_magic ==LMV_MAGIC_MIGRATE ) { +/* +* migration is done, the temporay MIGRATE layout has +* been removed +*/ +CDEBUG (D_INODE ,DFID " finish migration.\n" , +PFID (ll_inode2fid (inode))); +lmv_free_memmd (lli->lli_lsm_md); + lli->lli_lsm_md =NULL ; +return ; + }else { +/* +* The lustre_md from req does not include stripeEA, +* see ll_md_setattr +*/ +return ; + } + } + +/* set the directory layout */ if (!lli->lli_lsm_md) {int rc;
@@ -1132,6 +1158,8 @@ static void ll_update_lsm_md(struct inode *inode, struct lustre_md *md)* will not free this lsm */ md->lmv =NULL ; +CDEBUG (D_INODE ,"Set lsm %p magic %x to " DFID "\n" , lsm, + lsm->lsm_md_magic,PFID (ll_inode2fid (inode)));return ; }
@@ -1668,7 +1696,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) lli->lli_maxbytes =MAX_LFS_FILESIZE ; } -if (S_ISDIR (inode->i_mode) && md->lmv) +if (S_ISDIR (inode->i_mode))ll_update_lsm_md (inode, md);#ifdef CONFIG_FS_POSIX_ACL
@@ -2306,7 +2334,6 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,if ((opc ==LUSTRE_OPC_CREATE ) && name &&filename_is_volatile (name, namelen,NULL )) op_data->op_bias |=MDS_CREATE_VOLATILE ; - op_data->op_opc = opc; op_data->op_mds =0 ; op_data->op_data = data;
drivers/staging/lustre/lustre/llite/namei.c +1 -2
@@ -752,8 +752,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,return 0 ; } -static void ll_update_times (struct ptlrpc_request *request, -struct inode *inode) +void ll_update_times (struct ptlrpc_request *request,struct inode *inode) {struct mdt_body *body =req_capsule_server_get (&request->rq_pill, &RMF_MDT_BODY );
drivers/staging/lustre/lustre/llite/rw.c +4 -0
@@ -1015,6 +1015,10 @@ int ll_writepages(struct address_space *mapping, struct writeback_control *wbc)* is called later on. */ ignore_layout =1 ; + +if (!ll_i2info (inode)->lli_clob) +return 0 ; + result =cl_sync_file_range (inode, start, end, mode, ignore_layout);if (result >0 ) { wbc->nr_to_write -= result;
drivers/staging/lustre/lustre/llite/statahead.c +1 -0
@@ -1607,6 +1607,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, *dentryp,PFID (ll_inode2fid (d_inode (*dentryp))), PFID(ll_inode2fid(inode))); +ll_intent_release (&it);ll_sai_unplug (sai, entry);return -ESTALE ; }else {
drivers/staging/lustre/lustre/lmv/lmv_intent.c +27 -5
@@ -43,6 +43,7 @@#include "../include/lustre_lib.h" #include "../include/lustre_net.h" #include "../include/lustre_dlm.h" +#include "../include/lustre_mdc.h" #include "../include/obd_class.h" #include "../include/lprocfs_status.h" #include "lmv_internal.h"
@@ -332,6 +333,8 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, oinfo =lsm_name_to_stripe_info (lsm, op_data->op_name, op_data->op_namelen); +if (IS_ERR (oinfo)) +return PTR_ERR (oinfo); op_data->op_fid1 = oinfo->lmo_fid; }
@@ -408,6 +411,7 @@ static int lmv_intent_lookup(struct obd_export *exp, ldlm_blocking_callback cb_blocking, __u64 extra_lock_flags) { +struct lmv_stripe_md *lsm = op_data->op_mea1;struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *tgt =NULL ;
@@ -421,17 +425,15 @@ static int lmv_intent_lookup(struct obd_export *exp,if (!fid_is_sane (&op_data->op_fid2))fid_zero (&op_data->op_fid2); -CDEBUG (D_INODE ,"LOOKUP_INTENT with fid1=" DFID ", fid2=" DFID -", name='%s' -> mds #%d\n" ,PFID (&op_data->op_fid1), -PFID (&op_data->op_fid2), +CDEBUG (D_INODE ,"LOOKUP_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%d lsm=%p lsm_magic=%x\n" , +PFID (&op_data->op_fid1),PFID (&op_data->op_fid2), op_data->op_name ? op_data->op_name :"<NULL>" , - tgt->ltd_idx); + tgt->ltd_idx, lsm, !lsm ?-1 : lsm->lsm_md_magic); op_data->op_bias &= ~MDS_CROSS_REF ; rc =md_intent_lock (tgt->ltd_exp, op_data, lmm, lmmsize, it, flags, reqp, cb_blocking, extra_lock_flags); -if (rc <0 )return rc;
@@ -448,6 +450,26 @@ static int lmv_intent_lookup(struct obd_export *exp,return rc; }return rc; + }else if (it_disposition (it,DISP_LOOKUP_NEG ) && lsm && + lsm->lsm_md_magic ==LMV_MAGIC_MIGRATE ) { +/* +* For migrating directory, if it can not find the child in +* the source directory(master stripe), try the targeting +* directory(stripe 1) +*/ + tgt =lmv_find_target (lmv, &lsm->lsm_md_oinfo[1 ].lmo_fid); +if (IS_ERR (tgt)) +return PTR_ERR (tgt); + +ptlrpc_req_finished (*reqp); +CDEBUG (D_INODE ,"For migrating dir, try target dir " DFID "\n" , +PFID (&lsm->lsm_md_oinfo[1 ].lmo_fid)); + + op_data->op_fid1 = lsm->lsm_md_oinfo[1 ].lmo_fid; + it->it_disposition &= ~DISP_ENQ_COMPLETE ; + rc =md_intent_lock (tgt->ltd_exp, op_data, lmm, lmmsize, it, + flags, reqp, cb_blocking, extra_lock_flags); +return rc; }/*
drivers/staging/lustre/lustre/lmv/lmv_obd.c +124 -52
289 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_lib.c +2 -0
@@ -390,6 +390,8 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data, rec =req_capsule_client_get (&req->rq_pill, &RMF_REC_REINT );/* XXX do something about time, uid, gid */ + rec->rn_opcode = op_data->op_cli_flags &CLI_MIGRATE ? +REINT_MIGRATE :REINT_RENAME ; rec->rn_opcode =REINT_RENAME ; rec->rn_fsuid = op_data->op_fsuid; rec->rn_fsgid = op_data->op_fsgid;
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +3 -1
@@ -190,7 +190,9 @@ void lustre_assert_wire_constants(void) (long long)REINT_SETXATTR);LASSERTF (REINT_RMENTRY ==8 ,"found %lld\n" , (long long )REINT_RMENTRY ); -LASSERTF (REINT_MAX ==9 ,"found %lld\n" , +LASSERTF (REINT_MIGRATE ==9 ,"found %lld\n" , + (long long )REINT_MIGRATE ); +LASSERTF (REINT_MAX ==10 ,"found %lld\n" , (long long )REINT_MAX );LASSERTF (DISP_IT_EXECD ==0x00000001UL ,"found 0x%.8xUL\n" , (unsigned )DISP_IT_EXECD );
Signature · 1 line
1.7.1
PATCH 18/80 staging: lustre: lmv: fix issue found by Klocwork Insight tool
In reply to James SimmonsFrom: Dmitry Eremin <[email protected]>
'plock.cookie' might be used uninitialized in this function.
sscanf format specification '%d' expects type 'int *' for 'd', but parameter 3 has a different type '__u32*'
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-on: http://review.whamcloud.com/9390
--- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 ++++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_intent.c +4 -2
@@ -137,8 +137,10 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm, it->it_remote_lock_mode = it->it_lock_mode; } - it->it_lock_handle = plock.cookie; - it->it_lock_mode = pmode; +if (pmode) { + it->it_lock_handle = plock.cookie; + it->it_lock_mode = pmode; + } out_free_op_data:kfree (op_data);
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -1
@@ -1419,7 +1419,7 @@ static int lmv_process_config(struct obd_device *obd, u32 len, void *buf)obd_str2uuid (&obd_uuid,lustre_cfg_buf (lcfg,1 )); -if (sscanf (lustre_cfg_buf (lcfg,2 ),"%d" , &index) !=1 ) { +if (sscanf (lustre_cfg_buf (lcfg,2 ),"%u" , &index) !=1 ) { rc = -EINVAL ; goto out; }
Signature · 1 line
1.7.1
PATCH 19/80 staging: lustre: libcfs: Only dump log once per sec. to avoid EEXIST
In reply to James SimmonsFrom: Ryan Haasken <[email protected]>
Since the log file name contains the current time in seconds, dumping the logs more than once per second causes EEXIST errors to be emitted. Add a static variable to libcfs_debug_dumplog_internal that records the time of the last Lustre log dump. If the current time in seconds is equal to the last time, do not dump logs again.
Note that this is not thread-safe. However, in the rare case that two threads try to access last_dump_time simultaneously, the worst thing that could happen is that one of the threads will get an EEXIST error when trying to write the log file. This is no worse than the current situation, and it is not likely to happen.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4129
Reviewed-on: http://review.whamcloud.com/8964
--- drivers/staging/lustre/lnet/libcfs/debug.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/libcfs/debug.c +7 -2
@@ -328,15 +328,20 @@ libcfs_debug_str2mask(int *mask, const char *str, int is_subsys)*/ void libcfs_debug_dumplog_internal (void *arg) { +static time64_t last_dump_time; +time64_t current_time;void *journal_info; journal_info = current->journal_info; current->journal_info =NULL ; + current_time =ktime_get_real_seconds (); -if (strncmp (libcfs_debug_file_path_arr,"NONE" ,4 ) !=0 ) { +if (strncmp (libcfs_debug_file_path_arr,"NONE" ,4 ) && + current_time > last_dump_time) { + last_dump_time = current_time;snprintf (debug_file_name,sizeof (debug_file_name) -1 ,"%s.%lld.%ld" , libcfs_debug_file_path_arr, - (s64 )ktime_get_real_seconds (), (long_ptr_t )arg); + (s64 )current_time, (long_ptr_t )arg);pr_alert ("LustreError: dumping log to %s\n" , debug_file_name);cfs_tracefile_dump_all_pages (debug_file_name);libcfs_run_debug_log_upcall (debug_file_name);
Signature · 1 line
1.7.1
PATCH 20/80 staging: lustre: llite: enable clients to inject error for lfsck
In reply to James SimmonsFrom: Fan Yong <[email protected]>
This enables the client to inject an error by altering the parent FID in order to test if the server side file system checker behaves properly.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3951
Reviewed-on: http://review.whamcloud.com/7667
--- .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/llite/vvp_req.c | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-)
drivers/staging/lustre/lustre/include/obd_support.h +1 -0
@@ -474,6 +474,7 @@ extern char obd_jobid_var[];#define OBD_FAIL_LFSCK_CRASH 0x160a#define OBD_FAIL_LFSCK_NO_AUTO 0x160b#define OBD_FAIL_LFSCK_NO_DOUBLESCAN 0x160c +#define OBD_FAIL_LFSCK_INVALID_PFID 0x1619/* UPDATE */ #define OBD_FAIL_UPDATE_OBJ_NET 0x1700
drivers/staging/lustre/lustre/llite/vvp_req.c +2 -0
@@ -83,6 +83,8 @@ static void vvp_req_attr_set(const struct lu_env *env, }obdo_from_inode (oa, inode, valid_flags & flags);obdo_set_parent_fid (oa, &ll_i2info (inode)->lli_fid); +if (OBD_FAIL_CHECK (OBD_FAIL_LFSCK_INVALID_PFID )) + oa->o_parent_oid++;memcpy (attr->cra_jobid,ll_i2info (inode)->lli_jobid,JOBSTATS_JOBID_SIZE ); }
Signature · 1 line
1.7.1
PATCH 21/80 staging: lustre: osc: allow to call brw_commit() multiple times
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
Sometimes the rq_commit_cb of BRW RPC can be called twice if that RPC has already committed at reply time. This will cause inaccuracy of unstable pages accounting and then assertion.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3274
Reviewed-on: http://review.whamcloud.com/8215
--- drivers/staging/lustre/lustre/osc/osc_cache.c | 19 ++++--------------- drivers/staging/lustre/lustre/osc/osc_request.c | 8 ++++---- 2 files changed, 8 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +4 -15
@@ -1875,11 +1875,6 @@ void osc_dec_unstable_pages(struct ptlrpc_request *req)atomic_sub (page_count, &obd_unstable_pages);LASSERT (atomic_read (&obd_unstable_pages) >=0 ); -spin_lock (&req->rq_lock); - req->rq_committed =1 ; - req->rq_unstable =0 ; -spin_unlock (&req->rq_lock); -wake_up_all (&cli->cl_cache->ccc_unstable_waitq); }
@@ -1909,27 +1904,21 @@ void osc_inc_unstable_pages(struct ptlrpc_request *req)LASSERT (atomic_read (&obd_unstable_pages) >=0 );atomic_add (page_count, &obd_unstable_pages); -spin_lock (&req->rq_lock); -/* * If the request has already been committed (i.e. brw_commit * called via rq_commit_cb), we need to undo the unstable page * increments we just performed because rq_commit_cb wont be -* called again. Otherwise, just set the commit callback so the -* unstable page accounting is properly updated when the request -* is committed +* called again. */ -if (req->rq_committed) { +spin_lock (&req->rq_lock); +if (unlikely (req->rq_committed)) {/* Drop lock before calling osc_dec_unstable_pages */ spin_unlock (&req->rq_lock);osc_dec_unstable_pages (req); -spin_lock (&req->rq_lock); }else { req->rq_unstable =1 ; - req->rq_commit_cb = osc_dec_unstable_pages; +spin_unlock (&req->rq_lock); } - -spin_unlock (&req->rq_lock); }/* this must be called holding the loi list lock to give coverage to exit_cache,
drivers/staging/lustre/lustre/osc/osc_request.c +4 -4
@@ -1847,21 +1847,21 @@ static int brw_interpret(const struct lu_env *env,static void brw_commit (struct ptlrpc_request *req) { -spin_lock (&req->rq_lock);/* * If osc_inc_unstable_pages (via osc_extent_finish) races with * this called via the rq_commit_cb, I need to ensure * osc_dec_unstable_pages is still called. Otherwise unstable * pages may be leaked. */ -if (req->rq_unstable) { +spin_lock (&req->rq_lock); +if (unlikely (req->rq_unstable)) { + req->rq_unstable =0 ;spin_unlock (&req->rq_lock);osc_dec_unstable_pages (req); -spin_lock (&req->rq_lock); }else { req->rq_committed =1 ; +spin_unlock (&req->rq_lock); } -spin_unlock (&req->rq_lock); }/**
Signature · 1 line
1.7.1
PATCH 22/80 staging: lustre: llite: a few fixes for migration.
In reply to James SimmonsFrom: wang di <[email protected]>
1. Clear the client dentry cache before migrating file/directory to the remote MDT.
2. Do not return stripe information to client, if it did not get the layout lock.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4682
Reviewed-on: http://review.whamcloud.com/9522
--- drivers/staging/lustre/lustre/llite/dir.c | 22 +++--------- drivers/staging/lustre/lustre/llite/file.c | 34 +++++++++++--------- .../staging/lustre/lustre/llite/llite_internal.h | 2 + drivers/staging/lustre/lustre/lov/lov_object.c | 1 + 4 files changed, 28 insertions(+), 31 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +6 -16
@@ -1318,11 +1318,9 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)return 0 ; }case IOC_MDC_LOOKUP : { -struct ptlrpc_request *request =NULL ;int namelen, len =0 ;char *buf =NULL ;char *filename; -struct md_op_data *op_data; rc =obd_ioctl_getdata (&buf, &len, (void __user *)arg);if (rc)
@@ -1338,21 +1336,13 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) goto out_free; } - op_data =ll_prep_md_op_data (NULL , inode,NULL , filename, namelen, -0 ,LUSTRE_OPC_ANY ,NULL ); -if (IS_ERR (op_data)) { - rc =PTR_ERR (op_data); - goto out_free; - } - - op_data->op_valid =OBD_MD_FLID ; - rc =md_getattr_name (sbi->ll_md_exp, op_data, &request); -ll_finish_md_op_data (op_data); + rc =ll_get_fid_by_name (inode, filename, namelen,NULL );if (rc <0 ) { -CDEBUG (D_INFO ,"md_getattr_name: %d\n" , rc); +CERROR ("%s: lookup %.*s failed: rc = %d\n" , +ll_get_fsname (inode->i_sb,NULL ,0 ), namelen, + filename, rc); goto out_free; } -ptlrpc_req_finished (request); out_free:obd_ioctl_freedata (buf, len);return rc;
@@ -1981,7 +1971,7 @@ out_quotactl: filename = data->ioc_inlbuf1; namelen = data->ioc_inllen1; -if (namelen <1 ) { +if (namelen <1 || namelen !=strlen (filename) +1 ) { rc = -EINVAL ; goto migrate_free; }
@@ -1992,7 +1982,7 @@ out_quotactl: } mdtidx = *(int *)data->ioc_inlbuf2; - rc =ll_migrate (inode, file, mdtidx, filename, namelen); + rc =ll_migrate (inode, file, mdtidx, filename, namelen -1 ); migrate_free:obd_ioctl_freedata (buf, len);
drivers/staging/lustre/lustre/llite/file.c +19 -15
@@ -2828,8 +2828,8 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)return rc; } -static int ll_get_fid_by_name (struct inode *parent,const char *name, -int namelen,struct lu_fid *fid) +int ll_get_fid_by_name (struct inode *parent,const char *name, +int namelen,struct lu_fid *fid) {struct md_op_data *op_data =NULL ;struct ptlrpc_request *req;
@@ -2843,20 +2843,19 @@ static int ll_get_fid_by_name(struct inode *parent, const char *name, op_data->op_valid =OBD_MD_FLID ; rc =md_getattr_name (ll_i2sbi (parent)->ll_md_exp, op_data, &req); +ll_finish_md_op_data (op_data);if (rc <0 ) - goto out_free; +return rc; body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY );if (!body) { rc = -EFAULT ; goto out_req; } - *fid = body->fid1; +if (fid) + *fid = body->fid1; out_req:ptlrpc_req_finished (req); -out_free: -if (op_data) -ll_finish_md_op_data (op_data);return rc; }
@@ -2864,12 +2863,13 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, const char *name, int namelen) {struct ptlrpc_request *request =NULL ; +struct inode *child_inode =NULL ;struct dentry *dchild =NULL ;struct md_op_data *op_data;struct qstr qstr;int rc; -CDEBUG (D_VFSTRACE ,"migrate %s under" DFID " to MDT%d\n" , +CDEBUG (D_VFSTRACE ,"migrate %s under " DFID " to MDT%d\n" , name,PFID (ll_inode2fid (parent)), mdtidx); op_data = ll_prep_md_op_data(NULL, parent, NULL, name, namelen,
@@ -2884,8 +2884,13 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, dchild =d_lookup (file_dentry (file), &qstr);if (dchild && dchild->d_inode) { op_data->op_fid3 = *ll_inode2fid (dchild->d_inode); +if (dchild->d_inode) { + child_inode =igrab (dchild->d_inode); +ll_invalidate_aliases (child_inode); + } +dput (dchild); }else { - rc =ll_get_fid_by_name (parent, name,strnlen (name, namelen), + rc =ll_get_fid_by_name (parent, name, namelen, &op_data->op_fid3);if (rc) goto out_free;
@@ -2895,6 +2900,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,CERROR ("%s: migrate %s, but fid " DFID " is insane\n" ,ll_get_fsname (parent->i_sb,NULL ,0 ), name,PFID (&op_data->op_fid3)); + rc = -EINVAL ; goto out_free; }
@@ -2912,18 +2918,16 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, op_data->op_mds = mdtidx; op_data->op_cli_flags =CLI_MIGRATE ; rc =md_rename (ll_i2sbi (parent)->ll_md_exp, op_data, name, -strnlen (name, namelen), name,strnlen (name, namelen), - &request); + namelen, name, namelen, &request);if (!rc)ll_update_times (request, parent);ptlrpc_req_finished (request); out_free: -if (dchild) { -if (dchild->d_inode) -ll_delete_inode (dchild->d_inode); -dput (dchild); +if (child_inode) { +clear_nlink (child_inode); +iput (child_inode); }ll_finish_md_op_data (op_data);
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -0
@@ -721,6 +721,8 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);struct posix_acl *ll_get_acl (struct inode *inode,int type);int ll_migrate (struct inode *parent,struct file *file,int mdtidx,const char *name,int namelen); +int ll_get_fid_by_name (struct inode *parent,const char *name, +int namelen,struct lu_fid *fid);int ll_inode_permission (struct inode *inode,int mask); int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
drivers/staging/lustre/lustre/lov/lov_object.c +1 -0
@@ -224,6 +224,7 @@ static int lov_init_raid0(const struct lu_env *env,LASSERT (!lov->lo_lsm); lov->lo_lsm =lsm_addref (lsm); + lov->lo_layout_invalid = true; r0->lo_nr = lsm->lsm_stripe_count;LASSERT (r0->lo_nr <=lov_targets_nr (dev));
Signature · 1 line
1.7.1
PATCH 23/80 staging: lustre: mdc: fixup MDS_SWAP_LAYOUTS ELC handling
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
In mdc_ioc_swap_layouts() cancel *any* unused locks with LAYOUT or XATTR IBITS set on the two files. (This matches the locks acquired in mdt_swap_layouts(). Previously only locks that conflicted with a CR LAYOUT lock were cancelled.)
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4320
Reviewed-on: http://review.whamcloud.com/9329
--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_request.c +4 -2
@@ -1670,9 +1670,11 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp,* with the request RPC to avoid extra RPC round trips */ count =mdc_resource_get_unused (exp, &op_data->op_fid1, &cancels, -LCK_CR ,MDS_INODELOCK_LAYOUT ); +LCK_CR ,MDS_INODELOCK_LAYOUT | +MDS_INODELOCK_XATTR ); count +=mdc_resource_get_unused (exp, &op_data->op_fid2, &cancels, -LCK_CR ,MDS_INODELOCK_LAYOUT ); +LCK_CR ,MDS_INODELOCK_LAYOUT | +MDS_INODELOCK_XATTR ); req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_MDS_SWAP_LAYOUTS );
Signature · 1 line
1.7.1
PATCH 24/80 staging: lustre: don't need to const __u64 parameters for lustre_idl.h
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Remove the const for the __u64 parameters for inline functions in lustre_idl.h.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/8641
--- .../lustre/lustre/include/lustre/lustre_idl.h | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +10 -10
@@ -442,7 +442,7 @@ static inline int fid_seq_is_mdt0(__u64 seq)return (seq ==FID_SEQ_OST_MDT0 ); } -static inline int fid_seq_is_mdt (const __u64 seq) +static inline int fid_seq_is_mdt (__u64 seq) {return seq ==FID_SEQ_OST_MDT0 || seq >=FID_SEQ_NORMAL ; };
@@ -468,33 +468,33 @@ static inline int fid_is_llog(const struct lu_fid *fid)return fid_seq_is_llog (fid_seq (fid)) &&fid_oid (fid) >0 ; } -static inline int fid_seq_is_rsvd (const __u64 seq) +static inline int fid_seq_is_rsvd (__u64 seq) {return (seq >FID_SEQ_OST_MDT0 && seq <=FID_SEQ_RSVD ); }; -static inline int fid_seq_is_special (const __u64 seq) +static inline int fid_seq_is_special (__u64 seq) {return seq ==FID_SEQ_SPECIAL ; }; -static inline int fid_seq_is_local_file (const __u64 seq) +static inline int fid_seq_is_local_file (__u64 seq) {return seq ==FID_SEQ_LOCAL_FILE || seq ==FID_SEQ_LOCAL_NAME ; }; -static inline int fid_seq_is_root (const __u64 seq) +static inline int fid_seq_is_root (__u64 seq) {return seq ==FID_SEQ_ROOT ; } -static inline int fid_seq_is_dot (const __u64 seq) +static inline int fid_seq_is_dot (__u64 seq) {return seq ==FID_SEQ_DOT_LUSTRE ; } -static inline int fid_seq_is_default (const __u64 seq) +static inline int fid_seq_is_default (__u64 seq) {return seq ==FID_SEQ_LOV_DEFAULT ; }
@@ -516,7 +516,7 @@ static inline void lu_root_fid(struct lu_fid *fid)* \param fid the fid to be tested. * \return true if the fid is a igif; otherwise false. */ -static inline int fid_seq_is_igif (const __u64 seq) +static inline int fid_seq_is_igif (__u64 seq) {return seq >=FID_SEQ_IGIF && seq <=FID_SEQ_IGIF_MAX ; }
@@ -531,7 +531,7 @@ static inline int fid_is_igif(const struct lu_fid *fid)* \param fid the fid to be tested. * \return true if the fid is a idif; otherwise false. */ -static inline int fid_seq_is_idif (const __u64 seq) +static inline int fid_seq_is_idif (__u64 seq) {return seq >=FID_SEQ_IDIF && seq <=FID_SEQ_IDIF_MAX ; }
@@ -546,7 +546,7 @@ static inline int fid_is_local_file(const struct lu_fid *fid)return fid_seq_is_local_file (fid_seq (fid)); } -static inline int fid_seq_is_norm (const __u64 seq) +static inline int fid_seq_is_norm (__u64 seq) {return (seq >=FID_SEQ_NORMAL ); }
Signature · 1 line
1.7.1
PATCH 25/80 staging: lustre: const correct FID/OSTID/... helpers
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Add a const qualifier wherever possible to the pointer parameters of the inline helper functions in lustre_idl.h and lustre_fid.h.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/8641
--- .../lustre/lustre/include/lustre/lustre_idl.h | 28 ++++++++++---------- drivers/staging/lustre/lustre/include/lustre_fid.h | 9 +++--- 2 files changed, 19 insertions(+), 18 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +14 -14
@@ -1033,7 +1033,7 @@ static inline int lu_dirent_calc_size(int namelen, __u16 attr)return (size +7 ) & ~7 ; } -static inline int lu_dirent_size (struct lu_dirent *ent) +static inline int lu_dirent_size (const struct lu_dirent *ent) {if (le16_to_cpu (ent->lde_reclen) ==0 ) { return lu_dirent_calc_size(le16_to_cpu(ent->lde_namelen),
@@ -1067,7 +1067,7 @@ struct lustre_handle {#define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL -static inline int lustre_handle_is_used (struct lustre_handle *lh) +static inline int lustre_handle_is_used (const struct lustre_handle *lh) {return lh->cookie !=0ull ; }
@@ -1079,7 +1079,7 @@ static inline int lustre_handle_equal(const struct lustre_handle *lh1, }static inline void lustre_handle_copy (struct lustre_handle *tgt, -struct lustre_handle *src) +const struct lustre_handle *src) { tgt->cookie = src->cookie; }
@@ -1570,25 +1570,25 @@ static inline void lmm_oi_set_id(struct ost_id *oi, __u64 oid) oi->oi.oi_id = oid; } -static inline __u64 lmm_oi_id (struct ost_id *oi) +static inline __u64 lmm_oi_id (const struct ost_id *oi) {return oi->oi.oi_id; } -static inline __u64 lmm_oi_seq (struct ost_id *oi) +static inline __u64 lmm_oi_seq (const struct ost_id *oi) {return oi->oi.oi_seq; }static inline void lmm_oi_le_to_cpu (struct ost_id *dst_oi, -struct ost_id *src_oi) +const struct ost_id *src_oi) { dst_oi->oi.oi_id =le64_to_cpu (src_oi->oi.oi_id); dst_oi->oi.oi_seq =le64_to_cpu (src_oi->oi.oi_seq); }static inline void lmm_oi_cpu_to_le (struct ost_id *dst_oi, -struct ost_id *src_oi) +const struct ost_id *src_oi) { dst_oi->oi.oi_id =cpu_to_le64 (src_oi->oi.oi_id); dst_oi->oi.oi_seq =cpu_to_le64 (src_oi->oi.oi_seq);
@@ -2724,15 +2724,15 @@ struct ldlm_extent {#define LDLM_GID_ANY ((__u64)-1) -static inline int ldlm_extent_overlap (struct ldlm_extent *ex1, -struct ldlm_extent *ex2) +static inline int ldlm_extent_overlap (const struct ldlm_extent *ex1, +const struct ldlm_extent *ex2) {return (ex1->start <= ex2->end) && (ex2->start <= ex1->end); }/* check if @ex1 contains @ex2 */ -static inline int ldlm_extent_contain (struct ldlm_extent *ex1, -struct ldlm_extent *ex2) +static inline int ldlm_extent_contain (const struct ldlm_extent *ex1, +const struct ldlm_extent *ex2) {return (ex1->start <= ex2->start) && (ex1->end >= ex2->end); }
@@ -3092,7 +3092,7 @@ enum agent_req_status { ARS_SUCCEED, }; -static inline char *agent_req_status2name (enum agent_req_status ars) +static inline const char *agent_req_status2name (const enum agent_req_status ars) {switch (ars) {case ARS_WAITING :
@@ -3268,7 +3268,7 @@ struct obdo {#define o_cksum o_nlink#define o_grant_used o_data_version -static inline void lustre_set_wire_obdo (struct obd_connect_data *ocd, +static inline void lustre_set_wire_obdo (const struct obd_connect_data *ocd,struct obdo *wobdo,const struct obdo *lobdo) {
@@ -3287,7 +3287,7 @@ static inline void lustre_set_wire_obdo(struct obd_connect_data *ocd, } } -static inline void lustre_get_wire_obdo (struct obd_connect_data *ocd, +static inline void lustre_get_wire_obdo (const struct obd_connect_data *ocd,struct obdo *lobdo,const struct obdo *wobdo) {
drivers/staging/lustre/lustre/include/lustre_fid.h +5 -4
@@ -483,7 +483,7 @@ fid_build_pdo_res_name(const struct lu_fid *fid, unsigned int hash,* res will be built from normal FID directly, i.e. res[0] = f_seq, * res[1] = f_oid + f_ver. */ -static inline void ostid_build_res_name (struct ost_id *oi, +static inline void ostid_build_res_name (const struct ost_id *oi,struct ldlm_res_id *name) {memset (name,0 ,sizeof (*name));
@@ -498,8 +498,8 @@ static inline void ostid_build_res_name(struct ost_id *oi,/** * Return true if the resource is for the object identified by this id & group. */ -static inline int ostid_res_name_eq (struct ost_id *oi, -struct ldlm_res_id *name) +static inline int ostid_res_name_eq (const struct ost_id *oi, +const struct ldlm_res_id *name) {/* Note: it is just a trick here to save some effort, probably the * correct way would be turn them into the FID and compare
@@ -610,7 +610,8 @@ static inline __u32 fid_flatten32(const struct lu_fid *fid)return ino ? ino :fid_oid (fid); } -static inline int lu_fid_diff (struct lu_fid *fid1,struct lu_fid *fid2) +static inline int lu_fid_diff (const struct lu_fid *fid1, +const struct lu_fid *fid2) {LASSERTF (fid_seq (fid1) ==fid_seq (fid2),"fid1:" DFID ", fid2:" DFID "\n" ,PFID (fid1),PFID (fid2));
Signature · 1 line
1.7.1
PATCH 26/80 staging: lustre: use bool for several function in lustre_idl.h/lustre_fid.h
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Change the return type of several predicate functions from int to bool.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/8641
--- .../lustre/lustre/include/lustre/lustre_idl.h | 72 ++++++++++---------- drivers/staging/lustre/lustre/include/lustre_fid.h | 4 +- 2 files changed, 38 insertions(+), 38 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +36 -36
@@ -196,12 +196,12 @@ static inline unsigned fld_range_type(const struct lu_seq_range *range)return range->lsr_flags &LU_SEQ_RANGE_MASK ; } -static inline int fld_range_is_ost (const struct lu_seq_range *range) +static inline bool fld_range_is_ost (const struct lu_seq_range *range) {return fld_range_type (range) ==LU_SEQ_RANGE_OST ; } -static inline int fld_range_is_mdt (const struct lu_seq_range *range) +static inline bool fld_range_is_mdt (const struct lu_seq_range *range) {return fld_range_type (range) ==LU_SEQ_RANGE_MDT ; }
@@ -260,23 +260,23 @@ static inline void range_init(struct lu_seq_range *range)* check if given seq id \a s is within given range \a r */ -static inline int range_within (const struct lu_seq_range *range, -__u64 s) +static inline bool range_within (const struct lu_seq_range *range, +__u64 s) {return s >= range->lsr_start && s < range->lsr_end; } -static inline int range_is_sane (const struct lu_seq_range *range) +static inline bool range_is_sane (const struct lu_seq_range *range) {return (range->lsr_end >= range->lsr_start); } -static inline int range_is_zero (const struct lu_seq_range *range) +static inline bool range_is_zero (const struct lu_seq_range *range) {return (range->lsr_start ==0 && range->lsr_end ==0 ); } -static inline int range_is_exhausted (const struct lu_seq_range *range) +static inline bool range_is_exhausted (const struct lu_seq_range *range) {return range_space (range) ==0 ;
@@ -437,69 +437,69 @@ enum dot_lustre_oid { FID_OID_DOT_LUSTRE_OBF = 2UL, }; -static inline int fid_seq_is_mdt0 (__u64 seq) +static inline bool fid_seq_is_mdt0 (__u64 seq) {return (seq ==FID_SEQ_OST_MDT0 ); } -static inline int fid_seq_is_mdt (__u64 seq) +static inline bool fid_seq_is_mdt (__u64 seq) {return seq ==FID_SEQ_OST_MDT0 || seq >=FID_SEQ_NORMAL ; }; -static inline int fid_seq_is_echo (__u64 seq) +static inline bool fid_seq_is_echo (__u64 seq) {return (seq ==FID_SEQ_ECHO ); } -static inline int fid_is_echo (const struct lu_fid *fid) +static inline bool fid_is_echo (const struct lu_fid *fid) {return fid_seq_is_echo (fid_seq (fid)); } -static inline int fid_seq_is_llog (__u64 seq) +static inline bool fid_seq_is_llog (__u64 seq) {return (seq ==FID_SEQ_LLOG ); } -static inline int fid_is_llog (const struct lu_fid *fid) +static inline bool fid_is_llog (const struct lu_fid *fid) {/* file with OID == 0 is not llog but contains last oid */ return fid_seq_is_llog (fid_seq (fid)) &&fid_oid (fid) >0 ; } -static inline int fid_seq_is_rsvd (__u64 seq) +static inline bool fid_seq_is_rsvd (__u64 seq) {return (seq >FID_SEQ_OST_MDT0 && seq <=FID_SEQ_RSVD ); }; -static inline int fid_seq_is_special (__u64 seq) +static inline bool fid_seq_is_special (__u64 seq) {return seq ==FID_SEQ_SPECIAL ; }; -static inline int fid_seq_is_local_file (__u64 seq) +static inline bool fid_seq_is_local_file (__u64 seq) {return seq ==FID_SEQ_LOCAL_FILE || seq ==FID_SEQ_LOCAL_NAME ; }; -static inline int fid_seq_is_root (__u64 seq) +static inline bool fid_seq_is_root (__u64 seq) {return seq ==FID_SEQ_ROOT ; } -static inline int fid_seq_is_dot (__u64 seq) +static inline bool fid_seq_is_dot (__u64 seq) {return seq ==FID_SEQ_DOT_LUSTRE ; } -static inline int fid_seq_is_default (__u64 seq) +static inline bool fid_seq_is_default (__u64 seq) {return seq ==FID_SEQ_LOV_DEFAULT ; } -static inline int fid_is_mdt0 (const struct lu_fid *fid) +static inline bool fid_is_mdt0 (const struct lu_fid *fid) {return fid_seq_is_mdt0 (fid_seq (fid)); }
@@ -516,12 +516,12 @@ static inline void lu_root_fid(struct lu_fid *fid)* \param fid the fid to be tested. * \return true if the fid is a igif; otherwise false. */ -static inline int fid_seq_is_igif (__u64 seq) +static inline bool fid_seq_is_igif (__u64 seq) {return seq >=FID_SEQ_IGIF && seq <=FID_SEQ_IGIF_MAX ; } -static inline int fid_is_igif (const struct lu_fid *fid) +static inline bool fid_is_igif (const struct lu_fid *fid) {return fid_seq_is_igif (fid_seq (fid)); }
@@ -531,27 +531,27 @@ static inline int fid_is_igif(const struct lu_fid *fid)* \param fid the fid to be tested. * \return true if the fid is a idif; otherwise false. */ -static inline int fid_seq_is_idif (__u64 seq) +static inline bool fid_seq_is_idif (__u64 seq) {return seq >=FID_SEQ_IDIF && seq <=FID_SEQ_IDIF_MAX ; } -static inline int fid_is_idif (const struct lu_fid *fid) +static inline bool fid_is_idif (const struct lu_fid *fid) {return fid_seq_is_idif (fid_seq (fid)); } -static inline int fid_is_local_file (const struct lu_fid *fid) +static inline bool fid_is_local_file (const struct lu_fid *fid) {return fid_seq_is_local_file (fid_seq (fid)); } -static inline int fid_seq_is_norm (__u64 seq) +static inline bool fid_seq_is_norm (__u64 seq) {return (seq >=FID_SEQ_NORMAL ); } -static inline int fid_is_norm (const struct lu_fid *fid) +static inline bool fid_is_norm (const struct lu_fid *fid) {return fid_seq_is_norm (fid_seq (fid)); }
@@ -769,7 +769,7 @@ static inline int fid_to_ostid(const struct lu_fid *fid, struct ost_id *ostid) }/* Check whether the fid is for LAST_ID */ -static inline int fid_is_last_id (const struct lu_fid *fid) +static inline bool fid_is_last_id (const struct lu_fid *fid) {return (fid_oid (fid) ==0 ); }
@@ -838,7 +838,7 @@ static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src) dst->f_ver =be32_to_cpu (fid_ver (src)); } -static inline int fid_is_sane (const struct lu_fid *fid) +static inline bool fid_is_sane (const struct lu_fid *fid) { return fid && ((fid_seq(fid) >= FID_SEQ_START && fid_ver(fid) == 0) ||
@@ -846,7 +846,7 @@ static inline int fid_is_sane(const struct lu_fid *fid) fid_seq_is_rsvd(fid_seq(fid))); } -static inline int fid_is_zero (const struct lu_fid *fid) +static inline bool fid_is_zero (const struct lu_fid *fid) {return fid_seq (fid) ==0 &&fid_oid (fid) ==0 ; }
@@ -854,7 +854,7 @@ static inline int fid_is_zero(const struct lu_fid *fid)void lustre_swab_lu_fid (struct lu_fid *fid);void lustre_swab_lu_seq_range (struct lu_seq_range *range); -static inline int lu_fid_eq (const struct lu_fid *f0,const struct lu_fid *f1) +static inline bool lu_fid_eq (const struct lu_fid *f0,const struct lu_fid *f1) {return memcmp (f0, f1,sizeof (*f0)) ==0 ; }
@@ -1067,13 +1067,13 @@ struct lustre_handle {#define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL -static inline int lustre_handle_is_used (const struct lustre_handle *lh) +static inline bool lustre_handle_is_used (const struct lustre_handle *lh) {return lh->cookie !=0ull ; } -static inline int lustre_handle_equal (const struct lustre_handle *lh1, -const struct lustre_handle *lh2) +static inline bool lustre_handle_equal (const struct lustre_handle *lh1, +const struct lustre_handle *lh2) {return lh1->cookie == lh2->cookie; }
@@ -2684,8 +2684,8 @@ struct ldlm_res_id {#define PLDLMRES (res) (res)->lr_name.name[0], (res)->lr_name.name[1], \ (res)->lr_name.name[2], (res)->lr_name.name[3] -static inline int ldlm_res_eq (const struct ldlm_res_id *res0, -const struct ldlm_res_id *res1) +static inline bool ldlm_res_eq (const struct ldlm_res_id *res0, +const struct ldlm_res_id *res1) {return !memcmp (res0, res1,sizeof (*res0)); }
drivers/staging/lustre/lustre/include/lustre_fid.h +2 -2
@@ -406,8 +406,8 @@ fid_build_reg_res_name(const struct lu_fid *fid, struct ldlm_res_id *res)/* * Return true if resource is for object identified by FID. */ -static inline int fid_res_name_eq (const struct lu_fid *fid, -const struct ldlm_res_id *res) +static inline bool fid_res_name_eq (const struct lu_fid *fid, +const struct ldlm_res_id *res) {return res->name[LUSTRE_RES_ID_SEQ_OFF ] ==fid_seq (fid) && res->name[LUSTRE_RES_ID_VER_OID_OFF ] ==fid_ver_oid (fid);
Signature · 1 line
1.7.1
PATCH 27/80 staging: lustre: simplify inline functions in lustre_fid.h
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Several inline functions return a structure that was passed in. Their is no need for this so just make these function void.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/8641
--- drivers/staging/lustre/lustre/include/lustre_fid.h | 16 ++++------------ 1 files changed, 4 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/include/lustre_fid.h +4 -12
@@ -393,14 +393,12 @@ struct ldlm_namespace;* but was moved into name[1] along with the OID to avoid consuming the * renaming name[2,3] fields that need to be used for the quota identifier. */ -static inline struct ldlm_res_id * +static inline void fid_build_reg_res_name (const struct lu_fid *fid,struct ldlm_res_id *res) {memset (res,0 ,sizeof (*res)); res->name[LUSTRE_RES_ID_SEQ_OFF ] =fid_seq (fid); res->name[LUSTRE_RES_ID_VER_OID_OFF ] =fid_ver_oid (fid); - -return res; }/*
@@ -416,29 +414,25 @@ static inline bool fid_res_name_eq(const struct lu_fid *fid,/* * Extract FID from LDLM resource. Reverse of fid_build_reg_res_name(). */ -static inline struct lu_fid * +static inline void fid_extract_from_res_name (struct lu_fid *fid,const struct ldlm_res_id *res) { fid->f_seq = res->name[LUSTRE_RES_ID_SEQ_OFF ]; fid->f_oid = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF ]); fid->f_ver = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF ] >>32 );LASSERT (fid_res_name_eq (fid, res)); - -return fid; }/* * Build (DLM) resource identifier from global quota FID and quota ID. */ -static inline struct ldlm_res_id * +static inline void fid_build_quota_res_name (const struct lu_fid *glb_fid,union lquota_id *qid,struct ldlm_res_id *res) {fid_build_reg_res_name (glb_fid, res); res->name[LUSTRE_RES_ID_QUOTA_SEQ_OFF ] =fid_seq (&qid->qid_fid); res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF ] =fid_ver_oid (&qid->qid_fid); - -return res; }/*
@@ -455,14 +449,12 @@ static inline void fid_extract_from_quota_res(struct lu_fid *glb_fid, (__u32)(res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF ] >>32 ); } -static inline struct ldlm_res_id * +static inline void fid_build_pdo_res_name (const struct lu_fid *fid,unsigned int hash,struct ldlm_res_id *res) {fid_build_reg_res_name (fid, res); res->name[LUSTRE_RES_ID_HSH_OFF ] = hash; - -return res; }/**
Signature · 1 line
1.7.1
PATCH 28/80 staging: lustre: lmv: access lum_stripe_offset as little endian
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
By the time that a struct lmv_user_md reaches lmv_placement_policy() it has already been converted to little endian. Therefore use the appropriate macros around accesses to this this field. This issue was found by rewriting the definition of struct lmv_user_md to use the __leXX typedefs and running sparse.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4738
Reviewed-on: http://review.whamcloud.com/9671
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +3 -3
@@ -1242,15 +1242,15 @@ static int lmv_placement_policy(struct obd_device *obd,struct lmv_user_md *lum; lum = op_data->op_data; -if (lum->lum_stripe_offset != (__u32)-1 ) { - *mds = lum->lum_stripe_offset; +if (le32_to_cpu (lum->lum_stripe_offset) != (__u32)-1 ) { + *mds =le32_to_cpu (lum->lum_stripe_offset); }else {/* * -1 means default, which will be in the same MDT with * the stripe */ *mds = op_data->op_mds; - lum->lum_stripe_offset = op_data->op_mds; + lum->lum_stripe_offset =cpu_to_le32 (op_data->op_mds); } }else {/*
Signature · 1 line
1.7.1
PATCH 29/80 staging: lustre: lmv: lookup remote migrating object in LMV
In reply to James SimmonsFrom: wang di <[email protected]>
If remote object is being found in a migrating directory, it should continue to lookup the object in remote MDT, instead of return.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4805
Reviewed-on: http://review.whamcloud.com/9806
--- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_intent.c +0 -1
@@ -471,7 +471,6 @@ static int lmv_intent_lookup(struct obd_export *exp, it->it_disposition &= ~DISP_ENQ_COMPLETE ; rc =md_intent_lock (tgt->ltd_exp, op_data, lmm, lmmsize, it, flags, reqp, cb_blocking, extra_lock_flags); -return rc; }/*
Signature · 1 line
1.7.1
PATCH 30/80 staging: lustre: lmv: Ensure lmv_intent_lookup cleans up reqp
In reply to James SimmonsFrom: Nathaniel Clark <[email protected]>
Ensure there aren't invalid pointers hanging around after ptlrpc_req_finished is called.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4826
Reviewed-on: http://review.whamcloud.com/9841
--- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_intent.c +3 -0
@@ -464,6 +464,9 @@ static int lmv_intent_lookup(struct obd_export *exp,return PTR_ERR (tgt);ptlrpc_req_finished (*reqp); + it->it_request =NULL ; + *reqp =NULL ; +CDEBUG (D_INODE ,"For migrating dir, try target dir " DFID "\n" ,PFID (&lsm->lsm_md_oinfo[1 ].lmo_fid));
Signature · 1 line
1.7.1
PATCH 31/80 staging: lustre: llite: avoid a deadlock in page write
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
For a partial page write, it will have to issue a READ RPC firstly to get a full uptodate page. If another page is already locked by this thread it can easily cause deadlock.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4873
Reviewed-on: http://review.whamcloud.com/9928
--- drivers/staging/lustre/lustre/llite/rw26.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/rw26.c +3 -2
@@ -506,8 +506,9 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, env = lcc->lcc_env; io = lcc->lcc_io; -/* To avoid deadlock, try to lock page first. */ - vmpage =grab_cache_page_nowait (mapping, index); +if (likely (to ==PAGE_SIZE ))/* LU-4873 */ +/* To avoid deadlock, try to lock page first. */ + vmpage =grab_cache_page_nowait (mapping, index);if (unlikely (!vmpage ||PageDirty (vmpage) ||PageWriteback (vmpage))) {struct vvp_io *vio =vvp_env_io (env);struct cl_page_list *plist = &vio->u.write.vui_queue;
Signature · 1 line
1.7.1
PATCH 32/80 staging: lustre: lov: handle the case of stripe size is not power 2
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
Calculate the end of current stripe correctly when the stripe size is not power 2.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4860
Reviewed-on: http://review.whamcloud.com/9882
--- drivers/staging/lustre/lustre/lov/lov_page.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/lov/lov_page.c +9 -2
@@ -65,7 +65,9 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env,pgoff_t index = *max_index;unsigned int pps;/* pages per stripe */ -CDEBUG (D_READA ,"*max_index = %lu, nr = %d\n" , index, r0->lo_nr); +CDEBUG (D_READA ,DFID "*max_index = %lu, nr = %d\n" , +PFID (lu_object_fid (lov2lu (loo))), index, r0->lo_nr); +if (index ==0 )/* the page is not covered by any lock */ return 0 ;
@@ -80,7 +82,12 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env,/* calculate the end of current stripe */ pps = loo->lo_lsm->lsm_stripe_size >>PAGE_SHIFT ; - index = ((slice->cpl_index + pps) & ~(pps -1 )) -1 ; + index = slice->cpl_index + pps - slice->cpl_index % pps -1 ; + +CDEBUG (D_READA ,DFID "*max_index = %lu, index = %lu, pps = %u, stripe_size = %u, stripe no = %u, page index = %lu\n" , +PFID (lu_object_fid (lov2lu (loo))), *max_index, index, pps, + loo->lo_lsm->lsm_stripe_size,lov_page_stripe (slice->cpl_page), + slice->cpl_index);/* never exceed the end of the stripe */ *max_index =min_t (pgoff_t, *max_index, index);
Signature · 1 line
1.7.1
PATCH 33/80 staging: lustre: lmv: cleanup req in lmv_getattr_name()
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
In lmv_getattr_name() don't return a freed request in the error path.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4826
Reviewed-on: http://review.whamcloud.com/9863
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -0
@@ -1920,6 +1920,7 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data, tgt =lmv_find_target (lmv, &rid);if (IS_ERR (tgt)) {ptlrpc_req_finished (*request); + *request =NULL ;return PTR_ERR (tgt); }
Signature · 1 line
1.7.1
PATCH 34/80 staging: lustre: lmv: rename request to preq in lmv_getattr_name()
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Rename request to preq.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4826
Reviewed-on: http://review.whamcloud.com/9863
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +7 -9
@@ -1883,7 +1883,7 @@ lmv_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,static int lmv_getattr_name (struct obd_export *exp,struct md_op_data *op_data, -struct ptlrpc_request **request) +struct ptlrpc_request **preq) {struct ptlrpc_request *req =NULL ;struct obd_device *obd = exp->exp_obd;
@@ -1904,13 +1904,11 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data, op_data->op_namelen, op_data->op_name,PFID (&op_data->op_fid1), tgt->ltd_idx); - rc =md_getattr_name (tgt->ltd_exp, op_data, request); + rc =md_getattr_name (tgt->ltd_exp, op_data, preq);if (rc !=0 )return rc; - body =req_capsule_server_get (&(*request)->rq_pill, - &RMF_MDT_BODY ); - + body =req_capsule_server_get (&(*preq)->rq_pill, &RMF_MDT_BODY );if (body->valid &OBD_MD_MDS ) {struct lu_fid rid = body->fid1;
@@ -1919,8 +1917,8 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data, tgt =lmv_find_target (lmv, &rid);if (IS_ERR (tgt)) { -ptlrpc_req_finished (*request); - *request =NULL ; +ptlrpc_req_finished (*preq); + *preq =NULL ;return PTR_ERR (tgt); }
@@ -1929,8 +1927,8 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data, op_data->op_namelen =0 ; op_data->op_name =NULL ; rc =md_getattr_name (tgt->ltd_exp, op_data, &req); -ptlrpc_req_finished (*request); - *request = req; +ptlrpc_req_finished (*preq); + *preq = req; }return rc;
Signature · 1 line
1.7.1
PATCH 35/80 staging: lustre: obdclass: unified flow control interfaces
In reply to James SimmonsFrom: Fan Yong <[email protected]>
Unify the flow control interfaces for MDC RPC and FLD RPC. We allow to adjust the maximum inflight RPCs count via /sys interface.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4687
Reviewed-on: http://review.whamcloud.com/9562
--- drivers/staging/lustre/lustre/fld/fld_request.c | 55 +-------- drivers/staging/lustre/lustre/include/lustre_mdc.h | 5 - drivers/staging/lustre/lustre/include/obd.h | 14 +-- drivers/staging/lustre/lustre/include/obd_class.h | 5 + drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 4 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 17 +-- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 - drivers/staging/lustre/lustre/mdc/mdc_lib.c | 64 ---------- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 10 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 6 +- drivers/staging/lustre/lustre/obdclass/genops.c | 132 ++++++++++++++++++++ 11 files changed, 161 insertions(+), 153 deletions(-)
drivers/staging/lustre/lustre/fld/fld_request.c +2 -53
@@ -53,57 +53,6 @@#include "../include/lustre_mdc.h" #include "fld_internal.h" -/* TODO: these 3 functions are copies of flow-control code from mdc_lib.c -* It should be common thing. The same about mdc RPC lock -*/ -static int fld_req_avail (struct client_obd *cli,struct mdc_cache_waiter *mcw) -{ -int rc; - -spin_lock (&cli->cl_loi_list_lock); - rc =list_empty (&mcw->mcw_entry); -spin_unlock (&cli->cl_loi_list_lock); -return rc; -}; - -static void fld_enter_request (struct client_obd *cli) -{ -struct mdc_cache_waiter mcw; -struct l_wait_info lwi = {0 }; - -spin_lock (&cli->cl_loi_list_lock); -if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) { -list_add_tail (&mcw.mcw_entry, &cli->cl_cache_waiters); -init_waitqueue_head (&mcw.mcw_waitq); -spin_unlock (&cli->cl_loi_list_lock); -l_wait_event (mcw.mcw_waitq,fld_req_avail (cli, &mcw), &lwi); - }else { - cli->cl_r_in_flight++; -spin_unlock (&cli->cl_loi_list_lock); - } -} - -static void fld_exit_request (struct client_obd *cli) -{ -struct list_head *l, *tmp; -struct mdc_cache_waiter *mcw; - -spin_lock (&cli->cl_loi_list_lock); - cli->cl_r_in_flight--; -list_for_each_safe (l, tmp, &cli->cl_cache_waiters) { -if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) { -/* No free request slots anymore */ -break ; - } - - mcw = list_entry(l, struct mdc_cache_waiter, mcw_entry); -list_del_init (&mcw->mcw_entry); - cli->cl_r_in_flight++; -wake_up (&mcw->mcw_waitq); - } -spin_unlock (&cli->cl_loi_list_lock); -} -static int fld_rrb_hash (struct lu_client_fld *fld,u64 seq) {LASSERT (fld->lcf_count >0 );
@@ -439,9 +388,9 @@ int fld_client_rpc(struct obd_export *exp, req->rq_reply_portal =MDC_REPLY_PORTAL ;ptlrpc_at_set_req_timeout (req); -fld_enter_request (&exp->exp_obd->u.cli); +obd_get_request_slot (&exp->exp_obd->u.cli); rc =ptlrpc_queue_wait (req); -fld_exit_request (&exp->exp_obd->u.cli); +obd_put_request_slot (&exp->exp_obd->u.cli);if (rc) goto out_req;
drivers/staging/lustre/lustre/include/lustre_mdc.h +0 -5
@@ -179,11 +179,6 @@ static inline void mdc_update_max_ea_from_body(struct obd_export *exp, } } -struct mdc_cache_waiter { -struct list_head mcw_entry; -wait_queue_head_t mcw_waitq; -}; -/* mdc/mdc_locks.c */ int it_open_error (int phase,struct lookup_intent *it);
drivers/staging/lustre/lustre/include/obd.h +6 -8
@@ -211,11 +211,12 @@ struct timeout_item {struct list_head ti_chain; }; -#define OSC_MAX_RIF_DEFAULT 8 -#define OSC_MAX_RIF_MAX 256 -#define OSC_MAX_DIRTY_DEFAULT (OSC_MAX_RIF_DEFAULT * 4) -#define OSC_MAX_DIRTY_MB_MAX 2048/* arbitrary, but < MAX_LONG bytes */ -#define OSC_DEFAULT_RESENDS 10 +#define OBD_MAX_RIF_DEFAULT 8 +#define OBD_MAX_RIF_MAX 512 +#define OSC_MAX_RIF_MAX 256 +#define OSC_MAX_DIRTY_DEFAULT (OBD_MAX_RIF_DEFAULT * 4) +#define OSC_MAX_DIRTY_MB_MAX 2048/* arbitrary, but < MAX_LONG bytes */ +#define OSC_DEFAULT_RESENDS 10/* possible values for fo_sync_lock_cancel */ enum {
@@ -225,9 +226,6 @@ enum {NUM_SYNC_ON_CANCEL_STATES }; -#define MDC_MAX_RIF_DEFAULT 8 -#define MDC_MAX_RIF_MAX 512 -enum obd_cl_sem_lock_class {OBD_CLI_SEM_NORMAL ,OBD_CLI_SEM_MGC ,
drivers/staging/lustre/lustre/include/obd_class.h +5 -0
@@ -97,6 +97,11 @@ int obd_zombie_impexp_init(void);void obd_zombie_impexp_stop (void );void obd_zombie_barrier (void ); +int obd_get_request_slot (struct client_obd *cli); +void obd_put_request_slot (struct client_obd *cli); +__u32 obd_get_max_rpcs_in_flight (struct client_obd *cli); +int obd_set_max_rpcs_in_flight (struct client_obd *cli,__u32 max); +struct llog_handle ;struct llog_rec_hdr ; typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *,
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +2 -2
@@ -360,7 +360,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) cli->cl_chunkbits =PAGE_SHIFT ;if (!strcmp (name,LUSTRE_MDC_NAME )) { - cli->cl_max_rpcs_in_flight =MDC_MAX_RIF_DEFAULT ; + cli->cl_max_rpcs_in_flight =OBD_MAX_RIF_DEFAULT ; }else if (totalram_pages >> (20 -PAGE_SHIFT ) <=128 /* MB */ ) { cli->cl_max_rpcs_in_flight =2 ; }else if (totalram_pages >> (20 -PAGE_SHIFT ) <=256 /* MB */ ) {
@@ -368,7 +368,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) }else if (totalram_pages >> (20 -PAGE_SHIFT ) <=512 /* MB */ ) { cli->cl_max_rpcs_in_flight =4 ; }else { - cli->cl_max_rpcs_in_flight =OSC_MAX_RIF_DEFAULT ; + cli->cl_max_rpcs_in_flight =OBD_MAX_RIF_DEFAULT ; } rc =ldlm_get_ref ();if (rc) {
drivers/staging/lustre/lustre/mdc/lproc_mdc.c +6 -11
@@ -43,11 +43,10 @@ static ssize_t max_rpcs_in_flight_show(struct kobject *kobj,int len; struct obd_device *dev = container_of(kobj, struct obd_device, obd_kobj); -struct client_obd *cli = &dev->u.cli; +__u32 max; -spin_lock (&cli->cl_loi_list_lock); - len =sprintf (buf,"%u\n" , cli->cl_max_rpcs_in_flight); -spin_unlock (&cli->cl_loi_list_lock); + max =obd_get_max_rpcs_in_flight (&dev->u.cli); + len =sprintf (buf,"%u\n" , max);return len; }
@@ -59,7 +58,6 @@ static ssize_t max_rpcs_in_flight_store(struct kobject *kobj, { struct obd_device *dev = container_of(kobj, struct obd_device, obd_kobj); -struct client_obd *cli = &dev->u.cli;int rc;unsigned long val;
@@ -67,12 +65,9 @@ static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,if (rc)return rc; -if (val <1 || val >MDC_MAX_RIF_MAX ) -return -ERANGE ; - -spin_lock (&cli->cl_loi_list_lock); - cli->cl_max_rpcs_in_flight = val; -spin_unlock (&cli->cl_loi_list_lock); + rc =obd_set_max_rpcs_in_flight (&dev->u.cli, val); +if (rc) + count = rc;return count; }
drivers/staging/lustre/lustre/mdc/mdc_internal.h +0 -2
@@ -61,8 +61,6 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data);void mdc_rename_pack (struct ptlrpc_request *req,struct md_op_data *op_data,const char *old,int oldlen,const char *new,int newlen);void mdc_close_pack (struct ptlrpc_request *req,struct md_op_data *op_data); -int mdc_enter_request (struct client_obd *cli); -void mdc_exit_request (struct client_obd *cli);/* mdc/mdc_locks.c */ int mdc_set_lock_data(struct obd_export *exp,
drivers/staging/lustre/lustre/mdc/mdc_lib.c +0 -64
67 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_locks.c +5 -5
@@ -809,7 +809,7 @@ resend:*/ if (it) {mdc_get_rpc_lock (obddev->u.cli.cl_rpc_lock, it); - rc =mdc_enter_request (&obddev->u.cli); + rc =obd_get_request_slot (&obddev->u.cli);if (rc !=0 ) {mdc_put_rpc_lock (obddev->u.cli.cl_rpc_lock, it);mdc_clear_replay_flag (req,0 );
@@ -837,7 +837,7 @@ resend:return rc; } -mdc_exit_request (&obddev->u.cli); +obd_put_request_slot (&obddev->u.cli);mdc_put_rpc_lock (obddev->u.cli.cl_rpc_lock, it);if (rc <0 ) {
@@ -1179,7 +1179,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, obddev =class_exp2obd (exp); -mdc_exit_request (&obddev->u.cli); +obd_put_request_slot (&obddev->u.cli);if (OBD_FAIL_CHECK (OBD_FAIL_MDC_GETATTR_ENQUEUE )) rc = -ETIMEDOUT ;
@@ -1239,7 +1239,7 @@ int mdc_intent_getattr_async(struct obd_export *exp,if (IS_ERR (req))return PTR_ERR (req); - rc =mdc_enter_request (&obddev->u.cli); + rc =obd_get_request_slot (&obddev->u.cli);if (rc !=0 ) {ptlrpc_req_finished (req);return rc;
@@ -1248,7 +1248,7 @@ int mdc_intent_getattr_async(struct obd_export *exp, rc =ldlm_cli_enqueue (exp, &req, einfo, &res_id, &policy, &flags,NULL ,0 ,LVB_T_NONE , &minfo->mi_lockh,1 );if (rc <0 ) { -mdc_exit_request (&obddev->u.cli); +obd_put_request_slot (&obddev->u.cli);ptlrpc_req_finished (req);return rc; }
drivers/staging/lustre/lustre/mdc/mdc_request.c +3 -3
@@ -58,16 +58,16 @@ static inline int mdc_queue_wait(struct ptlrpc_request *req)struct client_obd *cli = &req->rq_import->imp_obd->u.cli;int rc; -/* mdc_enter_request() ensures that this client has no more +/* obd_get_request_slot() ensures that this client has no more * than cl_max_rpcs_in_flight RPCs simultaneously inf light * against an MDT. */ - rc =mdc_enter_request (cli); + rc =obd_get_request_slot (cli);if (rc !=0 )return rc; rc =ptlrpc_queue_wait (req); -mdc_exit_request (cli); +obd_put_request_slot (cli);return rc; }
drivers/staging/lustre/lustre/obdclass/genops.c +132 -0
135 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 36/80 staging: lustre: reorder LOV_MAGIC_* definition
In reply to James SimmonsFrom: Fan Yong <[email protected]>
Since all the LOV_MAGIC_* definitions have the same postfix values break that value out into its own definition. With this we can check whether the magic's postfix match the LOV_MAGIC_MAGIC or not: if yes, then it is quite possible that the clients has encountered an newer LOV magic. This extra information can let us handle those cases more gracefully.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4941
Reviewed-on: http://review.whamcloud.com/10045
--- .../lustre/lustre/include/lustre/lustre_idl.h | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +15 -5
@@ -1478,11 +1478,21 @@ enum obdo_flags { OBD_FL_LOCAL_MASK = 0xF0000000, }; -#define LOV_MAGIC_V1 0x0BD10BD0 -#define LOV_MAGIC LOV_MAGIC_V1 -#define LOV_MAGIC_JOIN_V1 0x0BD20BD0 -#define LOV_MAGIC_V3 0x0BD30BD0 -#define LOV_MAGIC_MIGRATE 0x0BD40BD0 +/* +* All LOV EA magics should have the same postfix, if some new version +* Lustre instroduces new LOV EA magic, then when down-grade to an old +* Lustre, even though the old version system does not recognizes such +* new magic, it still can distinguish the corrupted cases by checking +* the magic's postfix. +*/ +#define LOV_MAGIC_MAGIC 0x0BD0 +#define LOV_MAGIC_MASK 0xFFFF + +#define LOV_MAGIC_V1 (0x0BD10000 | LOV_MAGIC_MAGIC) +#define LOV_MAGIC_JOIN_V1 (0x0BD20000 | LOV_MAGIC_MAGIC) +#define LOV_MAGIC_V3 (0x0BD30000 | LOV_MAGIC_MAGIC) +#define LOV_MAGIC_MIGRATE (0x0BD40000 | LOV_MAGIC_MAGIC) +#define LOV_MAGIC LOV_MAGIC_V1/* * magic for fully defined striping
Signature · 1 line
1.7.1
PATCH 37/80 staging: lustre: ldlm: flock completion fixes.
In reply to James SimmonsFrom: Vitaly Fertman <[email protected]>
Move checks for FAILED, DESTROYED flags under ldlm spinlock, destroy flock atomically with the check it is not destroyed yet. Do not put the granted flock into the resource if this is UNLOCK, TEST, or DEADLOCK'ed flock.
Later a regression for this patch was reported under LU-7626. The refcount nonzero (1) after lock cleanup errors was reported. The reason is that the case LCK_NL was not handled for obdecho. Patch 17791 resolved this issue which has been combined into this upstream patch.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2177
Xyratex-bug-id: MRP-1588
Reviewed-on: http://review.whamcloud.com/10005
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7626
Reviewed-on: http://review.whamcloud.com/17791
--- .../lustre/include/linux/libcfs/libcfs_fail.h | 3 + drivers/staging/lustre/lnet/libcfs/fail.c | 6 +- .../lustre/lustre/include/lustre_dlm_flags.h | 36 ++++--- .../staging/lustre/lustre/include/obd_support.h | 4 + drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 98 ++++++++++++++------ drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 23 ++++- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 16 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 8 ++- drivers/staging/lustre/lustre/llite/file.c | 20 +++-- 9 files changed, 148 insertions(+), 66 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +3 -0
@@ -143,6 +143,9 @@ static inline int cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)#define CFS_FAIL_TIMEOUT_ORSET (id, value, secs) \ cfs_fail_timeout_set(id, value, secs * 1000, CFS_FAIL_LOC_ORSET) +#define CFS_FAIL_TIMEOUT_RESET (id, value, secs) \ + cfs_fail_timeout_set(id, value, secs * 1000, CFS_FAIL_LOC_RESET) +#define CFS_FAIL_TIMEOUT_MS_ORSET (id, value, ms) \ cfs_fail_timeout_set(id, value, ms, CFS_FAIL_LOC_ORSET)
drivers/staging/lustre/lnet/libcfs/fail.c +4 -2
@@ -90,8 +90,10 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set) } } -if ((set ==CFS_FAIL_LOC_ORSET || set ==CFS_FAIL_LOC_RESET ) && - (value &CFS_FAIL_ONCE )) +/* Take into account the current call for FAIL_ONCE for ORSET only, +* as RESET is a new fail_loc, it does not change the current call +*/ +if ((set ==CFS_FAIL_LOC_ORSET ) && (value &CFS_FAIL_ONCE ))set_bit (CFS_FAIL_ONCE_BIT , &cfs_fail_loc);/* Lost race to set CFS_FAILED_BIT. */ if (test_and_set_bit (CFS_FAILED_BIT , &cfs_fail_loc)) {
drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +21 -15
@@ -28,21 +28,6 @@/** l_flags bits marked as "all_flags" bits */ #define LDLM_FL_ALL_FLAGS_MASK 0x00FFFFFFC08F932FULL -/** l_flags bits marked as "ast" bits */ -#define LDLM_FL_AST_MASK 0x0000000080008000ULL - -/** l_flags bits marked as "blocked" bits */ -#define LDLM_FL_BLOCKED_MASK 0x000000000000000EULL - -/** l_flags bits marked as "gone" bits */ -#define LDLM_FL_GONE_MASK 0x0006004000000000ULL - -/** l_flags bits marked as "inherit" bits */ -#define LDLM_FL_INHERIT_MASK 0x0000000000800000ULL - -/** l_flags bits marked as "off_wire" bits */ -#define LDLM_FL_OFF_WIRE_MASK 0x00FFFFFF00000000ULL -/** extent, mode, or resource changed */ #define LDLM_FL_LOCK_CHANGED 0x0000000000000001ULL/* bit 0 */ #define ldlm_is_lock_changed (_l) LDLM_TEST_FLAG((_l), 1ULL << 0)
@@ -372,6 +357,27 @@#define ldlm_set_excl (_l) LDLM_SET_FLAG((_l), 1ULL << 55)#define ldlm_clear_excl (_l) LDLM_CLEAR_FLAG((_l), 1ULL << 55) +/** l_flags bits marked as "ast" bits */ +#define LDLM_FL_AST_MASK (LDLM_FL_FLOCK_DEADLOCK |\ + LDLM_FL_AST_DISCARD_DATA) + +/** l_flags bits marked as "blocked" bits */ +#define LDLM_FL_BLOCKED_MASK (LDLM_FL_BLOCK_GRANTED |\ + LDLM_FL_BLOCK_CONV |\ + LDLM_FL_BLOCK_WAIT) + +/** l_flags bits marked as "gone" bits */ +#define LDLM_FL_GONE_MASK (LDLM_FL_DESTROYED |\ + LDLM_FL_FAILED) + +/** l_flags bits marked as "inherit" bits */ +/* Flags inherited from wire on enqueue/reply between client/server. */ +/* NO_TIMEOUT flag to force ldlm_lock_match() to wait with no timeout. */ +/* TEST_LOCK flag to not let TEST lock to be granted. */ +#define LDLM_FL_INHERIT_MASK (LDLM_FL_CANCEL_ON_BLOCK |\ + LDLM_FL_NO_TIMEOUT |\ + LDLM_FL_TEST_LOCK) +/** test for ldlm_lock flag bit set */ #define LDLM_TEST_FLAG (_l, _b) (((_l)->l_flags & (_b)) != 0)
drivers/staging/lustre/lustre/include/obd_support.h +4 -0
@@ -318,6 +318,10 @@ extern char obd_jobid_var[];#define OBD_FAIL_LDLM_AGL_NOLOCK 0x31b#define OBD_FAIL_LDLM_OST_LVB 0x31c#define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d +#define OBD_FAIL_LDLM_CP_CB_WAIT2 0x320 +#define OBD_FAIL_LDLM_CP_CB_WAIT3 0x321 +#define OBD_FAIL_LDLM_CP_CB_WAIT4 0x322 +#define OBD_FAIL_LDLM_CP_CB_WAIT5 0x323/* LOCKLESS IO */ #define OBD_FAIL_LDLM_SET_CONTENTION 0x385
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +70 -28
136 lines not on this page · raw message
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +19 -4
@@ -1028,15 +1028,28 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list)check_res_locked (res); lock->l_granted_mode = lock->l_req_mode; + +if (work_list && lock->l_completion_ast) +ldlm_add_ast_work_item (lock,NULL , work_list); +if (res->lr_type ==LDLM_PLAIN || res->lr_type ==LDLM_IBITS )ldlm_grant_lock_with_skiplist (lock);else if (res->lr_type ==LDLM_EXTENT )ldlm_extent_add_lock (res, lock); -else +else if (res->lr_type ==LDLM_FLOCK ) { +/* +* We should not add locks to granted list in the following cases: +* - this is an UNLOCK but not a real lock; +* - this is a TEST lock; +* - this is a F_CANCELLK lock (async flock has req_mode == 0) +* - this is a deadlock (flock cannot be granted) +*/ +if (!lock->l_req_mode || lock->l_req_mode ==LCK_NL || +ldlm_is_test_lock (lock) ||ldlm_is_flock_deadlock (lock)) +return ;ldlm_resource_add_lock (res, &res->lr_granted, lock); - -if (work_list && lock->l_completion_ast) -ldlm_add_ast_work_item (lock,NULL , work_list); + }else +LBUG ();ldlm_pool_add (&ldlm_res_to_ns (res)->ns_pool, lock); }
@@ -1546,6 +1559,8 @@ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns,*/ if (*flags &LDLM_FL_AST_DISCARD_DATA )ldlm_set_ast_discard_data (lock); +if (*flags &LDLM_FL_TEST_LOCK ) +ldlm_set_test_lock (lock);/* * This distinction between local lock trees is very important; a client
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +7 -9
@@ -309,8 +309,6 @@ static void failed_lock_cleanup(struct ldlm_namespace *ns,else LDLM_DEBUG (lock,"lock was granted or failed in race" ); -ldlm_lock_decref_internal (lock, mode); -/* XXX - HACK because we shouldn't call ldlm_lock_destroy() * from llite/file.c/ll_file_flock(). */
@@ -321,9 +319,14 @@ static void failed_lock_cleanup(struct ldlm_namespace *ns,*/ if (lock->l_resource->lr_type ==LDLM_FLOCK ) {lock_res_and_lock (lock); -ldlm_resource_unlink_lock (lock); -ldlm_lock_destroy_nolock (lock); +if (!ldlm_is_destroyed (lock)) { +ldlm_resource_unlink_lock (lock); +ldlm_lock_decref_internal_nolock (lock, mode); +ldlm_lock_destroy_nolock (lock); + }unlock_res_and_lock (lock); + }else { +ldlm_lock_decref_internal (lock, mode); } }
@@ -418,11 +421,6 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, *flags =ldlm_flags_from_wire (reply->lock_flags); lock->l_flags |=ldlm_flags_from_wire (reply->lock_flags &LDLM_FL_INHERIT_MASK ); -/* move NO_TIMEOUT flag to the lock to force ldlm_lock_match() -* to wait with no timeout as well -*/ - lock->l_flags |=ldlm_flags_from_wire (reply->lock_flags & -LDLM_FL_NO_TIMEOUT );unlock_res_and_lock (lock); CDEBUG(D_INFO, "local: %p, remote cookie: %#llx, flags: 0x%llx\n",
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +7 -1
@@ -793,8 +793,14 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,*/ unlock_res (res);LDLM_DEBUG (lock,"setting FL_LOCAL_ONLY" ); +if (lock->l_flags &LDLM_FL_FAIL_LOC ) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (4 )); +set_current_state (TASK_RUNNING ); + }if (lock->l_completion_ast) - lock->l_completion_ast (lock,0 ,NULL ); + lock->l_completion_ast (lock,LDLM_FL_FAILED , +NULL );LDLM_LOCK_RELEASE (lock);continue ; }
drivers/staging/lustre/lustre/llite/file.c +13 -7
@@ -2717,6 +2717,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)struct md_op_data *op_data;struct lustre_handle lockh = {0 };ldlm_policy_data_t flock = { {0 } }; +int fl_type = file_lock->fl_type;__u64 flags =0 ;int rc;int rc2 =0 ;
@@ -2747,7 +2748,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)if (file_lock->fl_lmops && file_lock->fl_lmops->lm_compare_owner) flock.l_flock.owner = (unsigned long )file_lock->fl_pid; -switch (file_lock->fl_type) { +switch (fl_type) {case F_RDLCK : einfo.ei_mode =LCK_PR ;break ;
@@ -2767,8 +2768,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) einfo.ei_mode =LCK_PW ;break ;default : -CDEBUG (D_INFO ,"Unknown fcntl lock type: %d\n" , - file_lock->fl_type); +CDEBUG (D_INFO ,"Unknown fcntl lock type: %d\n" , fl_type);return -ENOTSUPP ; }
@@ -2790,16 +2790,18 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)case F_GETLK64 :#endif flags =LDLM_FL_TEST_LOCK ; -/* Save the old mode so that if the mode in the lock changes we -* can decrement the appropriate reader or writer refcount. -*/ - file_lock->fl_type = einfo.ei_mode;break ;default :CERROR ("unknown fcntl lock command: %d\n" , cmd);return -EINVAL ; } +/* +* Save the old mode so that if the mode in the lock changes we +* can decrement the appropriate reader or writer refcount. +*/ + file_lock->fl_type = einfo.ei_mode; + op_data =ll_prep_md_op_data (NULL , inode,NULL ,NULL ,0 ,0 ,LUSTRE_OPC_ANY ,NULL );if (IS_ERR (op_data))
@@ -2812,6 +2814,10 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) rc =md_enqueue (sbi->ll_md_exp, &einfo,NULL , op_data, &lockh, &flock,0 ,NULL /* req */ , flags); +/* Restore the file lock type if not TEST lock. */ +if (!(flags &LDLM_FL_TEST_LOCK )) + file_lock->fl_type = fl_type; +if ((rc ==0 || file_lock->fl_type ==F_UNLCK ) && !(flags &LDLM_FL_TEST_LOCK )) rc2 =locks_lock_file_wait (file, file_lock);
Signature · 1 line
1.7.1
PATCH 38/80 staging: lustre: move ioctls to lustre_ioctl.h
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Move ioctl definitions and related functions from lustre_dlm.h, lustre_lib.h, obd.h, to lustre_ioctl.h. Replace the definitions of retired ioctls with comment.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4961
Reviewed-on: http://review.whamcloud.com/10139
--- .../lustre/lustre/include/lustre/lustre_ioctl.h | 412 ++++++++++++++++++++ .../lustre/lustre/include/lustre/lustre_user.h | 21 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 10 - drivers/staging/lustre/lustre/include/lustre_lib.h | 284 -------------- drivers/staging/lustre/lustre/include/obd.h | 10 - drivers/staging/lustre/lustre/llite/dir.c | 9 +- drivers/staging/lustre/lustre/llite/file.c | 1 + drivers/staging/lustre/lustre/llite/llite_lib.c | 1 + drivers/staging/lustre/lustre/lmv/lmv_obd.c | 1 + drivers/staging/lustre/lustre/lov/lov_obd.c | 1 + drivers/staging/lustre/lustre/mdc/mdc_request.c | 1 + drivers/staging/lustre/lustre/obdclass/class_obd.c | 8 +- .../lustre/lustre/obdclass/linux/linux-module.c | 1 + .../staging/lustre/lustre/obdclass/obd_config.c | 1 + .../staging/lustre/lustre/obdecho/echo_client.c | 1 + drivers/staging/lustre/lustre/osc/osc_request.c | 1 + 16 files changed, 430 insertions(+), 333 deletions(-) create mode 100644 drivers/staging/lustre/lustre/include/lustre/lustre_ioctl.h
drivers/staging/lustre/lustre/include/lustre/lustre_ioctl.h new file +412 -0
@@ -0,0 +1,412 @@ +/* +* GPL HEADER START +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 only, +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License version 2 for more details (a copy is included +* in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU General Public License +* version 2 along with this program; If not, see +* http://www.gnu.org/licenses/gpl-2.0.html +* +* GPL HEADER END +*/ +/* +* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. +* Use is subject to license terms. +* +* Copyright (c) 2011, 2015, Intel Corporation. +*/ +#ifndef LUSTRE_IOCTL_H_ +#define LUSTRE_IOCTL_H_ + +#include <linux/types.h> +#include "../../../include/linux/libcfs/libcfs.h" +#include "lustre_idl.h" + +#ifdef __KERNEL__ +# include <linux/ioctl.h> +# include <linux/string.h> +# include "../obd_support.h" +#else /* __KERNEL__ */ +# include <malloc.h> +# include <string.h> +#include <libcfs/util/ioctl.h> +#endif /* !__KERNEL__ */ + +#if !defined(__KERNEL__) && !defined(LUSTRE_UTILS ) +# error This file is for Lustre internal use only. +#endif + +enum md_echo_cmd { +ECHO_MD_CREATE =1 ,/* Open/Create file on MDT */ +ECHO_MD_MKDIR =2 ,/* Mkdir on MDT */ +ECHO_MD_DESTROY =3 ,/* Unlink file on MDT */ +ECHO_MD_RMDIR =4 ,/* Rmdir on MDT */ +ECHO_MD_LOOKUP =5 ,/* Lookup on MDT */ +ECHO_MD_GETATTR =6 ,/* Getattr on MDT */ +ECHO_MD_SETATTR =7 ,/* Setattr on MDT */ +ECHO_MD_ALLOC_FID =8 ,/* Get FIDs from MDT */ +}; + +#define OBD_DEV_ID 1 +#define OBD_DEV_NAME "obd" +#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME +#define OBD_DEV_MAJOR 10 +#define OBD_DEV_MINOR 241 + +#define OBD_IOCTL_VERSION 0x00010004 +#define OBD_DEV_BY_DEVNAME 0xffffd0de +#define OBD_MAX_IOCTL_BUFFER CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER + +struct obd_ioctl_data { +__u32 ioc_len; +__u32 ioc_version; + +union { +__u64 ioc_cookie; +__u64 ioc_u64_1; + }; +union { +__u32 ioc_conn1; +__u32 ioc_u32_1; + }; +union { +__u32 ioc_conn2; +__u32 ioc_u32_2; + }; + +struct obdo ioc_obdo1; +struct obdo ioc_obdo2; + +__u64 ioc_count; +__u64 ioc_offset; +__u32 ioc_dev; +__u32 ioc_command; + +__u64 ioc_nid; +__u32 ioc_nal; +__u32 ioc_type; + +/* buffers the kernel will treat as user pointers */ +__u32 ioc_plen1; +char __user *ioc_pbuf1; +__u32 ioc_plen2; +char __user *ioc_pbuf2; + +/* inline buffers for various arguments */ +__u32 ioc_inllen1; +char *ioc_inlbuf1; +__u32 ioc_inllen2; +char *ioc_inlbuf2; +__u32 ioc_inllen3; +char *ioc_inlbuf3; +__u32 ioc_inllen4; +char *ioc_inlbuf4; + +char ioc_bulk[0 ]; +}; + +struct obd_ioctl_hdr { +__u32 ioc_len; +__u32 ioc_version; +}; + +static inline __u32 obd_ioctl_packlen (struct obd_ioctl_data *data) +{ +__u32 len =cfs_size_round (sizeof (*data)); + + len +=cfs_size_round (data->ioc_inllen1); + len +=cfs_size_round (data->ioc_inllen2); + len +=cfs_size_round (data->ioc_inllen3); + len +=cfs_size_round (data->ioc_inllen4); + +return len; +} + +static inline int obd_ioctl_is_invalid (struct obd_ioctl_data *data) +{ +if (data->ioc_len > (1 <<30 )) { +CERROR ("OBD ioctl: ioc_len larger than 1<<30\n" ); +return 1 ; + } + +if (data->ioc_inllen1 > (1 <<30 )) { +CERROR ("OBD ioctl: ioc_inllen1 larger than 1<<30\n" ); +return 1 ; + } + +if (data->ioc_inllen2 > (1 <<30 )) { +CERROR ("OBD ioctl: ioc_inllen2 larger than 1<<30\n" ); +return 1 ; + } + +if (data->ioc_inllen3 > (1 <<30 )) { +CERROR ("OBD ioctl: ioc_inllen3 larger than 1<<30\n" ); +return 1 ; + } + +if (data->ioc_inllen4 > (1 <<30 )) { +CERROR ("OBD ioctl: ioc_inllen4 larger than 1<<30\n" ); +return 1 ; + } + +if (data->ioc_inlbuf1 && !data->ioc_inllen1) { +CERROR ("OBD ioctl: inlbuf1 pointer but 0 length\n" ); +return 1 ; + } + +if (data->ioc_inlbuf2 && !data->ioc_inllen2) { +CERROR ("OBD ioctl: inlbuf2 pointer but 0 length\n" ); +return 1 ; + } + +if (data->ioc_inlbuf3 && !data->ioc_inllen3) { +CERROR ("OBD ioctl: inlbuf3 pointer but 0 length\n" ); +return 1 ; + } + +if (data->ioc_inlbuf4 && !data->ioc_inllen4) { +CERROR ("OBD ioctl: inlbuf4 pointer but 0 length\n" ); +return 1 ; + } + +if (data->ioc_pbuf1 && !data->ioc_plen1) { +CERROR ("OBD ioctl: pbuf1 pointer but 0 length\n" ); +return 1 ; + } + +if (data->ioc_pbuf2 && !data->ioc_plen2) { +CERROR ("OBD ioctl: pbuf2 pointer but 0 length\n" ); +return 1 ; + } + +if (!data->ioc_pbuf1 && data->ioc_plen1) { +CERROR ("OBD ioctl: plen1 set but NULL pointer\n" ); +return 1 ; + } + +if (!data->ioc_pbuf2 && data->ioc_plen2) { +CERROR ("OBD ioctl: plen2 set but NULL pointer\n" ); +return 1 ; + } + +if (obd_ioctl_packlen (data) > data->ioc_len) { +CERROR ("OBD ioctl: packlen exceeds ioc_len (%d > %d)\n" , +obd_ioctl_packlen (data), data->ioc_len); +return 1 ; + } + +return 0 ; +} + +#ifdef __KERNEL__ + +int obd_ioctl_getdata (char **buf,int *len,void __user *arg); +int obd_ioctl_popdata (void __user *arg,void *data,int len); + +static inline void obd_ioctl_freedata (char *buf,size_t len) +{ +kvfree (buf); +} + +#else /* __KERNEL__ */ + +static inline int obd_ioctl_pack (struct obd_ioctl_data *data,char **pbuf, +int max_len) +{ +char *ptr; +struct obd_ioctl_data *overlay; + + data->ioc_len =obd_ioctl_packlen (data); + data->ioc_version =OBD_IOCTL_VERSION ; + +if (*pbuf && data->ioc_len > max_len) { +fprintf (stderr,"pbuf = %p, ioc_len = %u, max_len = %d\n" , + *pbuf, data->ioc_len, max_len); +return -EINVAL ; + } + +if (!*pbuf) + *pbuf =malloc (data->ioc_len); + +if (!*pbuf) +return -ENOMEM ; + + overlay = (struct obd_ioctl_data *)*pbuf; +memcpy (*pbuf, data,sizeof (*data)); + + ptr = overlay->ioc_bulk; +if (data->ioc_inlbuf1) +LOGL (data->ioc_inlbuf1, data->ioc_inllen1, ptr); + +if (data->ioc_inlbuf2) +LOGL (data->ioc_inlbuf2, data->ioc_inllen2, ptr); + +if (data->ioc_inlbuf3) +LOGL (data->ioc_inlbuf3, data->ioc_inllen3, ptr); + +if (data->ioc_inlbuf4) +LOGL (data->ioc_inlbuf4, data->ioc_inllen4, ptr); + +if (obd_ioctl_is_invalid (overlay)) { +fprintf (stderr,"invalid ioctl data: ioc_len = %u, max_len = %d\n" , + data->ioc_len, max_len); +return -EINVAL ; + } + +return 0 ; +} + +static inline int +obd_ioctl_unpack (struct obd_ioctl_data *data,char *pbuf,int max_len) +{ +char *ptr; +struct obd_ioctl_data *overlay; + +if (!pbuf) +return 1 ; + + overlay = (struct obd_ioctl_data *)pbuf; + +/* Preserve the caller's buffer pointers */ + overlay->ioc_inlbuf1 = data->ioc_inlbuf1; + overlay->ioc_inlbuf2 = data->ioc_inlbuf2; + overlay->ioc_inlbuf3 = data->ioc_inlbuf3; + overlay->ioc_inlbuf4 = data->ioc_inlbuf4; + +memcpy (data, pbuf,sizeof (*data)); + + ptr = overlay->ioc_bulk; +if (data->ioc_inlbuf1) +LOGU (data->ioc_inlbuf1, data->ioc_inllen1, ptr); + +if (data->ioc_inlbuf2) +LOGU (data->ioc_inlbuf2, data->ioc_inllen2, ptr); + +if (data->ioc_inlbuf3) +LOGU (data->ioc_inlbuf3, data->ioc_inllen3, ptr); + +if (data->ioc_inlbuf4) +LOGU (data->ioc_inlbuf4, data->ioc_inllen4, ptr); + +return 0 ; +} + +#endif /* !__KERNEL__ */ + +/* +* OBD_IOC_DATA_TYPE is only for compatibility reasons with older +* Linux Lustre user tools. New ioctls should NOT use this macro as +* the ioctl "size". Instead the ioctl should get a "size" argument +* which is the actual data type used by the ioctl, to ensure the +* ioctl interface is versioned correctly. +*/ +#define OBD_IOC_DATA_TYPE long + +/* IOC_LDLM_TEST _IOWR('f', 40, long) */ +/* IOC_LDLM_DUMP _IOWR('f', 41, long) */ +/* IOC_LDLM_REGRESS_START _IOWR('f', 42, long) */ +/* IOC_LDLM_REGRESS_STOP _IOWR('f', 43, long) */ + +#define OBD_IOC_CREATE _IOWR('f', 101, OBD_IOC_DATA_TYPE) +#define OBD_IOC_DESTROY _IOW('f', 104, OBD_IOC_DATA_TYPE) +/* OBD_IOC_PREALLOCATE _IOWR('f', 105, OBD_IOC_DATA_TYPE) */ + +#define OBD_IOC_SETATTR _IOW('f', 107, OBD_IOC_DATA_TYPE) +#define OBD_IOC_GETATTR _IOWR('f', 108, OBD_IOC_DATA_TYPE) +#define OBD_IOC_READ _IOWR('f', 109, OBD_IOC_DATA_TYPE) +#define OBD_IOC_WRITE _IOWR('f', 110, OBD_IOC_DATA_TYPE) + +#define OBD_IOC_STATFS _IOWR('f', 113, OBD_IOC_DATA_TYPE) +#define OBD_IOC_SYNC _IOW('f', 114, OBD_IOC_DATA_TYPE) +/* OBD_IOC_READ2 _IOWR('f', 115, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_FORMAT _IOWR('f', 116, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_PARTITION _IOWR('f', 117, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_COPY _IOWR('f', 120, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_MIGR _IOWR('f', 121, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_PUNCH _IOWR('f', 122, OBD_IOC_DATA_TYPE) */ + +/* OBD_IOC_MODULE_DEBUG _IOWR('f', 124, OBD_IOC_DATA_TYPE) */ +#define OBD_IOC_BRW_READ _IOWR('f', 125, OBD_IOC_DATA_TYPE) +#define OBD_IOC_BRW_WRITE _IOWR('f', 126, OBD_IOC_DATA_TYPE) +#define OBD_IOC_NAME2DEV _IOWR('f', 127, OBD_IOC_DATA_TYPE) +#define OBD_IOC_UUID2DEV _IOWR('f', 130, OBD_IOC_DATA_TYPE) +#define OBD_IOC_GETNAME _IOWR('f', 131, OBD_IOC_DATA_TYPE) +#define OBD_IOC_GETMDNAME _IOR('f', 131, char[MAX_OBD_NAME]) +#define OBD_IOC_GETDTNAME OBD_IOC_GETNAME +#define OBD_IOC_LOV_GET_CONFIG _IOWR('f', 132, OBD_IOC_DATA_TYPE) +#define OBD_IOC_CLIENT_RECOVER _IOW('f', 133, OBD_IOC_DATA_TYPE) +#define OBD_IOC_PING_TARGET _IOW('f', 136, OBD_IOC_DATA_TYPE) + +/* OBD_IOC_DEC_FS_USE_COUNT _IO('f', 139) */ +#define OBD_IOC_NO_TRANSNO _IOW('f', 140, OBD_IOC_DATA_TYPE) +#define OBD_IOC_SET_READONLY _IOW('f', 141, OBD_IOC_DATA_TYPE) +#define OBD_IOC_ABORT_RECOVERY _IOR('f', 142, OBD_IOC_DATA_TYPE) +/* OBD_IOC_ROOT_SQUASH _IOWR('f', 143, OBD_IOC_DATA_TYPE) */ +#define OBD_GET_VERSION _IOWR('f', 144, OBD_IOC_DATA_TYPE) +/* OBD_IOC_GSS_SUPPORT _IOWR('f', 145, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_CLOSE_UUID _IOWR('f', 147, OBD_IOC_DATA_TYPE) */ +#define OBD_IOC_CHANGELOG_SEND _IOW('f', 148, OBD_IOC_DATA_TYPE) +#define OBD_IOC_GETDEVICE _IOWR('f', 149, OBD_IOC_DATA_TYPE) +#define OBD_IOC_FID2PATH _IOWR('f', 150, OBD_IOC_DATA_TYPE) +/* lustre/lustre_user.h 151-153 */ +/* OBD_IOC_LOV_SETSTRIPE 154 LL_IOC_LOV_SETSTRIPE */ +/* OBD_IOC_LOV_GETSTRIPE 155 LL_IOC_LOV_GETSTRIPE */ +/* OBD_IOC_LOV_SETEA 156 LL_IOC_LOV_SETEA */ +/* lustre/lustre_user.h 157-159 */ +#define OBD_IOC_QUOTACHECK _IOW('f', 160, int) +#define OBD_IOC_POLL_QUOTACHECK _IOR('f', 161, struct if_quotacheck *) +#define OBD_IOC_QUOTACTL _IOWR('f', 162, struct if_quotactl) +/* lustre/lustre_user.h 163-176 */ +#define OBD_IOC_CHANGELOG_REG _IOW('f', 177, struct obd_ioctl_data) +#define OBD_IOC_CHANGELOG_DEREG _IOW('f', 178, struct obd_ioctl_data) +#define OBD_IOC_CHANGELOG_CLEAR _IOW('f', 179, struct obd_ioctl_data) +/* OBD_IOC_RECORD _IOWR('f', 180, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_ENDRECORD _IOWR('f', 181, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_PARSE _IOWR('f', 182, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_DORECORD _IOWR('f', 183, OBD_IOC_DATA_TYPE) */ +#define OBD_IOC_PROCESS_CFG _IOWR('f', 184, OBD_IOC_DATA_TYPE) +/* OBD_IOC_DUMP_LOG _IOWR('f', 185, OBD_IOC_DATA_TYPE) */ +/* OBD_IOC_CLEAR_LOG _IOWR('f', 186, OBD_IOC_DATA_TYPE) */ +#define OBD_IOC_PARAM _IOW('f', 187, OBD_IOC_DATA_TYPE) +#define OBD_IOC_POOL _IOWR('f', 188, OBD_IOC_DATA_TYPE) +#define OBD_IOC_REPLACE_NIDS _IOWR('f', 189, OBD_IOC_DATA_TYPE) + +#define OBD_IOC_CATLOGLIST _IOWR('f', 190, OBD_IOC_DATA_TYPE) +#define OBD_IOC_LLOG_INFO _IOWR('f', 191, OBD_IOC_DATA_TYPE) +#define OBD_IOC_LLOG_PRINT _IOWR('f', 192, OBD_IOC_DATA_TYPE) +#define OBD_IOC_LLOG_CANCEL _IOWR('f', 193, OBD_IOC_DATA_TYPE) +#define OBD_IOC_LLOG_REMOVE _IOWR('f', 194, OBD_IOC_DATA_TYPE) +#define OBD_IOC_LLOG_CHECK _IOWR('f', 195, OBD_IOC_DATA_TYPE) +/* OBD_IOC_LLOG_CATINFO _IOWR('f', 196, OBD_IOC_DATA_TYPE) */ +#define OBD_IOC_NODEMAP _IOWR('f', 197, OBD_IOC_DATA_TYPE) + +/* ECHO_IOC_GET_STRIPE _IOWR('f', 200, OBD_IOC_DATA_TYPE) */ +/* ECHO_IOC_SET_STRIPE _IOWR('f', 201, OBD_IOC_DATA_TYPE) */ +/* ECHO_IOC_ENQUEUE _IOWR('f', 202, OBD_IOC_DATA_TYPE) */ +/* ECHO_IOC_CANCEL _IOWR('f', 203, OBD_IOC_DATA_TYPE) */ + +#define OBD_IOC_GET_OBJ_VERSION _IOR('f', 210, OBD_IOC_DATA_TYPE) + +/* lustre/lustre_user.h 212-217 */ +#define OBD_IOC_GET_MNTOPT _IOW('f', 220, mntopt_t) +#define OBD_IOC_ECHO_MD _IOR('f', 221, struct obd_ioctl_data) +#define OBD_IOC_ECHO_ALLOC_SEQ _IOWR('f', 222, struct obd_ioctl_data) +#define OBD_IOC_START_LFSCK _IOWR('f', 230, OBD_IOC_DATA_TYPE) +#define OBD_IOC_STOP_LFSCK _IOW('f', 231, OBD_IOC_DATA_TYPE) +#define OBD_IOC_QUERY_LFSCK _IOR('f', 232, struct obd_ioctl_data) +/* lustre/lustre_user.h 240-249 */ +/* LIBCFS_IOC_DEBUG_MASK 250 */ + +#define IOC_OSC_SET_ACTIVE _IOWR('h', 21, void *) + +#endif /* LUSTRE_IOCTL_H_ */
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +5 -16
@@ -188,26 +188,20 @@ struct ost_id {* *STRIPE* - set/get lov_user_md * *INFO - set/get lov_user_mds_data */ -/* see <lustre_lib.h> for ioctl numberss 101-150 */ +/* lustre_ioctl.h 101-150 */ #define LL_IOC_GETFLAGS _IOR('f', 151, long)#define LL_IOC_SETFLAGS _IOW('f', 152, long)#define LL_IOC_CLRFLAGS _IOW('f', 153, long) -/* LL_IOC_LOV_SETSTRIPE: See also OBD_IOC_LOV_SETSTRIPE */ #define LL_IOC_LOV_SETSTRIPE _IOW('f', 154, long) -/* LL_IOC_LOV_GETSTRIPE: See also OBD_IOC_LOV_GETSTRIPE */ #define LL_IOC_LOV_GETSTRIPE _IOW('f', 155, long) -/* LL_IOC_LOV_SETEA: See also OBD_IOC_LOV_SETEA */ #define LL_IOC_LOV_SETEA _IOW('f', 156, long)#define LL_IOC_RECREATE_OBJ _IOW('f', 157, long)#define LL_IOC_RECREATE_FID _IOW('f', 157, struct lu_fid)#define LL_IOC_GROUP_LOCK _IOW('f', 158, long)#define LL_IOC_GROUP_UNLOCK _IOW('f', 159, long) -/* LL_IOC_QUOTACHECK: See also OBD_IOC_QUOTACHECK */ -#define LL_IOC_QUOTACHECK _IOW('f', 160, int) -/* LL_IOC_POLL_QUOTACHECK: See also OBD_IOC_POLL_QUOTACHECK */ -#define LL_IOC_POLL_QUOTACHECK _IOR('f', 161, struct if_quotacheck *) -/* LL_IOC_QUOTACTL: See also OBD_IOC_QUOTACTL */ -#define LL_IOC_QUOTACTL _IOWR('f', 162, struct if_quotactl) +/* #define LL_IOC_QUOTACHECK 160 OBD_IOC_QUOTACHECK */ +/* #define LL_IOC_POLL_QUOTACHECK 161 OBD_IOC_POLL_QUOTACHECK */ +/* #define LL_IOC_QUOTACTL 162 OBD_IOC_QUOTACTL */ #define IOC_OBD_STATFS _IOWR('f', 164, struct obd_statfs *)#define IOC_LOV_GETINFO _IOWR('f', 165, struct lov_user_mds_data *)#define LL_IOC_FLUSHCTX _IOW('f', 166, long)
@@ -221,8 +215,7 @@ struct ost_id {#define LL_IOC_GET_CONNECT_FLAGS _IOWR('f', 174, __u64 *)#define LL_IOC_GET_MDTIDX _IOR('f', 175, int) -/* see <lustre_lib.h> for ioctl numbers 177-210 */ - +/* lustre_ioctl.h 177-210 */ #define LL_IOC_HSM_STATE_GET _IOR('f', 211, struct hsm_user_state)#define LL_IOC_HSM_STATE_SET _IOW('f', 212, struct hsm_state_set)#define LL_IOC_HSM_CT_START _IOW('f', 213, struct lustre_kernelcomm)
@@ -255,10 +248,6 @@ struct ost_id {#define IOC_MDC_GETFILEINFO _IOWR(IOC_MDC_TYPE, 22, struct lov_user_mds_data *)#define LL_IOC_MDC_GETINFO _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data *) -/* Keep these for backward compartability. */ -#define LL_IOC_OBD_STATFS IOC_OBD_STATFS -#define IOC_MDC_GETSTRIPE IOC_MDC_GETFILESTRIPE -#define MAX_OBD_NAME 128/* If this changes, a NEW ioctl must be added */ /* Define O_LOV_DELAY_CREATE to be a mask that is not useful for regular
drivers/staging/lustre/lustre/include/lustre_dlm.h +0 -10
@@ -1282,16 +1282,6 @@ int ldlm_cli_cancel_list(struct list_head *head, int count,int intent_disposition (struct ldlm_reply *rep,int flag);void intent_set_disposition (struct ldlm_reply *rep,int flag); -/* ioctls for trying requests */ -#define IOC_LDLM_TYPE 'f' -#define IOC_LDLM_MIN_NR 40 - -#define IOC_LDLM_TEST _IOWR('f', 40, long) -#define IOC_LDLM_DUMP _IOWR('f', 41, long) -#define IOC_LDLM_REGRESS_START _IOWR('f', 42, long) -#define IOC_LDLM_REGRESS_STOP _IOWR('f', 43, long) -#define IOC_LDLM_MAX_NR 43 -/** * "Modes" of acquiring lock_res, necessary to tell lockdep that taking more * than one lock_res is dead-lock safe.
drivers/staging/lustre/lustre/include/lustre_lib.h +0 -284
296 lines not on this page · raw message
drivers/staging/lustre/lustre/include/obd.h +0 -10
@@ -35,15 +35,6 @@#include <linux/spinlock.h> -#define IOC_OSC_TYPE 'h' -#define IOC_OSC_MIN_NR 20 -#define IOC_OSC_SET_ACTIVE _IOWR(IOC_OSC_TYPE, 21, struct obd_device *) -#define IOC_OSC_MAX_NR 50 - -#define IOC_MDC_TYPE 'i' -#define IOC_MDC_MIN_NR 20 -#define IOC_MDC_MAX_NR 50 -#include "lustre/lustre_idl.h" #include "lustre_lib.h" #include "lu_ref.h"
@@ -623,7 +614,6 @@ struct obd_llog_group {/* corresponds to one of the obd's */ #define OBD_DEVICE_MAGIC 0XAB5CD6EF -#define OBD_DEV_BY_DEVNAME 0xffffd0destruct lvfs_run_ctxt {struct dt_device *dt;
drivers/staging/lustre/lustre/llite/dir.c +3 -6
@@ -46,8 +46,8 @@#include "../include/obd_support.h" #include "../include/obd_class.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_lib.h" -#include "../include/lustre/lustre_idl.h" #include "../include/lustre_lite.h" #include "../include/lustre_dlm.h" #include "../include/lustre_fid.h"
@@ -1543,7 +1543,7 @@ finish_req:case LL_IOC_LOV_SWAP_LAYOUTS :return -EPERM ; -case LL_IOC_OBD_STATFS : +case IOC_OBD_STATFS :return ll_obd_statfs (inode, (void __user *)arg);case LL_IOC_LOV_GETSTRIPE :case LL_IOC_MDC_GETINFO :
@@ -1708,9 +1708,6 @@ free_lmm:kvfree (lmm);return rc; } -case OBD_IOC_LLOG_CATINFO : { -return -EOPNOTSUPP ; - }case OBD_IOC_QUOTACHECK : {struct obd_quotactl *oqctl;int error =0 ;
@@ -1768,7 +1765,7 @@ out_poll:kfree (check);return rc; } -case LL_IOC_QUOTACTL : { +case OBD_IOC_QUOTACTL : {struct if_quotactl *qctl; qctl =kzalloc (sizeof (*qctl),GFP_NOFS );
drivers/staging/lustre/lustre/llite/file.c +1 -0
@@ -44,6 +44,7 @@#include <linux/mount.h> #include "llite_internal.h" #include "../include/lustre/ll_fiemap.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/cl_object.h"
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -0
@@ -41,6 +41,7 @@#include <linux/types.h> #include <linux/mm.h> +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_lite.h" #include "../include/lustre_ha.h" #include "../include/lustre_dlm.h"
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -0
@@ -51,6 +51,7 @@#include "../include/cl_object.h" #include "../include/lustre_lite.h" #include "../include/lustre_fid.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_kernelcomm.h" #include "lmv_internal.h"
drivers/staging/lustre/lustre/lov/lov_obd.c +1 -0
@@ -41,6 +41,7 @@#include "../../include/linux/libcfs/libcfs.h" #include "../include/obd_support.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_lib.h" #include "../include/lustre_net.h" #include "../include/lustre/lustre_idl.h"
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -0
@@ -39,6 +39,7 @@# include <linux/utsname.h> #include "../include/lustre_acl.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/obd_class.h" #include "../include/lustre_lmv.h" #include "../include/lustre_fid.h"
drivers/staging/lustre/lustre/obdclass/class_obd.c +1 -7
@@ -40,6 +40,7 @@#include "../include/lprocfs_status.h" #include <linux/list.h> #include "../include/cl_object.h" +#include "../include/lustre/lustre_ioctl.h" #include "llog_internal.h" struct obd_device *obd_devs[MAX_OBD_DEVICES ];
@@ -287,13 +288,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) goto out; } -case OBD_IOC_CLOSE_UUID : { -CDEBUG (D_IOCTL ,"closing all connections to uuid %s (NOOP)\n" , - data->ioc_inlbuf1); - err =0 ; - goto out; - } -case OBD_IOC_GETDEVICE : {int index = data->ioc_count;char *status, *str;
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +1 -0
@@ -65,6 +65,7 @@#include "../../include/obd_support.h" #include "../../include/obd_class.h" #include "../../include/lprocfs_status.h" +#include "../../include/lustre/lustre_ioctl.h" #include "../../include/lustre_ver.h" /* buffer MUST be at least the size of obd_ioctl_hdr */
drivers/staging/lustre/lustre/obdclass/obd_config.c +1 -0
@@ -37,6 +37,7 @@#define DEBUG_SUBSYSTEM S_CLASS#include "../include/obd_class.h" #include <linux/string.h> +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_log.h" #include "../include/lprocfs_status.h" #include "../include/lustre_param.h"
drivers/staging/lustre/lustre/obdecho/echo_client.c +1 -0
@@ -41,6 +41,7 @@#include "../include/cl_object.h" #include "../include/lustre_fid.h" #include "../include/lustre_acl.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_net.h" #include "echo_internal.h"
drivers/staging/lustre/lustre/osc/osc_request.c +1 -0
@@ -41,6 +41,7 @@#include "../include/lustre_ha.h" #include "../include/lprocfs_status.h" +#include "../include/lustre/lustre_ioctl.h" #include "../include/lustre_debug.h" #include "../include/lustre_param.h" #include "../include/lustre_fid.h"
Signature · 1 line
1.7.1
PATCH 39/80 staging: lustre: llite: add error handler in inode prepare phase
In reply to James SimmonsFrom: wang di <[email protected]>
Add error handler during inode inialization, so inode will become bad inode if something bad happens during inode prepare phase, otherwise the striped directory will not get its layout and being mis-regarded as normal directory.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4930
Reviewed-on: http://review.whamcloud.com/10170
--- .../staging/lustre/lustre/llite/llite_internal.h | 4 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 66 +++++++++++-------- drivers/staging/lustre/lustre/llite/namei.c | 59 ++++++++++-------- 3 files changed, 72 insertions(+), 57 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -2
@@ -766,8 +766,8 @@ int ll_setattr(struct dentry *de, struct iattr *attr);int ll_statfs (struct dentry *de,struct kstatfs *sfs);int ll_statfs_internal (struct super_block *sb,struct obd_statfs *osfs,__u64 max_age,__u32 flags); -void ll_update_inode (struct inode *inode,struct lustre_md *md); -void ll_read_inode2 (struct inode *inode,void *opaque); +int ll_update_inode (struct inode *inode,struct lustre_md *md); +int ll_read_inode2 (struct inode *inode,void *opaque);void ll_delete_inode (struct inode *inode);int ll_iocontrol (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg);
drivers/staging/lustre/lustre/llite/llite_lib.c +38 -28
184 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/namei.c +32 -27
73 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 40/80 staging: lustre: ptlrpc: Early replies need to honor at_max
In reply to James SimmonsFrom: Chris Horn <[email protected]>
When determining whether an early reply can be sent the server will calculate the new deadline based on an offset from the request arrival time. However, when actually setting the new deadline the server offsets the current time. This can result in deadlines being extended more than at_max seconds past the request arrival time. Instead, the server should offset the arrival time when updating its request timeout.
When a client receives an early reply it doesn't know the server side arrival time so we use the original sent time as an approximation.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4578
Reviewed-on: http://review.whamcloud.com/9100
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 8 +++++--- drivers/staging/lustre/lustre/ptlrpc/import.c | 11 +++++++---- drivers/staging/lustre/lustre/ptlrpc/service.c | 18 +++++++++++++----- 3 files changed, 25 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +5 -3
@@ -385,10 +385,12 @@ static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req)spin_lock (&req->rq_lock); olddl = req->rq_deadline;/* -* server assumes it now has rq_timeout from when it sent the -* early reply, so client should give it at least that long. +* server assumes it now has rq_timeout from when the request +* arrived, so the client should give it at least that long. +* since we don't know the arrival time we'll use the original +* sent time */ - req->rq_deadline =ktime_get_real_seconds () + req->rq_timeout + + req->rq_deadline = req->rq_sent + req->rq_timeout +ptlrpc_at_get_net_latency (req); DEBUG_REQ(D_ADAPTTO, req,
drivers/staging/lustre/lustre/ptlrpc/import.c +7 -4
@@ -1497,10 +1497,13 @@ EXPORT_SYMBOL(ptlrpc_disconnect_import);/* Adaptive Timeout utils */ extern unsigned int at_min, at_max, at_history; -/* Bin into timeslices using AT_BINS bins. -* This gives us a max of the last binlimit*AT_BINS secs without the storage, -* but still smoothing out a return to normalcy from a slow response. -* (E.g. remember the maximum latency in each minute of the last 4 minutes.) +/* +*Update at_current with the specified value (bounded by at_min and at_max), +* as well as the AT history "bins". +* - Bin into timeslices using AT_BINS bins. +* - This gives us a max of the last at_history seconds without the storage, +* but still smoothing out a return to normalcy from a slow response. +* - (E.g. remember the maximum latency in each minute of the last 4 minutes.) */ int at_measured (struct adaptive_timeout *at,unsigned int val) {
drivers/staging/lustre/lustre/ptlrpc/service.c +13 -5
@@ -1005,13 +1005,16 @@ ptlrpc_at_remove_timed(struct ptlrpc_request *req) array->paa_count--; } +/* +* Attempt to extend the request deadline by sending an early reply to the +* client. +*/ static int ptlrpc_at_send_early_reply (struct ptlrpc_request *req) {struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;struct ptlrpc_request *reqcopy;struct lustre_msg *reqmsg;long olddl = req->rq_deadline -ktime_get_real_seconds (); -time64_t newdl;int rc;/* deadline is when the client expects us to reply, margin is the
@@ -1039,8 +1042,13 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req)return -ENOSYS ; } -/* Fake our processing time into the future to ask the clients -* for some extra amount of time +/* +* We want to extend the request deadline by at_extra seconds, +* so we set our service estimate to reflect how much time has +* passed since this request arrived plus an additional +* at_extra seconds. The client will calculate the new deadline +* based on this service estimate (plus some additional time to +* account for network latency). See ptlrpc_at_recv_early_reply */ at_measured (&svcpt->scp_at_estimate, at_extra +ktime_get_real_seconds () - req->rq_arrival_time.tv_sec);
@@ -1056,7 +1064,6 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) ktime_get_real_seconds());return -ETIMEDOUT ; } - newdl =ktime_get_real_seconds () +at_get (&svcpt->scp_at_estimate); reqcopy =ptlrpc_request_cache_alloc (GFP_NOFS );if (!reqcopy)
@@ -1110,7 +1117,8 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req)if (!rc) {/* Adjust our own deadline to what we told the client */ - req->rq_deadline = newdl; + req->rq_deadline = req->rq_arrival_time.tv_sec + +at_get (&svcpt->scp_at_estimate); req->rq_early_count++;/* number sent, server side */ }else {DEBUG_REQ (D_ERROR , req,"Early reply send failed %d" , rc);
Signature · 1 line
1.7.1
PATCH 41/80 staging: lustre: lmv: separate master object with master stripe
In reply to James SimmonsFrom: wang di <[email protected]>
Separate master stripe with master object, so
1. stripeEA only exists on master object.
2. sub-stripe object will be inserted into master object as sub-directory, and it can get the master object by "..".
By this, it will remove those specilities for stripe0 in LMV and LOD. And also simplify LFSCK, i.e. consistency check would be easier.
When then master object becomes an orphan, we should mark all of its sub-stripes as dead object as well, otherwise client might still be able to create files under these stripes.
A few fixes for striped directory layout lock:
1. stripe 0 should be locked as EX, same as other stripes.
2. Acquire the layout for directory, when it is being unliked.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4690
Reviewed-on: http://review.whamcloud.com/9511
--- .../lustre/lustre/include/lustre/lustre_idl.h | 64 +++++++++----- .../lustre/lustre/include/lustre/lustre_user.h | 3 +- drivers/staging/lustre/lustre/include/lustre_lmv.h | 25 +++++- drivers/staging/lustre/lustre/include/obd.h | 4 +- drivers/staging/lustre/lustre/include/obd_class.h | 5 +- drivers/staging/lustre/lustre/llite/dir.c | 31 ++----- drivers/staging/lustre/lustre/llite/llite_lib.c | 89 ++++++++++---------- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 25 +----- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 4 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 70 ++++++++-------- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 4 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 6 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 +- 14 files changed, 174 insertions(+), 166 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +41 -23
@@ -2497,18 +2497,52 @@ struct lmv_desc {struct obd_uuid ld_uuid; }; -/* lmv structures */ -#define LMV_MAGIC_V1 0x0CD10CD0/* normal stripe lmv magic */ -#define LMV_USER_MAGIC 0x0CD20CD0/* default lmv magic*/ -#define LMV_MAGIC_MIGRATE 0x0CD30CD0/* migrate stripe lmv magic */ -#define LMV_MAGIC LMV_MAGIC_V1 +/* LMV layout EA, and it will be stored both in master and slave object */ +struct lmv_mds_md_v1 { +__u32 lmv_magic; +__u32 lmv_stripe_count; +__u32 lmv_master_mdt_index;/* On master object, it is master +* MDT index, on slave object, it +* is stripe index of the slave obj +*/ +__u32 lmv_hash_type;/* dir stripe policy, i.e. indicate +* which hash function to be used, +* Note: only lower 16 bits is being +* used for now. Higher 16 bits will +* be used to mark the object status, +* for example migrating or dead. +*/ +__u32 lmv_layout_version;/* Used for directory restriping */ +__u32 lmv_padding; +struct lu_fid lmv_master_fid;/* The FID of the master object, which +* is the namespace-visible dir FID +*/ +char lmv_pool_name[LOV_MAXPOOLNAME ];/* pool name */ +struct lu_fid lmv_stripe_fids[0 ];/* FIDs for each stripe */ +}; +#define LMV_MAGIC_V1 0x0CD20CD0/* normal stripe lmv magic */ +#define LMV_MAGIC LMV_MAGIC_V1 + +/* #define LMV_USER_MAGIC 0x0CD30CD0 */ +#define LMV_MAGIC_STRIPE 0x0CD40CD0/* magic for dir sub_stripe */ + +/* +*Right now only the lower part(0-16bits) of lmv_hash_type is being used, +* and the higher part will be the flag to indicate the status of object, +* for example the object is being migrated. And the hash function +* might be interpreted differently with different flags. +*/ enum lmv_hash_type {LMV_HASH_TYPE_ALL_CHARS =1 ,LMV_HASH_TYPE_FNV_1A_64 =2 , -LMV_HASH_TYPE_MIGRATION =3 , }; +#define LMV_HASH_TYPE_MASK 0x0000ffff + +#define LMV_HASH_FLAG_MIGRATION 0x80000000 +#define LMV_HASH_FLAG_DEAD 0x40000000 +#define LMV_HASH_NAME_ALL_CHARS "all_char"#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64"
@@ -2540,19 +2574,6 @@ static inline __u64 lustre_hash_fnv_1a_64(const void *buf, size_t size)return hash; } -struct lmv_mds_md_v1 { -__u32 lmv_magic; -__u32 lmv_stripe_count;/* stripe count */ -__u32 lmv_master_mdt_index;/* master MDT index */ -__u32 lmv_hash_type;/* dir stripe policy, i.e. indicate -* which hash function to be used -*/ -__u32 lmv_layout_version;/* Used for directory restriping */ -__u32 lmv_padding; -char lmv_pool_name[LOV_MAXPOOLNAME ];/* pool name */ -struct lu_fid lmv_stripe_fids[0 ];/* FIDs for each stripe */ -}; -union lmv_mds_md {__u32 lmv_magic;struct lmv_mds_md_v1 lmv_md_v1;
@@ -2566,8 +2587,7 @@ static inline ssize_t lmv_mds_md_size(int stripe_count, unsigned int lmm_magic)ssize_t len = -EINVAL ;switch (lmm_magic) { -case LMV_MAGIC_V1 : -case LMV_MAGIC_MIGRATE : { +case LMV_MAGIC_V1 : {struct lmv_mds_md_v1 *lmm1; len =sizeof (*lmm1);
@@ -2583,7 +2603,6 @@ static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm) {switch (le32_to_cpu (lmm->lmv_magic)) {case LMV_MAGIC_V1 : -case LMV_MAGIC_MIGRATE :return le32_to_cpu (lmm->lmv_md_v1.lmv_stripe_count);case LMV_USER_MAGIC :return le32_to_cpu (lmm->lmv_user_md.lum_stripe_count);
@@ -2599,7 +2618,6 @@ static inline int lmv_mds_md_stripe_count_set(union lmv_mds_md *lmm,switch (le32_to_cpu (lmm->lmv_magic)) {case LMV_MAGIC_V1 : -case LMV_MAGIC_MIGRATE : lmm->lmv_md_v1.lmv_stripe_count =cpu_to_le32 (stripe_count);break ;case LMV_USER_MAGIC :
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +1 -2
@@ -269,8 +269,7 @@ struct ost_id {#define LOV_USER_MAGIC_JOIN_V1 0x0BD20BD0#define LOV_USER_MAGIC_V3 0x0BD30BD0 -#define LMV_MAGIC_V1 0x0CD10CD0/*normal stripe lmv magic */ -#define LMV_USER_MAGIC 0x0CD20CD0/*default lmv magic*/ +#define LMV_USER_MAGIC 0x0CD30CD0/*default lmv magic*/ #define LOV_PATTERN_RAID0 0x001#define LOV_PATTERN_RAID1 0x002
drivers/staging/lustre/lustre/include/lustre_lmv.h +23 -2
@@ -48,10 +48,33 @@ struct lmv_stripe_md {__u32 lsm_md_layout_version;__u32 lsm_md_default_count;__u32 lsm_md_default_index; +struct lu_fid lsm_md_master_fid;char lsm_md_pool_name[LOV_MAXPOOLNAME ];struct lmv_oinfo lsm_md_oinfo[0 ]; }; +static inline bool +lsm_md_eq (const struct lmv_stripe_md *lsm1,const struct lmv_stripe_md *lsm2) +{ +int idx; + +if (lsm1->lsm_md_magic != lsm2->lsm_md_magic || + lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count || + lsm1->lsm_md_master_mdt_index != lsm2->lsm_md_master_mdt_index || + lsm1->lsm_md_hash_type != lsm2->lsm_md_hash_type || + lsm1->lsm_md_layout_version != lsm2->lsm_md_layout_version || + !strcmp (lsm1->lsm_md_pool_name, lsm2->lsm_md_pool_name)) +return false; + +for (idx =0 ; idx < lsm1->lsm_md_stripe_count; idx++) { +if (!lu_fid_eq (&lsm1->lsm_md_oinfo[idx].lmo_fid, + &lsm2->lsm_md_oinfo[idx].lmo_fid)) +return false; + } + +return true; +} +union lmv_mds_md ; int lmv_unpack_md(struct obd_export *exp, struct lmv_stripe_md **lsmp,
@@ -106,7 +129,6 @@ static inline void lmv_cpu_to_le(union lmv_mds_md *lmv_dst, {switch (lmv_src->lmv_magic) {case LMV_MAGIC_V1 : -case LMV_MAGIC_MIGRATE :lmv1_cpu_to_le (&lmv_dst->lmv_md_v1, &lmv_src->lmv_md_v1);break ;default :
@@ -119,7 +141,6 @@ static inline void lmv_le_to_cpu(union lmv_mds_md *lmv_dst, {switch (le32_to_cpu (lmv_src->lmv_magic)) {case LMV_MAGIC_V1 : -case LMV_MAGIC_MIGRATE :lmv1_le_to_cpu (&lmv_dst->lmv_md_v1, &lmv_src->lmv_md_v1);break ;default :
drivers/staging/lustre/lustre/include/obd.h +2 -2
@@ -917,8 +917,8 @@ struct obd_ops {int (*fid_fini)(struct obd_device *obd);/* Allocate new fid according to passed @hint. */ -int (*fid_alloc)(struct obd_export *exp,struct lu_fid *fid, -struct md_op_data *op_data); +int (*fid_alloc)(const struct lu_env *env,struct obd_export *exp, +struct lu_fid *fid,struct md_op_data *op_data);/* * Object with @fid is getting deleted, we may want to do something
drivers/staging/lustre/lustre/include/obd_class.h +3 -2
@@ -930,7 +930,8 @@ static inline int obd_fid_fini(struct obd_device *obd)return rc; } -static inline int obd_fid_alloc (struct obd_export *exp, +static inline int obd_fid_alloc (const struct lu_env *env, +struct obd_export *exp,struct lu_fid *fid,struct md_op_data *op_data) {
@@ -939,7 +940,7 @@ static inline int obd_fid_alloc(struct obd_export *exp,EXP_CHECK_DT_OP (exp, fid_alloc);EXP_COUNTER_INCREMENT (exp, fid_alloc); - rc =OBP (exp->exp_obd, fid_alloc)(exp, fid, op_data); + rc =OBP (exp->exp_obd, fid_alloc)(env, exp, fid, op_data);return rc; }
drivers/staging/lustre/lustre/llite/dir.c +10 -21
@@ -883,7 +883,6 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size,lustre_swab_lov_user_md_v3 ((struct lov_user_md_v3 *)lmm);break ;case LMV_USER_MAGIC : -case LMV_MAGIC_MIGRATE :if (cpu_to_le32 (LMV_USER_MAGIC ) !=LMV_USER_MAGIC )lustre_swab_lmv_user_md ((struct lmv_user_md *)lmm);break ;
@@ -1471,7 +1470,7 @@ lmv_out_free: rc =ll_dir_getstripe (inode, (void **)&lmm, &lmmsize, &request, valid); -if (rc && rc != -ENODATA ) +if (rc) goto finish_req;/* Get default LMV EA */
@@ -1490,14 +1489,7 @@ lmv_out_free: goto finish_req; } -/* Get normal LMV EA */ -if (rc == -ENODATA ) { - stripe_count =1 ; - }else { -LASSERT (lmm); - stripe_count =lmv_mds_md_stripe_count_get (lmm); - } - + stripe_count =lmv_mds_md_stripe_count_get (lmm); lum_size =lmv_user_md_size (stripe_count,LMV_MAGIC_V1 ); tmp =kzalloc (lum_size,GFP_NOFS );if (!tmp) {
@@ -1505,28 +1497,25 @@ lmv_out_free: goto finish_req; } - tmp->lum_magic =LMV_MAGIC_V1 ; - tmp->lum_stripe_count =1 ; mdt_index =ll_get_mdt_idx (inode);if (mdt_index <0 ) { rc = -ENOMEM ; goto out_tmp; } + tmp->lum_magic =LMV_MAGIC_V1 ; + tmp->lum_stripe_count =0 ; tmp->lum_stripe_offset = mdt_index; - tmp->lum_objects[0 ].lum_mds = mdt_index; - tmp->lum_objects[0 ].lum_fid = *ll_inode2fid (inode); -for (i =1 ; i < stripe_count; i++) { -struct lmv_mds_md_v1 *lmm1; - - lmm1 = &lmm->lmv_md_v1; - mdt_index =ll_get_mdt_idx_by_fid (sbi, - &lmm1->lmv_stripe_fids[i]); +for (i =0 ; i < stripe_count; i++) { +struct lu_fid *fid; + + fid = &lmm->lmv_md_v1.lmv_stripe_fids[i]; + mdt_index =ll_get_mdt_idx_by_fid (sbi, fid);if (mdt_index <0 ) { rc = mdt_index; goto out_tmp; } tmp->lum_objects[i].lum_mds = mdt_index; - tmp->lum_objects[i].lum_fid = lmm1->lmv_stripe_fids[i]; + tmp->lum_objects[i].lum_fid = *fid; tmp->lum_stripe_count++; }
drivers/staging/lustre/lustre/llite/llite_lib.c +44 -45
133 lines not on this page · raw message
drivers/staging/lustre/lustre/lmv/lmv_intent.c +5 -20
@@ -173,9 +173,6 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody,* revalidate slaves has some problems, temporarily return, * we may not need that */ -if (lsm->lsm_md_stripe_count <=1 ) -return 0 ; - op_data =kzalloc (sizeof (*op_data),GFP_NOFS );if (!op_data)return -ENOMEM ;
@@ -194,14 +191,6 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, fid = lsm->lsm_md_oinfo[i].lmo_fid; inode = lsm->lsm_md_oinfo[i].lmo_root; -if (!i) { -if (mbody) { - body = mbody; - goto update; - }else { - goto release_lock; - } - }/* * Prepare op_data for revalidating. Note that @fid2 shluld be
@@ -237,7 +226,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY );LASSERT (body); -update: +if (unlikely (body->nlink <2 )) { CERROR("%s: nlink %d < 2 corrupt stripe %d "DFID":" DFID"\n", obd->obd_name, body->nlink, i,
@@ -256,10 +245,6 @@ update: goto cleanup; } -if (i) -md_set_lock_data (tgt->ltd_exp, &lockh->cookie, - inode,NULL ); -i_size_write (inode, body->size);set_nlink (inode, body->nlink);LTIME_S (inode->i_atime) = body->atime;
@@ -269,8 +254,8 @@ update:if (req)ptlrpc_req_finished (req); } -release_lock: - size +=i_size_read (inode); + +md_set_lock_data (tgt->ltd_exp, &lockh->cookie, inode,NULL );if (i !=0 ) nlink += inode->i_nlink -2 ;
@@ -361,7 +346,7 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,* fid and setup FLD for it. */ op_data->op_fid3 = op_data->op_fid2; - rc =lmv_fid_alloc (exp, &op_data->op_fid2, op_data); + rc =lmv_fid_alloc (NULL , exp, &op_data->op_fid2, op_data);if (rc !=0 )return rc; }
@@ -453,7 +438,7 @@ static int lmv_intent_lookup(struct obd_export *exp, }return rc; }else if (it_disposition (it,DISP_LOOKUP_NEG ) && lsm && - lsm->lsm_md_magic ==LMV_MAGIC_MIGRATE ) { + lsm->lsm_md_magic &LMV_HASH_FLAG_MIGRATION ) {/* * For migrating directory, if it can not find the child in * the source directory(master stripe), try the targeting
drivers/staging/lustre/lustre/lmv/lmv_internal.h +2 -2
@@ -52,8 +52,8 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,int lmv_fld_lookup (struct lmv_obd *lmv,const struct lu_fid *fid,u32 *mds);int __lmv_fid_alloc (struct lmv_obd *lmv,struct lu_fid *fid,u32 mds); -int lmv_fid_alloc (struct obd_export *exp,struct lu_fid *fid, -struct md_op_data *op_data); +int lmv_fid_alloc (const struct lu_env *env,struct obd_export *exp, +struct lu_fid *fid,struct md_op_data *op_data);int lmv_unpack_md (struct obd_export *exp,struct lmv_stripe_md **lsmp,const union lmv_mds_md *lmm,int stripe_count);
drivers/staging/lustre/lustre/lmv/lmv_obd.c +34 -36
170 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_internal.h +2 -2
@@ -87,8 +87,8 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, struct list_head *cancels, enum ldlm_mode mode, __u64 bits);/* mdc/mdc_request.c */ -int mdc_fid_alloc (struct obd_export *exp,struct lu_fid *fid, -struct md_op_data *op_data); +int mdc_fid_alloc (const struct lu_env *env,struct obd_export *exp, +struct lu_fid *fid,struct md_op_data *op_data);struct obd_client_handle ; int mdc_set_open_replay_data(struct obd_export *exp,
drivers/staging/lustre/lustre/mdc/mdc_locks.c +1 -1
@@ -1144,7 +1144,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,/* For case if upper layer did not alloc fid, do it now. */ if (!fid_is_sane (&op_data->op_fid2) && it->it_op &IT_CREAT ) { - rc =mdc_fid_alloc (exp, &op_data->op_fid2, op_data); + rc =mdc_fid_alloc (NULL , exp, &op_data->op_fid2, op_data);if (rc <0 ) {CERROR ("Can't alloc new fid, rc %d\n" , rc);return rc;
drivers/staging/lustre/lustre/mdc/mdc_reint.c +2 -4
@@ -214,11 +214,9 @@ int mdc_create(struct obd_export *exp, struct md_op_data *op_data,* mdc_fid_alloc() may return errno 1 in case of switch to new * sequence, handle this. */ - rc =mdc_fid_alloc (exp, &op_data->op_fid2, op_data); -if (rc <0 ) { -CERROR ("Can't alloc new fid, rc %d\n" , rc); + rc =mdc_fid_alloc (NULL , exp, &op_data->op_fid2, op_data); +if (rc <0 )return rc; - } } rebuild:
drivers/staging/lustre/lustre/mdc/mdc_request.c +4 -4
@@ -765,7 +765,7 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, req_fmt = &RQF_MDS_RELEASE_CLOSE ;/* allocate a FID for volatile file */ - rc =mdc_fid_alloc (exp, &op_data->op_fid2, op_data); + rc =mdc_fid_alloc (NULL , exp, &op_data->op_fid2, op_data);if (rc <0 ) {CERROR ("%s: " DFID " failed to allocate FID: %d\n" , obd->obd_name,PFID (&op_data->op_fid1), rc);
@@ -2203,13 +2203,13 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp,return rc; } -int mdc_fid_alloc (struct obd_export *exp,struct lu_fid *fid, -struct md_op_data *op_data) +int mdc_fid_alloc (const struct lu_env *env,struct obd_export *exp, +struct lu_fid *fid,struct md_op_data *op_data) {struct client_obd *cli = &exp->exp_obd->u.cli;struct lu_client_seq *seq = cli->cl_seq; -return seq_client_alloc_fid (NULL , seq, fid); +return seq_client_alloc_fid (env, seq, fid); }static struct obd_uuid *mdc_get_uuid (struct obd_export *exp)
Signature · 1 line
1.7.1
Re: [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
drivers/staging/lustre/lustre/include/lustre_lmv.h struct lmv_stripe_md { · line 67
Quoted 13 lines · James Simmons
drivers/staging/lustre/lustre/include/lustre_lmv.h +12
-0+static inline bool +lsm_md_eq (const struct lmv_stripe_md *lsm1,const struct lmv_stripe_md *lsm2) +{ +int idx; + +if (lsm1->lsm_md_magic != lsm2->lsm_md_magic || + lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count || + lsm1->lsm_md_master_mdt_index != lsm2->lsm_md_master_mdt_index || + lsm1->lsm_md_hash_type != lsm2->lsm_md_hash_type || + lsm1->lsm_md_layout_version != lsm2->lsm_md_layout_version || + !strcmp (lsm1->lsm_md_pool_name, lsm2->lsm_md_pool_name)) +return false;
Hi James and all,
This patch (8f18c8a48b736c2f in linux) is different from the corresponding patch in lustre-release (60e07b972114df).
In that patch, the last clause in the 'if' condition is
+ strcmp(lsm1->lsm_md_pool_name,
+ lsm2->lsm_md_pool_name) != 0)
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return -ENOMEM (that had me puzzled for a while!!).
This seems to suggest that no-one has been testing the mainline linux lustre.
It also seems to suggest that there is a good chance that there are other bugs that have crept in while no-one has really been caring. Given that the sanity test suite doesn't complete for me, but just hangs (in test_27z I think), that seems particularly likely.
So my real question - to anyone interested in lustre for mainline linux
- is: can we actually trust this code at all?
I'm seriously tempted to suggest that we just
rm -r drivers/staging/lustre
drivers/staging is great for letting the community work on code that has been "thrown over the wall" and is not openly developed elsewhere, but that is not the case for lustre. lustre has (or seems to have) an open development process. Having on-going development happen both there and in drivers/staging seems a waste of resources.
Might it make sense to instead start cleaning up the code in lustre-release so as to make it meet the upstream kernel standards. Then when the time is right, the kernel code can be moved *out* of lustre-release and *in* to linux. Then development can continue in Linux (just like it does with other Linux filesystems).
An added bonus of this is that there is an obvious path to getting server support in mainline Linux. The current situation of client-only support seems weird given how interdependent the two are.
What do others think? Is there any chance that the current lustre in Linux will ever be more than a poor second-cousin to the external lustre-release. If there isn't, should we just discard it now and move on?
Thanks,
NeilBrown
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
Quoted 4 lines · NeilBrown
On Tue, Aug 16 2016, James Simmons wrote:
my that’s an old patch
Quoted 24 lines
Quoted 4 lines
drivers/staging/lustre/lustre/include/lustre_lmv.h +2
-0+static inline bool +lsm_md_eq (const struct lmv_stripe_md *lsm1,const struct lmv_stripe_md *lsm2)drivers/staging/lustre/lustre/include/lustre_lmv.h struct lmv_stripe_md { · line 67
Quoted 10 lines
drivers/staging/lustre/lustre/include/lustre_lmv.h +10
-0+{ +int idx; + +if (lsm1->lsm_md_magic != lsm2->lsm_md_magic || + lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count || + lsm1->lsm_md_master_mdt_index != lsm2->lsm_md_master_mdt_index || + lsm1->lsm_md_hash_type != lsm2->lsm_md_hash_type || + lsm1->lsm_md_layout_version != lsm2->lsm_md_layout_version || + !strcmp (lsm1->lsm_md_pool_name, lsm2->lsm_md_pool_name)) +return false;Hi James and all,
This patch (8f18c8a48b736c2fin linux) is different from the corresponding patch in lustre-release (60e07b972114df).In that patch, the last clause in the 'if' condition is
(quoted diff) +2
-0+ strcmp(lsm1->lsm_md_pool_name, + lsm2->lsm_md_pool_name) != 0)
Quoted 5 lines
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return
-ENOMEM(that had me puzzled for a while!!).
huh? I am not seeing anything of the sort and I was running sanity all the time until a recent pause (but going to resume).
Quoted 6 lines
This seems to suggest that no-one has been testing the mainline linux lustre.
It also seems to suggest that there is a good chance that there are other bugs that have crept in while no-one has really been caring. Given that the sanity test suite doesn't complete for me, but just hangs (intest_27zI think), that seems particularly likely.
Works for me, here’s a run from earlier today on 4.15.0:
== sanity test 27z: check SEQ/OID on the MDT and OST filesystems ===================================== 16:43:58 (1518126238) 1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0169548 s, 61.8 MB/s
2+0 records in
2+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.02782 s, 75.4 MB/s
check file /mnt/lustre/d27z.sanity/f27z.sanity-1
FID seq 0x200000401, oid 0x4640 ver 0x0
LOV seq 0x200000401, oid 0x4640, count: 1
want: stripe:0 ost:0 oid:314/0x13a seq:0
Stopping /mnt/lustre-ost1 (opts:) on centos6-17
pdsh@fedora1: centos6-17: ssh exited with exit code 1
pdsh@fedora1: centos6-17: ssh exited with exit code 1
pdsh@fedora1: centos6-17: ssh exited with exit code 1
Starting ost1: -o loop /tmp/lustre-ost1 /mnt/lustre-ost1
Failed to initialize ZFS library: 256
h2tcp: deprecated, use h2nettype instead
centos6-17.localnet: executing set_default_debug vfstrace rpctrace dlmtrace neterror ha config ioctl super all -lnet -lnd -pinger 16 pdsh@fedora1: centos6-17: ssh exited with exit code 1
pdsh@fedora1: centos6-17: ssh exited with exit code 1
Started lustre-OST0000/mnt/lustre-ost1/O/0/d26/314: parent=[0x200000401:0x4640:0x0] stripe=0 stripe_size=0 stripe_count=0
check file /mnt/lustre/d27z.sanity/f27z.sanity-2
FID seq 0x200000401, oid 0x4642 ver 0x0
LOV seq 0x200000401, oid 0x4642, count: 2
want: stripe:0 ost:1 oid:1187/0x4a3 seq:0
Stopping /mnt/lustre-ost2 (opts:) on centos6-17
pdsh@fedora1: centos6-17: ssh exited with exit code 1
pdsh@fedora1: centos6-17: ssh exited with exit code 1
pdsh@fedora1: centos6-17: ssh exited with exit code 1
Starting ost2: -o loop /tmp/lustre-ost2 /mnt/lustre-ost2
Failed to initialize ZFS library: 256
h2tcp: deprecated, use h2nettype instead
centos6-17.localnet: executing set_default_debug vfstrace rpctrace dlmtrace neterror ha config ioctl super all -lnet -lnd -pinger 16 pdsh@fedora1: centos6-17: ssh exited with exit code 1
pdsh@fedora1: centos6-17: ssh exited with exit code 1
Started lustre-OST0001/mnt/lustre-ost2/O/0/d3/1187: parent=[0x200000401:0x4642:0x0] stripe=0 stripe_size=0 stripe_count=0
want: stripe:1 ost:0 oid:315/0x13b seq:0
got: objid=0 seq=0 parent=[0x200000401:0x4642:0x0] stripe=1
Resetting fail_loc on all nodes...done.
16:44:32 (1518126272) waiting for centos6-16 network 5 secs ...
16:44:32 (1518126272) network interface is UP
16:44:33 (1518126273) waiting for centos6-17 network 5 secs ...
16:44:33 (1518126273) network interface is UP
Quoted 2 lines
So my real question - to anyone interested in lustre for mainline linux
- is: can we actually trust this code at all?
Absolutely. Seems that you just stumbled upon a corner case that was not being hit by people that do the testing, so you have something unique about your setup, I guess.
Quoted 8 lines
I'm seriously tempted to suggest that we just
rm -rdrivers/staging/lustre
drivers/stagingis great for letting the community work on code that has been "thrown over the wall" and is not openly developed elsewhere, but that is not the case for lustre. lustre has (or seems to have) an open development process. Having on-going development happen both there and indrivers/stagingseems a waste of resources.
It is a bit of a waste of resources, but there are some other things here. E.g. we cannot have any APIs with no users in the kernel.
Also some people like to have in-kernel modules coming with their distros (there were some users that used staging client on ubuntu as their setup).
Instead the plan was to clean up the staging client into acceptable state, move it out of staging, bring in all the missing features and then drop the client (more or less) from the lustre-release.
Quoted 5 lines
Might it make sense to instead start cleaning up the code in lustre-release so as to make it meet the upstream kernel standards. Then when the time is right, the kernel code can be moved *out* of lustre-release and *in* to linux. Then development can continue in Linux (just like it does with other Linux filesystems).
While we can be cleaning lustre in lustre-release, there are some things we cannot do as easily, e.g. decoupling Lustre client from the server. Also it would not attract any reviews from all the janitor or (more importantly) Al Viro and other people with a sharp eyes.
Quoted 3 lines
An added bonus of this is that there is an obvious path to getting server support in mainline Linux. The current situation of client-only support seems weird given how interdependent the two are.
Given the pushback Lustre client was given I have no hope Lustre server will get into mainline in my lifetime.
Quoted 4 lines
What do others think? Is there any chance that the current lustre in Linux will ever be more than a poor second-cousin to the external lustre-release. If there isn't, should we just discard it now and move on?
I think many useful cleanups and fixes came from the staging tree at the very least.
The biggest problem with it all is that we are in staging tree so we cannot bring it to parity much. And we are in staging tree because there’s a whole bunch of “cleanups” requested that take a lot of effort (in both implementing them and then in finding other ways of achieving things that were done in old ways before).
I understand that beggars cannot be choosers and while there are people that are grandfathered with their atrocities in current kernel tree, we must adhere to the shining standards first before having our chance, but the standards are not easy to adhere to in an established sizeable codebase.
Realistically speaking I suspect if we drop Lustre from staging, it’s unlikely there would remain any steam behind the cleanup efforts at all.
Bye,
Oleg
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
Quoted 7 lines · Oleg Drokin
Quoted 3 lines · NeilBrown
On Tue, Aug 16 2016, James Simmons wrote:
my that’s an old patch
Quoted 1 line
...
Quoted 9 lines
Quoted 6 lines
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return
-ENOMEM(that had me puzzled for a while!!).huh? I am not seeing anything of the sort and I was running sanity all the time until a recent pause (but going to resume).
That does surprised me - I reproduce it every time.
I have two VMs running a SLE12-SP2 kernel with patches from lustre-release applied. These are servers. They have 2 3G virtual disks each.
I have two over VMs running current mainline. These are clients.
I guess your 'recent pause' included between v4.15-rc1 (8e55b6fd0660) and v4.15-rc6 (a93639090a27) - a full month when lustre wouldn't work at all :-(
Quoted 9 lines
Quoted 7 lines
This seems to suggest that no-one has been testing the mainline linux lustre.
It also seems to suggest that there is a good chance that there are other bugs that have crept in while no-one has really been caring. Given that the sanity test suite doesn't complete for me, but just hangs (intest_27zI think), that seems particularly likely.Works for me, here’s a run from earlier today on 4.15.0:
Well that's encouraging .. I haven't looked into this one yet - I'm not even sure where to start.
Quoted 23 lines
Quoted 3 lines
So my real question - to anyone interested in lustre for mainline linux
- is: can we actually trust this code at all?Absolutely. Seems that you just stumbled upon a corner case that was not being hit by people that do the testing, so you have something unique about your setup, I guess.
Quoted 8 lines
I'm seriously tempted to suggest that we just
rm -rdrivers/staging/lustre
drivers/stagingis great for letting the community work on code that has been "thrown over the wall" and is not openly developed elsewhere, but that is not the case for lustre. lustre has (or seems to have) an open development process. Having on-going development happen both there and indrivers/stagingseems a waste of resources.It is a bit of a waste of resources, but there are some other things here. E.g. we cannot have any APIs with no users in the kernel.
Also some people like to have in-kernel modules coming with their distros (there were some users that used staging client on ubuntu as their setup).
Quoted 3 lines
Instead the plan was to clean up the staging client into acceptable state, move it out of staging, bring in all the missing features and then drop the client (more or less) from the lustre-release.
That sounds like a great plan. Any idea why it didn't happen? It seems there is a lot of upstream work mixed in with the clean up, and I don't think that really helps anyone.
Is it at all realistic that the client might be removed from lustre-release? That might be a good goal to work towards.
Quoted 12 lines
Quoted 6 lines
Might it make sense to instead start cleaning up the code in lustre-release so as to make it meet the upstream kernel standards. Then when the time is right, the kernel code can be moved *out* of lustre-release and *in* to linux. Then development can continue in Linux (just like it does with other Linux filesystems).
While we can be cleaning lustre in lustre-release, there are some things we cannot do as easily, e.g. decoupling Lustre client from the server. Also it would not attract any reviews from all the janitor or (more importantly) Al Viro and other people with a sharp eyes.
Quoted 6 lines
Quoted 3 lines
An added bonus of this is that there is an obvious path to getting server support in mainline Linux. The current situation of client-only support seems weird given how interdependent the two are.
Given the pushback Lustre client was given I have no hope Lustre server will get into mainline in my lifetime.
Even if it is horrible it would be nice to have it in staging... I guess the changes required to ext4 prohibit that... I don't suppose it can be made to work with mainline ext4 in a reduced-functionality-and-performance way??
I think it would be a lot easier to motivate forward progress if there were a credible end goal of everything being in mainline.
Quoted 7 lines
Quoted 5 lines
What do others think? Is there any chance that the current lustre in Linux will ever be more than a poor second-cousin to the external lustre-release. If there isn't, should we just discard it now and move on?
Quoted 7 lines
I think many useful cleanups and fixes came from the staging tree at the very least.
The biggest problem with it all is that we are in staging tree so we cannot bring it to parity much. And we are in staging tree because there’s a whole bunch of “cleanups” requested that take a lot of effort (in both implementing them and then in finding other ways of achieving things that were done in old ways before).
Do you have a list of requested cleanups? I would find that to be useful.
Quoted 9 lines
I understand that beggars cannot be choosers and while there are people that are grandfathered with their atrocities in current kernel tree, we must adhere to the shining standards first before having our chance, but the standards are not easy to adhere to in an established sizeable codebase.
Realistically speaking I suspect if we drop Lustre from staging, it’s unlikely there would remain any steam behind the cleanup efforts at all.
Thanks for your thoughts,
NeilBrown
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
Quoted 29 lines · NeilBrown
Quoted 7 lines · Oleg Drokin
Quoted 3 lines · NeilBrown
On Tue, Aug 16 2016, James Simmons wrote:
my that’s an old patch
Quoted 1 line
...
Quoted 9 lines
Quoted 6 lines
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return
-ENOMEM(that had me puzzled for a while!!).huh? I am not seeing anything of the sort and I was running sanity all the time until a recent pause (but going to resume).
That does surprised me - I reproduce it every time.
I have two VMs running a SLE12-SP2 kernel with patches from lustre-release applied. These are servers. They have 2 3G virtual disks each.
I have two over VMs running current mainline. These are clients.
Quoted 3 lines
I guess your 'recent pause' included between v4.15-rc1 (
8e55b6fd0660) and v4.15-rc6 (a93639090a27) - a full month when lustre wouldn't work at all :-(
More than that, but I am pretty sure James Simmons is running tests all the time too (he has a different config, I only have tcp).
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
This seems to suggest that no-one has been testing the mainline linux lustre.
It also seems to suggest that there is a good chance that there are other bugs that have crept in while no-one has really been caring. Given that the sanity test suite doesn't complete for me, but just hangs (intest_27zI think), that seems particularly likely.Works for me, here’s a run from earlier today on 4.15.0:
Well that's encouraging .. I haven't looked into this one yet - I'm not even sure where to start.
m… debug logs for example (greatly neutered in staging tree, but still useful)? try lctl dk and see what’s in there.
Quoted 5 lines
Quoted 3 lines
Instead the plan was to clean up the staging client into acceptable state, move it out of staging, bring in all the missing features and then drop the client (more or less) from the lustre-release.
That sounds like a great plan. Any idea why it didn't happen?
Because meeting open-ended demands is hard and certain demands sound like “throw away your X and rewrite it from scratch" (e.g. everything IB-related).
Certain things that sound useless (like the debug subsystem in Lustre) is very useful when you have a 10k nodes in a cluster and need to selectively pull stuff from a run to debug a complicated cross-node interaction. I asked NFS people how do they do it and they don’t have anything that scales and usually involves reducing the problem to a much smaller set of nodes first.
Quoted 2 lines
It seems there is a lot of upstream work mixed in with the clean up, and I don't think that really helps anyone.
I don’t understand what you mean here.
Quoted 2 lines
Is it at all realistic that the client might be removed from lustre-release? That might be a good goal to work towards.
Assuming we can bring the whole functionality over - sure.
Of course there’d still be some separate development place and we would need to create patches (new features?) for like SuSE and other distros and for testing of server features, I guess, but that could just that - a side branch somewhere I hope.
It’s not that we are super glad to chase every kernel vendors put out, of course it would be much easier if the kernels already included a very functional Lustre client.
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Might it make sense to instead start cleaning up the code in lustre-release so as to make it meet the upstream kernel standards. Then when the time is right, the kernel code can be moved *out* of lustre-release and *in* to linux. Then development can continue in Linux (just like it does with other Linux filesystems).
While we can be cleaning lustre in lustre-release, there are some things we cannot do as easily, e.g. decoupling Lustre client from the server. Also it would not attract any reviews from all the janitor or (more importantly) Al Viro and other people with a sharp eyes.
Quoted 3 lines
An added bonus of this is that there is an obvious path to getting server support in mainline Linux. The current situation of client-only support seems weird given how interdependent the two are.
Quoted 7 lines
Quoted 2 lines
Given the pushback Lustre client was given I have no hope Lustre server will get into mainline in my lifetime.
Even if it is horrible it would be nice to have it in staging... I guess the changes required to ext4 prohibit that... I don't suppose it can be made to work with mainline ext4 in a reduced-functionality-and-performance way??
We support unpatched ZFS as a server too! ;)
(and if somebody invests the time into it, there was some half-baked btrfs backend too I think).
That said nobody here believes in any success of pushing Lustre server into mainline.
It would just be easier to push the whole server into userspace (And there was a project like this in the past, now abandoned because it was mostly targeting Solaris anyway).
Quoted 18 lines
I think it would be a lot easier to motivate forward progress if there were a credible end goal of everything being in mainline.
Quoted 7 lines
Quoted 5 lines
What do others think? Is there any chance that the current lustre in Linux will ever be more than a poor second-cousin to the external lustre-release. If there isn't, should we just discard it now and move on?
Quoted 7 lines
I think many useful cleanups and fixes came from the staging tree at the very least.
The biggest problem with it all is that we are in staging tree so we cannot bring it to parity much. And we are in staging tree because there’s a whole bunch of “cleanups” requested that take a lot of effort (in both implementing them and then in finding other ways of achieving things that were done in old ways before).
Quoted 2 lines
Do you have a list of requested cleanups? I would find that to be useful.
As Greg would tell you, “if you don’t know what needs to be done, let’s just remove the whole thing from staging now”.
I assume you saw drivers/staging/lustre/TODO already, it’s only partially done.
We had a bunch of other requests from various people ranging from wholesale removal of various parts to making sure there’s no checkpatch warnings (Turned out rather hard to do, even though we greatly pared the numbers).
I have some patches to make Lustre a lot more monolithic too. People want us to remove our indirections hell so the code is more readable (I have some patches that need to be freshened up some that help here a bit, but the work is huge.)
Other requests come out as some of the prior ones get completed due to “you need o finish current level of cleanups so that we can see what other cleanups are needed, the current code is too bad to see everything” pretty much.
Bye,
Oleg
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
Quoted 29 lines
Quoted 29 lines · NeilBrown
Quoted 7 lines · Oleg Drokin
Quoted 3 lines · NeilBrown
On Tue, Aug 16 2016, James Simmons wrote:
my that’s an old patch
Quoted 1 line
...
Quoted 9 lines
Quoted 6 lines
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return
-ENOMEM(that had me puzzled for a while!!).huh? I am not seeing anything of the sort and I was running sanity all the time until a recent pause (but going to resume).
That does surprised me - I reproduce it every time.
I have two VMs running a SLE12-SP2 kernel with patches from lustre-release applied. These are servers. They have 2 3G virtual disks each.
I have two over VMs running current mainline. These are clients.
Quoted 6 lines
Quoted 3 lines
I guess your 'recent pause' included between v4.15-rc1 (
8e55b6fd0660) and v4.15-rc6 (a93639090a27) - a full month when lustre wouldn't work at all :-(More than that, but I am pretty sure James Simmons is running tests all the time too (he has a different config, I only have tcp).
Yes I have been testing and haven't encountered this problem. Let me try the fix you pointed out.
Quoted 7 lines
Quoted 2 lines
Do you have a list of requested cleanups? I would find that to be useful.
As Greg would tell you, “if you don’t know what needs to be done, let’s just remove the whole thing from staging now”.
I assume you saw
drivers/staging/lustre/TODOalready, it’s only partially done.
Actually the complete list is at :
https://jira.hpdd.intel.com/browse/LU-9679
I need to move that to our TODO list. Sorry I have been short on cycles.
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
Quoted 32 lines · James Simmons
Quoted 32 lines
Quoted 31 lines · NeilBrown
Quoted 7 lines · Oleg Drokin
Quoted 3 lines · NeilBrown
On Tue, Aug 16 2016, James Simmons wrote:
my that’s an old patch
Quoted 1 line
...
Quoted 9 lines
Quoted 6 lines
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return
-ENOMEM(that had me puzzled for a while!!).huh? I am not seeing anything of the sort and I was running sanity all the time until a recent pause (but going to resume).
That does surprised me - I reproduce it every time.
I have two VMs running a SLE12-SP2 kernel with patches from lustre-release applied. These are servers. They have 2 3G virtual disks each.
I have two over VMs running current mainline. These are clients.I guess your 'recent pause' included between v4.15-rc1 (
8e55b6fd0660) and v4.15-rc6 (a93639090a27) - a full month when lustre wouldn't work at all :-(
Quoted 5 lines
Quoted 2 lines
More than that, but I am pretty sure James Simmons is running tests all the time too (he has a different config, I only have tcp).
Yes I have been testing and haven't encountered this problem. Let me try the fix you pointed out.
Yeah, I guess I over reacted a bit in suggesting that no-one can have been testing - sorry about that. It seemed really strange though as the bug was so easy for me to hit.
Maybe - as you suggest in another email - it is due to some client/server incompatibility. I guess it is unavoidable with an fs like lustre to have incompatible protocol changes. Is there any mechanism for detecting the version of other peers in the cluster and refusing to run if versions are incompatible?
If you haven't hit the problem in testing, I suspect you aren't touching that code path at all. Maybe put a BUG() call in there to see :-)
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Do you have a list of requested cleanups? I would find that to be useful.
As Greg would tell you, “if you don’t know what needs to be done, let’s just remove the whole thing from staging now”.
Quoted 7 lines
Quoted 1 line
I assume you saw
drivers/staging/lustre/TODOalready, it’s only partially done.Actually the complete list is at :
https://jira.hpdd.intel.com/browse/LU-9679
I need to move that to our TODO list. Sorry I have been short on cycles.
Just adding that link to TODO would be a great start. I might do that when I next send some patches.
Thanks,
NeilBrown
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
Quoted 8 lines · NeilBrown
Maybe - as you suggest in another email - it is due to some client/server incompatibility. I guess it is unavoidable with an fs like lustre to have incompatible protocol changes. Is there any mechanism for detecting the version of other peers in the cluster and refusing to run if versions are incompatible?
Yes, client and server exchange “feature bits” at connect time and only use the subset of features that both can understand.
Bye,
Oleg
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
In reply to Oleg DrokinQuoted 42 lines · Oleg Drokin
Quoted 28 lines · NeilBrown
Quoted 7 lines · Oleg Drokin
Quoted 3 lines · NeilBrown
On Tue, Aug 16 2016, James Simmons wrote:
my that’s an old patch
Quoted 1 line
...
Quoted 9 lines
Quoted 6 lines
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return
-ENOMEM(that had me puzzled for a while!!).huh? I am not seeing anything of the sort and I was running sanity all the time until a recent pause (but going to resume).
That does surprised me - I reproduce it every time.
I have two VMs running a SLE12-SP2 kernel with patches from lustre-release applied. These are servers. They have 2 3G virtual disks each.
I have two over VMs running current mainline. These are clients.Quoted 3 lines
I guess your 'recent pause' included between v4.15-rc1 (
8e55b6fd0660) and v4.15-rc6 (a93639090a27) - a full month when lustre wouldn't work at all :-(More than that, but I am pretty sure James Simmons is running tests all the time too (he has a different config, I only have tcp).
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
This seems to suggest that no-one has been testing the mainline linux lustre.
It also seems to suggest that there is a good chance that there are other bugs that have crept in while no-one has really been caring. Given that the sanity test suite doesn't complete for me, but just hangs (intest_27zI think), that seems particularly likely.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Works for me, here’s a run from earlier today on 4.15.0:
Well that's encouraging .. I haven't looked into this one yet - I'm not even sure where to start.
m… debug logs for example (greatly neutered in staging tree, but still useful)? try lctl dk and see what’s in there.
Debug logs seem to tell me that some message is being sent to a server and a reply is being received, but that request we are waiting on doesn't make progress. I plan to dig in and learn more about how lustre rpc works so I have a better changes of interpreted those debug logs.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Instead the plan was to clean up the staging client into acceptable state, move it out of staging, bring in all the missing features and then drop the client (more or less) from the lustre-release.
That sounds like a great plan. Any idea why it didn't happen?
Because meeting open-ended demands is hard and certain demands sound like “throw away your X and rewrite it from scratch" (e.g. everything IB-related).
My narrow perspective on IB - from when rdma support was added to the NFS server - is that it is broken by design and impossible to do "right". So different people could easily have different ideas on how to make the best of a bad lot.
I might try to have a look.
Quoted 6 lines
Certain things that sound useless (like the debug subsystem in Lustre) is very useful when you have a 10k nodes in a cluster and need to selectively pull stuff from a run to debug a complicated cross-node interaction. I asked NFS people how do they do it and they don’t have anything that scales and usually involves reducing the problem to a much smaller set of nodes first.
the "rpcdebug" stuff that Linux/nfs has is sometimes useful, but some parts are changing to tracepoints and some parts have remained, which is a little confusing.
The fact that lustre tracing seems to *always* log everything so that if something goes wrong you can extract that last few meg(?) of logs seems really useful.
I discovered - thanks to James -
https://jira.hpdd.intel.com/browse/LU-8980
Add tracepoint support to Lustre
which is "closed", but I cannot find any trace of tracepoints in drivers/staging or in lustre-release. Maybe I'm confused. I suspect tracepoints is a good way to go.
Quoted 5 lines
Quoted 3 lines
It seems there is a lot of upstream work mixed in with the clean up, and I don't think that really helps anyone.
I don’t understand what you mean here.
Just that I thought that the main point of drivers/staging is to get the code into a mergable state, and if feature addition happens at the same time, then priorities get blurred and goals don't get reached.
Quoted 10 lines
Quoted 3 lines
Is it at all realistic that the client might be removed from lustre-release? That might be a good goal to work towards.
Assuming we can bring the whole functionality over - sure.
Of course there’d still be some separate development place and we would need to create patches (new features?) for like SuSE and other distros and for testing of server features, I guess, but that could just that - a side branch somewhere I hope.
Of course - code doesn't go upstream until it is ready. Lots of development happens elsewhere.
Of course distros like SUSE would generally rather ship code that was "ready" and so like to see it upstream. There is usually room for negotiation.
Quoted 23 lines
It’s not that we are super glad to chase every kernel vendors put out, of course it would be much easier if the kernels already included a very functional Lustre client.
Quoted 18 lines
Quoted 17 lines
Quoted 5 lines
Might it make sense to instead start cleaning up the code in lustre-release so as to make it meet the upstream kernel standards. Then when the time is right, the kernel code can be moved *out* of lustre-release and *in* to linux. Then development can continue in Linux (just like it does with other Linux filesystems).
While we can be cleaning lustre in lustre-release, there are some things we cannot do as easily, e.g. decoupling Lustre client from the server. Also it would not attract any reviews from all the janitor or (more importantly) Al Viro and other people with a sharp eyes.
Quoted 3 lines
An added bonus of this is that there is an obvious path to getting server support in mainline Linux. The current situation of client-only support seems weird given how interdependent the two are.
Given the pushback Lustre client was given I have no hope Lustre server will get into mainline in my lifetime.
Quoted 6 lines
Quoted 4 lines
Even if it is horrible it would be nice to have it in staging... I guess the changes required to ext4 prohibit that... I don't suppose it can be made to work with mainline ext4 in a reduced-functionality-and-performance way??
We support unpatched ZFS as a server too! ;)
So that that mean you would expect lustre-server to work with unpatched ext4? In that case I won't give up hope of seeing the server in mainline in my lifetime. Client first though.
Quoted 26 lines
(and if somebody invests the time into it, there was some half-baked btrfs backend too I think).
That said nobody here believes in any success of pushing Lustre server into mainline.
It would just be easier to push the whole server into userspace (And there was a project like this in the past, now abandoned because it was mostly targeting Solaris anyway).Quoted 18 lines
I think it would be a lot easier to motivate forward progress if there were a credible end goal of everything being in mainline.
Quoted 14 lines
Quoted 5 lines
What do others think? Is there any chance that the current lustre in Linux will ever be more than a poor second-cousin to the external lustre-release. If there isn't, should we just discard it now and move on?
I think many useful cleanups and fixes came from the staging tree at the very least.
The biggest problem with it all is that we are in staging tree so we cannot bring it to parity much. And we are in staging tree because there’s a whole bunch of “cleanups” requested that take a lot of effort (in both implementing them and then in finding other ways of achieving things that were done in old ways before).
Quoted 5 lines
Quoted 2 lines
Do you have a list of requested cleanups? I would find that to be useful.
As Greg would tell you, “if you don’t know what needs to be done, let’s just remove the whole thing from staging now”.
Of course, but I don't expect that I will see the same things that others see. And if people have gone to the trouble to provide feedback, it seems polite to record that feed back for all to see.
Quoted 2 lines
I assume you saw
drivers/staging/lustre/TODOalready, it’s only partially done.
Yes - it isn't very detailed though. Maybe I'll flesh it out with some of the things you have said.
Quoted 5 lines
We had a bunch of other requests from various people ranging from wholesale removal of various parts to making sure there’s no checkpatch warnings (Turned out rather hard to do, even though we greatly pared the numbers).
checkpatch is a useful guide, but an awful master.
% find drivers/staging/lustre/ -name '*.[ch]' | while read a; do
./scripts/checkpatch.pl --max-line-length=10000 --no-summary -f $a done|grep '^ERROR' | sort | uniq -c
17 ERROR: Macros with complex values should be enclosed in parentheses
2 ERROR: Macros with multiple statements should be enclosed in a do - while loop
12 ERROR: No #include in ...include/uapi/... should use a uapi/ path prefix
1 ERROR: space required before the open brace '{'
8 ERROR: that open brace { should be on the previous line
1 ERROR: trailing statements should be on next line
1 ERROR: trailing whitespace
Thanks isn't too bad - obviously nearly there with checkpatch. Lots more warnings - some might be interesting.
wholesale removal - like the prng, the workqueues, and the ll_wait_event() macro? I can do that :-)
Quoted 2 lines
I have some patches to make Lustre a lot more monolithic too.
Yes, it annoys me that I cannot build without modules. I took some steps towards fixing that and went off down a rabbit hole.. Should be fairly easy.
Quoted 3 lines
People want us to remove our indirections hell so the code is more readable (I have some patches that need to be freshened up some that help here a bit, but the work is huge.)
But indirections solve all problems :-)
Quoted 4 lines
Other requests come out as some of the prior ones get completed due to “you need o finish current level of cleanups so that we can see what other cleanups are needed, the current code is too bad to see everything” pretty much.
Thanks a lot for your helpful reply.
NeilBrown
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
Quoted 11 lines · NeilBrown
Quoted 6 lines · Oleg Drokin
Certain things that sound useless (like the debug subsystem in Lustre) is very useful when you have a 10k nodes in a cluster and need to selectively pull stuff from a run to debug a complicated cross-node interaction. I asked NFS people how do they do it and they don’t have anything that scales and usually involves reducing the problem to a much smaller set of nodes first.
Quoted 7 lines
the "rpcdebug" stuff that Linux/nfs has is sometimes useful, but some parts are changing to tracepoints and some parts have remained, which is a little confusing.
The fact that lustre tracing seems to *always* log everything so that if something goes wrong you can extract that last few meg(?) of logs seems really useful.
Not really. Lustre also has a bitmask for logs (since otherwise all those prints are pretty cpu taxing), but what makes those logs better is:
the size is unlimited, not constrained by dmesg buffer size.
You can capture those logs from a crashdump (something I really wish somebody would implement for tracepoint buffers, but alas, I have not found anything for this yet - we have a crash plugin to extract lustre debug logs from a kernel crashdump).
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Even if it is horrible it would be nice to have it in staging... I guess the changes required to ext4 prohibit that... I don't suppose it can be made to work with mainline ext4 in a reduced-functionality-and-performance way??
We support unpatched ZFS as a server too! ;)
So that that mean you would expect lustre-server to work with unpatched ext4? In that case I won't give up hope of seeing the server in mainline in my lifetime. Client first though.
While unpatched ext4 might in theory be possible, currently it does not export everything we need from the transaction/fs control perspective.
Bye,
Oleg
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
In reply to NeilBrownQuoted 53 lines
drivers/staging/lustre/lustre/include/lustre_lmv.h struct lmv_stripe_md { · line 67
Quoted 13 lines
drivers/staging/lustre/lustre/include/lustre_lmv.h +12
-0+static inline bool +lsm_md_eq (const struct lmv_stripe_md *lsm1,const struct lmv_stripe_md *lsm2) +{ +int idx; + +if (lsm1->lsm_md_magic != lsm2->lsm_md_magic || + lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count || + lsm1->lsm_md_master_mdt_index != lsm2->lsm_md_master_mdt_index || + lsm1->lsm_md_hash_type != lsm2->lsm_md_hash_type || + lsm1->lsm_md_layout_version != lsm2->lsm_md_layout_version || + !strcmp (lsm1->lsm_md_pool_name, lsm2->lsm_md_pool_name)) +return false;Hi James and all,
This patch (8f18c8a48b736c2fin linux) is different from the corresponding patch in lustre-release (60e07b972114df).In that patch, the last clause in the 'if' condition is
(quoted diff) +2
-0+ strcmp(lsm1->lsm_md_pool_name, + lsm2->lsm_md_pool_name) != 0)Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
This causes many tests in the 'sanity' test suite to return
-ENOMEM(that had me puzzled for a while!!).
This seems to suggest that no-one has been testing the mainline linux lustre.
It also seems to suggest that there is a good chance that there are other bugs that have crept in while no-one has really been caring. Given that the sanity test suite doesn't complete for me, but just hangs (intest_27zI think), that seems particularly likely.So my real question - to anyone interested in lustre for mainline linux
- is: can we actually trust this code at all?
I'm seriously tempted to suggest that we just
rm -rdrivers/staging/lustre
drivers/stagingis great for letting the community work on code that has been "thrown over the wall" and is not openly developed elsewhere, but that is not the case for lustre. lustre has (or seems to have) an open development process. Having on-going development happen both there and indrivers/stagingseems a waste of resources.Might it make sense to instead start cleaning up the code in lustre-release so as to make it meet the upstream kernel standards. Then when the time is right, the kernel code can be moved *out* of lustre-release and *in* to linux. Then development can continue in Linux (just like it does with other Linux filesystems).
Quoted 8 lines
An added bonus of this is that there is an obvious path to getting server support in mainline Linux. The current situation of client-only support seems weird given how interdependent the two are.
What do others think? Is there any chance that the current lustre in Linux will ever be more than a poor second-cousin to the external lustre-release. If there isn't, should we just discard it now and move on?
If you think that the OpenSFS/Intel branch (lustre-release) is the land of milk and honey you are very wrong. Take for example the UAPI header cleanup I push to the linux client several months ago. That work took 5 years to complete. I had to complete that work in the Intel branch since it impacted our tools. This isn't the only example. I worked along side Intel for increasing striping of a file to more then the 160 stripe limit Lustre use to have. That work took 3 years to complete. If the patch is more than one line it will normally take 1 to 2 months to land. It is common to have patches 6 months or more in age.
This is one of the major reasons I'm involved in the upstream client work. If lustre remains a tiny under manned community it is doomed to remain a niche file system. For years I have tried to recruit new developers to help out and even gave talks at lustre conferences on internals. That effort was meet with little success. This is not the case with the linux lustre client. We do have people contributing including you. So the reality is that if we removed the lustre client it would be at least 3+ years before the code would be ready to merged back in. It would be another 3+ years before it left staging. Many cleanups in the linux client which impact many lines of code have not been ported to the Intel branch. It would take forever to get those in. Honestly I gave up some time ago for those types of cleanups. The cleanups done in the upstream client would have to be redone. What we really need is to expand the community. Recently a lot of work has gone into supporting Ubuntu for our utilities. I hope this helps to get Canonical involved with the upstream lustre client.
The upstream client is not as bad as you think. A year ago no one in their right mind would touch the upstream client but their are actually sites using it today. Its not perfect but it is usable and it is improving all the time. Yes we have quite a few bugs to squash that show up in our test suite but the barrier to leaving staging is much much smaller than it used to be. Once the number of bugs reported in test suite becomes reasonable we can start auto testing patches posted here. The ultimate goal is that as more people join in the linux client effort and it becomes a full member of the broader linux open source community that we can leave the Intel lustre-release branch in the dust. I believe the future is much closer than you think.
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe
In reply to NeilBrownQuoted 25 lines · NeilBrown
drivers/staging/lustre/lustre/include/lustre_lmv.h struct lmv_stripe_md { · line 67
Quoted 13 lines · James Simmons
drivers/staging/lustre/lustre/include/lustre_lmv.h +12
-0+static inline bool +lsm_md_eq (const struct lmv_stripe_md *lsm1,const struct lmv_stripe_md *lsm2) +{ +int idx; + +if (lsm1->lsm_md_magic != lsm2->lsm_md_magic || + lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count || + lsm1->lsm_md_master_mdt_index != lsm2->lsm_md_master_mdt_index || + lsm1->lsm_md_hash_type != lsm2->lsm_md_hash_type || + lsm1->lsm_md_layout_version != lsm2->lsm_md_layout_version || + !strcmp (lsm1->lsm_md_pool_name, lsm2->lsm_md_pool_name)) +return false;Hi James and all,
This patch (8f18c8a48b736c2fin linux) is different from the corresponding patch in lustre-release (60e07b972114df).In that patch, the last clause in the 'if' condition is
(quoted diff) +2
-0+ strcmp(lsm1->lsm_md_pool_name, + lsm2->lsm_md_pool_name) != 0)
Quoted 2 lines
Whoever converted it to "!strcmp()" inverted the condition. This is a perfect example of why I absolutely *loathe* the "!strcmp()" construct!!
People think that "if (!strcmp()) " is prefered kernel style but it's not.
if (foo != NULL) {The != NULL is a double negative. I don't think it adds anything. Some kernel developers like this style because it's explicit about the type. I have never seen any bugs caused by this format or solved by this format. Anyway checkpatch complains.
if (ret != 0) {In this situation "ret" is not a number, it's an error code. The != 0 is a double negative and complicated to think about. Btw, I sort of prefer "if (ret)" to "if (ret < 0)", not because of style but it's easier for Smatch. No subsystems are totally consistent so the (by definition inconsistent) "if (ret < 0)" checks cause false positives in Smatch.
if (len != 0)
This is OK. "len" is a number.
if (strcmp(one, two) != 0) {With strcmp() I really prefer == 0 and != 0 because it works like this:
strcmp(one, two) == 0 --> means one == two
strcmp(one, two) < 0 --> means one < two
strcmp(one, two) != 0 --> means one != twoEither style is accepted in the kernel but I think == 0 just makes so much sense. I mostly see bugs from this when people are "fixing" the style from == 0 to !strcmp() so my sample is very biased. Normally, if the original author writes the code any bugs are caught in testing so either way is going to be bug free.
But the only thing that checkpatch complains about is == NULL and != NULL.
regards,
dan carpenter
PATCH 42/80 staging: lustre: llite: validate names
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
In ll_prep_md_op_data() validate names according to the same formula used in mdd_name_check(). Add mdc_pack_name() to validate the name actually packed in the request.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4992
Reviewed-on: http://review.whamcloud.com/10198
--- .../lustre/include/linux/libcfs/libcfs_private.h | 9 --- drivers/staging/lustre/lustre/include/lu_object.h | 16 +++++ drivers/staging/lustre/lustre/llite/llite_lib.c | 13 +++- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 67 +++++++++++++------- 4 files changed, 70 insertions(+), 35 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +0 -9
@@ -360,13 +360,4 @@ do { \ ptr +=cfs_size_round (len); \ } while (0) -#define LOGL0 (var, len, ptr) \ -do { \ - if (!len) \ - break; \ - memcpy((char *)ptr, (const char *)var, len); \ - *((char *)(ptr) + len) = 0; \ - ptr += cfs_size_round(len + 1); \ -} while (0) -#endif
drivers/staging/lustre/lustre/include/lu_object.h +16 -0
@@ -1263,6 +1263,22 @@ struct lu_name { };/** +* Validate names (path components) +* +* To be valid \a name must be non-empty, '\0' terminated of length \a +* name_len, and not contain '/'. The maximum length of a name (before +* say -ENAMETOOLONG will be returned) is really controlled by llite +* and the server. We only check for something insane coming from bad +* integer handling here. +*/ +static inline bool lu_name_is_valid_2 (const char *name,size_t name_len) +{ +return name && name_len >0 && name_len <INT_MAX && + name[name_len] =='\0' &&strlen (name) == name_len && + !memchr (name,'/' , name_len); +} + +/** * Common buffer structure to be passed around for various xattr_{s,g}et() * methods. */
drivers/staging/lustre/lustre/llite/llite_lib.c +11 -2
@@ -2304,8 +2304,17 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, const char *name, int namelen, int mode, __u32 opc, void *data) { - if (namelen > ll_i2sbi(i1)->ll_namelen) - return ERR_PTR(-ENAMETOOLONG); + if (!name) { + /* Do not reuse namelen for something else. */ + if (namelen) + return ERR_PTR(-EINVAL); + } else { +if (namelen >ll_i2sbi (i1)->ll_namelen) +return ERR_PTR (-ENAMETOOLONG ); + +if (!lu_name_is_valid_2 (name, namelen)) +return ERR_PTR (-EINVAL ); + }if (!op_data) op_data =kzalloc (sizeof (*op_data),GFP_NOFS );
drivers/staging/lustre/lustre/mdc/mdc_lib.c +43 -24
127 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 43/80 staging: lustre: llite: fix inconsistencies of root squash feature
In reply to James SimmonsFrom: Gregoire Pichon <[email protected]>
Root squash exhibits inconsistent behaviour on a client when enabled. If a file is not cached on the client, then root will get a permission denied error when accessing the file. When the file has recently been accessed by a regular user and is still in cache, root will be able to access the file without error because the permission check is only done by the client that isn't aware of root squash.
While the only real security benefit from root squash is to deny clients access to files owned by root itself, it also makes sense to treat file access on the client in a consistent manner regardless of whether the file is in cache or not.
This patch adds root squash settings to llite so that client is able to apply root squashing when it is relevant.
Configuration of MDT root squash settings will automatically be applied to llite config log as well.
Update cfs_str2num_check() routine by removing any modification of the specified string parameter. Since string can come from ls_str field of a lstr structure, this avoids inconsistent ls_len field.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1778
Reviewed-on: http://review.whamcloud.com/5700
--- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 2 - .../staging/lustre/lustre/include/lprocfs_status.h | 6 + drivers/staging/lustre/lustre/include/obd_class.h | 9 ++ drivers/staging/lustre/lustre/llite/file.c | 44 ++++++ .../staging/lustre/lustre/llite/llite_internal.h | 6 + drivers/staging/lustre/lustre/llite/llite_lib.c | 47 +++++++ drivers/staging/lustre/lustre/llite/lproc_llite.c | 68 ++++++++++ .../lustre/lustre/obdclass/lprocfs_status.c | 140 ++++++++++++++++++++ 8 files changed, 320 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/libcfs/libcfs_string.c +0 -2
@@ -229,8 +229,6 @@ cfs_str2num_check(char *str, int nob, unsigned *num,char *endp, cache;int rc; - str =cfs_trimwhite (str); -/** * kstrouint can only handle strings composed * of only numbers. We need to scan the string
drivers/staging/lustre/lustre/include/lprocfs_status.h +6 -0
@@ -681,6 +681,12 @@ static struct lustre_attr lustre_attr_##name = __ATTR(name, mode, show, store)extern const struct sysfs_ops lustre_sysfs_ops; +struct root_squash_info ; +int lprocfs_wr_root_squash (const char *buffer,unsigned long count, +struct root_squash_info *squash,char *name); +int lprocfs_wr_nosquash_nids (const char *buffer,unsigned long count, +struct root_squash_info *squash,char *name); +/* all quota proc functions */ int lprocfs_quota_rd_bunit(char *page, char **start, loff_t off, int count,
drivers/staging/lustre/lustre/include/obd_class.h +9 -0
@@ -1759,4 +1759,13 @@ extern spinlock_t obd_types_lock;/* prng.c */ #define ll_generate_random_uuid (uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t)) +/* root squash info */ +struct rw_semaphore ; +struct root_squash_info { +uid_t rsi_uid; +gid_t rsi_gid; +struct list_head rsi_nosquash_nids; +struct rw_semaphore rsi_sem; +}; +#endif /* __LINUX_OBD_CLASS_H */
drivers/staging/lustre/lustre/llite/file.c +44 -0
65 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +6 -0
@@ -412,6 +412,7 @@ enum stats_track_type {#define LL_SBI_LAYOUT_LOCK 0x20000/* layout lock support */ #define LL_SBI_USER_FID2PATH 0x40000/* allow fid2path by unprivileged users */ #define LL_SBI_XATTR_CACHE 0x80000/* support for xattr cache */ +#define LL_SBI_NOROOTSQUASH 0x100000/* do not apply root squash */ #define LL_SBI_FLAGS { \ "nolck", \
@@ -434,6 +435,7 @@ enum stats_track_type {"layout" , \"user_fid2path" ,\"xattr" , \ +"norootsquash" , \ } struct ll_sb_info {
@@ -500,6 +502,9 @@ struct ll_sb_info {dev_t ll_sdev_orig;/* save s_dev before assign for * clustered nfs */ +/* root squash */ +struct root_squash_info ll_squash; +__kernel_fsid_t ll_fsid;struct kobject ll_kobj;/* sysfs object */ struct super_block *ll_sb;/* struct super_block (for sysfs code)*/
@@ -798,6 +803,7 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,void ll_finish_md_op_data (struct md_op_data *op_data);int ll_get_obd_name (struct inode *inode,unsigned int cmd,unsigned long arg);char *ll_get_fsname (struct super_block *sb,char *buf,int buflen); +void ll_compute_rootsquash_state (struct ll_sb_info *sbi);void ll_open_cleanup (struct super_block *sb,struct ptlrpc_request *open_req);/* llite/llite_nfs.c */
drivers/staging/lustre/lustre/llite/llite_lib.c +47 -0
62 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/lproc_llite.c +68 -0
86 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +140 -0
146 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 44/80 staging: lustre: Remove static declaration in anonymous union
In reply to James SimmonsFrom: Christopher J. Morrone <[email protected]>
It is not permitted in C++ to have a static declaration inside of an anonymous union. The g++ compiler will complaine with an error like this:
error: struct ost_id::<anonymous union>::ostid invalid; an anonymous union can only have non-static data members [-fpermissive]
This patch changes the code to use an unnamed struct in place of "struct ostid" inside of the anonymous union. That name declaration was completely unnecessary anyway, since it was not used anywhere else.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4987
Reviewed-on: http://review.whamcloud.com/10176
--- .../lustre/lustre/include/lustre/lustre_user.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +1 -1
@@ -167,7 +167,7 @@ struct lustre_mdt_attrs {*/ struct ost_id {union { -struct ostid { +struct {__u64 oi_id;__u64 oi_seq; } oi;
Signature · 1 line
1.7.1
PATCH 45/80 staging: lustre: llite: Fix the deadlock in balance_dirty_pages()
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
If the page is already dirtied in ll_write_end() and kernel tries to call balance_dirty_pages() to write back dirty pages in the same thread, this is deadlock case if the page is already held by clio.
This can also fix the issue of LU-4873.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4977
Reviewed-on: http://review.whamcloud.com/10149
--- drivers/staging/lustre/lustre/llite/rw26.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/rw26.c +9 -3
@@ -506,9 +506,8 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, env = lcc->lcc_env; io = lcc->lcc_io; -if (likely (to ==PAGE_SIZE ))/* LU-4873 */ -/* To avoid deadlock, try to lock page first. */ - vmpage =grab_cache_page_nowait (mapping, index); +/* To avoid deadlock, try to lock page first. */ + vmpage =grab_cache_page_nowait (mapping, index);if (unlikely (!vmpage ||PageDirty (vmpage) ||PageWriteback (vmpage))) {struct vvp_io *vio =vvp_env_io (env);struct cl_page_list *plist = &vio->u.write.vui_queue;
@@ -617,6 +616,13 @@ static int ll_write_end(struct file *file, struct address_space *mapping,LASSERT (from ==0 ); vio->u.write.vui_to = from + copied; +/* +* To address the deadlock in balance_dirty_pages() where +* this dirty page may be written back in the same thread. +*/ +if (PageDirty (vmpage)) + unplug = true; +/* We may have one full RPC, commit it soon */ if (plist->pl_nr >=PTLRPC_MAX_BRW_PAGES ) unplug = true;
Signature · 1 line
1.7.1
PATCH 46/80 staging: lustre: llite: Change readdir BRW metrics
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
To simplify the code, change the metrics from bytes to pages.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5034
Reviewed-on: http://review.whamcloud.com/10275
--- drivers/staging/lustre/lustre/llite/dir.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +1 -1
@@ -148,7 +148,7 @@ static int ll_dir_filler(void *_hash, struct page *page0)struct page **page_pool;struct page *page;struct lu_dirpage *dp; -int max_pages =ll_i2sbi (inode)->ll_md_brw_size >>PAGE_SHIFT ; +int max_pages =ll_i2sbi (inode)->ll_md_brw_pages;int nrdpgs =0 ;/* number of pages read actually */ int npages;int i;
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -1
@@ -474,7 +474,7 @@ struct ll_sb_info {unsigned int ll_namelen;struct file_operations *ll_fop; -unsigned int ll_md_brw_size;/* used by readdir */ +unsigned int ll_md_brw_pages;/* readdir pages per RPC */ struct lu_site *ll_site;struct cl_device *ll_cl;
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -2
@@ -319,9 +319,9 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, sbi->ll_flags |=LL_SBI_64BIT_HASH ;if (data->ocd_connect_flags &OBD_CONNECT_BRW_SIZE ) - sbi->ll_md_brw_size = data->ocd_brw_size; + sbi->ll_md_brw_pages = data->ocd_brw_size >>PAGE_SHIFT ;else - sbi->ll_md_brw_size =PAGE_SIZE ; + sbi->ll_md_brw_pages =1 ;if (data->ocd_connect_flags &OBD_CONNECT_LAYOUTLOCK ) sbi->ll_flags |=LL_SBI_LAYOUT_LOCK ;
Signature · 1 line
1.7.1
PATCH 47/80 staging: lustre: uapi: reduce scope of lustre_idl.h
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Move the definition of OBD_OCD_VERSION() and similar macros from lustre_idl.h to lustre_ver.h. These macros are primarily used in comparisons to LUSTRE_VERSION_CODE which is defined in lustre_ver.h and so should be defined there as well. Move a few definitions (related to FIDs, quota and striping) from lustre_idl.h to lustre_user.h.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5065
Reviewed-on: http://review.whamcloud.com/10336
--- .../lustre/lustre/include/lustre/lustre_idl.h | 38 +------------------ .../lustre/lustre/include/lustre/lustre_user.h | 32 +++++++++++++++-- drivers/staging/lustre/lustre/include/lustre_ver.h | 13 +++++-- 3 files changed, 41 insertions(+), 42 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +2 -36
@@ -93,6 +93,7 @@/* Defn's shared with user-space. */ #include "lustre_user.h" #include "lustre_errno.h" +#include "../lustre_ver.h" /* * GENERAL STUFF
@@ -846,11 +847,6 @@ static inline bool fid_is_sane(const struct lu_fid *fid) fid_seq_is_rsvd(fid_seq(fid))); } -static inline bool fid_is_zero (const struct lu_fid *fid) -{ -return fid_seq (fid) ==0 &&fid_oid (fid) ==0 ; -} -void lustre_swab_lu_fid (struct lu_fid *fid);void lustre_swab_lu_seq_range (struct lu_seq_range *range);
@@ -1318,14 +1314,6 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);#define CLIENT_CONNECT_MDT_REQD (OBD_CONNECT_IBITS | OBD_CONNECT_FID | \ OBD_CONNECT_FULL20) -#define OBD_OCD_VERSION (major, minor, patch, fix) (((major)<<24) + \ - ((minor)<<16) + \ - ((patch)<<8) + (fix)) -#define OBD_OCD_VERSION_MAJOR (version) ((int)((version)>>24)&255) -#define OBD_OCD_VERSION_MINOR (version) ((int)((version)>>16)&255) -#define OBD_OCD_VERSION_PATCH (version) ((int)((version)>>8)&255) -#define OBD_OCD_VERSION_FIX (version) ((int)(version)&255) -/* This structure is used for both request and reply. * * If we eventually have separate connect data for different types, which we
@@ -1509,14 +1497,6 @@ enum obdo_flags {#define LOV_MAGIC_V1_DEF 0x0CD10BD0#define LOV_MAGIC_V3_DEF 0x0CD30BD0 -#define LOV_PATTERN_RAID0 0x001/* stripes are used round-robin */ -#define LOV_PATTERN_RAID1 0x002/* stripes are mirrors of each other */ -#define LOV_PATTERN_FIRST 0x100/* first stripe is not in round-robin */ -#define LOV_PATTERN_CMOBD 0x200 - -#define LOV_PATTERN_F_MASK 0xffff0000 -#define LOV_PATTERN_F_RELEASED 0x80000000/* HSM released file */ -#define lov_pattern (pattern) (pattern & ~LOV_PATTERN_F_MASK)#define lov_pattern_flags (pattern) (pattern & LOV_PATTERN_F_MASK)
@@ -1796,7 +1776,7 @@ void lustre_swab_obd_statfs(struct obd_statfs *os);* it to sync quickly */ -#define OBD_OBJECT_EOF 0xffffffffffffffffULL +#define OBD_OBJECT_EOF LUSTRE_EOF#define OST_MIN_PRECREATE 32#define OST_MAX_PRECREATE 20000
@@ -1892,12 +1872,6 @@ struct obd_quotactl {void lustre_swab_obd_quotactl (struct obd_quotactl *q); -#define Q_QUOTACHECK 0x800100/* deprecated as of 2.4 */ -#define Q_INITQUOTA 0x800101/* deprecated as of 2.4 */ -#define Q_GETOINFO 0x800102/* get obd quota info */ -#define Q_GETOQUOTA 0x800103/* get obd quotas */ -#define Q_FINVALIDATE 0x800104/* deprecated as of 2.4 */ -#define Q_COPY (out, in, member) (out)->member = (in)->member#define QCTL_COPY (out, in) \
@@ -2533,19 +2507,11 @@ struct lmv_mds_md_v1 {* for example the object is being migrated. And the hash function * might be interpreted differently with different flags. */ -enum lmv_hash_type { -LMV_HASH_TYPE_ALL_CHARS =1 , -LMV_HASH_TYPE_FNV_1A_64 =2 , -}; -#define LMV_HASH_TYPE_MASK 0x0000ffff#define LMV_HASH_FLAG_MIGRATION 0x80000000#define LMV_HASH_FLAG_DEAD 0x40000000 -#define LMV_HASH_NAME_ALL_CHARS "all_char" -#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64" -/** * The FNV-1a hash algorithm is as follows: * hash = FNV_offset_basis
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +29 -3
@@ -45,6 +45,8 @@#include "ll_fiemap.h" #include "../linux/lustre_user.h" +#define LUSTRE_EOF 0xffffffffffffffffULL +/* for statfs() */ #define LL_SUPER_MAGIC 0x0BD00BD0
@@ -117,6 +119,11 @@ struct lu_fid {__u32 f_ver; }; +static inline bool fid_is_zero (const struct lu_fid *fid) +{ +return !fid->f_seq && !fid->f_oid; +} +struct filter_fid {struct lu_fid ff_parent;/* ff_parent.f_ver == file stripe number */ };
@@ -271,9 +278,14 @@ struct ost_id {#define LMV_USER_MAGIC 0x0CD30CD0/*default lmv magic*/ -#define LOV_PATTERN_RAID0 0x001 -#define LOV_PATTERN_RAID1 0x002 -#define LOV_PATTERN_FIRST 0x100 +#define LOV_PATTERN_RAID0 0x001 +#define LOV_PATTERN_RAID1 0x002 +#define LOV_PATTERN_FIRST 0x100 +#define LOV_PATTERN_CMOBD 0x200 + +#define LOV_PATTERN_F_MASK 0xffff0000 +#define LOV_PATTERN_F_RELEASED 0x80000000/* HSM released file */ +#define LOV_MAXPOOLNAME 16#define LOV_POOLNAMEF "%.16s"
@@ -370,6 +382,14 @@ struct lmv_user_mds_data {__u32 lum_mds; }; +enum lmv_hash_type { +LMV_HASH_TYPE_ALL_CHARS =1 , +LMV_HASH_TYPE_FNV_1A_64 =2 , +}; + +#define LMV_HASH_NAME_ALL_CHARS "all_char" +#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64" +/* * Got this according to how get LOV_MAX_STRIPE_COUNT, see above, * (max buffer size - lmv+rpc header) / sizeof(struct lmv_user_mds_data)
@@ -488,6 +508,12 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen)/********* Quotas **********/ +#define Q_QUOTACHECK 0x800100/* deprecated as of 2.4 */ +#define Q_INITQUOTA 0x800101/* deprecated as of 2.4 */ +#define Q_GETOINFO 0x800102/* get obd quota info */ +#define Q_GETOQUOTA 0x800103/* get obd quotas */ +#define Q_FINVALIDATE 0x800104/* deprecated as of 2.4 */ +/* these must be explicitly translated into linux Q_* in ll_dir_ioctl */ #define LUSTRE_Q_QUOTAON 0x800002/* turn quotas on */ #define LUSTRE_Q_QUOTAOFF 0x800003/* turn quotas off */
drivers/staging/lustre/lustre/include/lustre_ver.h +10 -3
@@ -7,9 +7,16 @@#define LUSTRE_FIX 0#define LUSTRE_VERSION_STRING "2.4.60" -#define LUSTRE_VERSION_CODE OBD_OCD_VERSION(LUSTRE_MAJOR, \ - LUSTRE_MINOR, LUSTRE_PATCH, \ - LUSTRE_FIX) +#define OBD_OCD_VERSION (major, minor, patch, fix) \ + (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix)) + +#define OBD_OCD_VERSION_MAJOR (version) ((int)((version) >> 24) & 255) +#define OBD_OCD_VERSION_MINOR (version) ((int)((version) >> 16) & 255) +#define OBD_OCD_VERSION_PATCH (version) ((int)((version) >> 8) & 255) +#define OBD_OCD_VERSION_FIX (version) ((int)((version) >> 0) & 255) + +#define LUSTRE_VERSION_CODE \ + OBD_OCD_VERSION(LUSTRE_MAJOR, LUSTRE_MINOR, LUSTRE_PATCH, LUSTRE_FIX)/* * If lustre version of client and servers it connects to differs by more
Signature · 1 line
1.7.1
PATCH 48/80 staging: lustre: llite: a few fixes about readdir of striped dir.
In reply to James SimmonsFrom: wang di <[email protected]>
Normally we know the value of op_mea1 when ll_readdir is called. In the case of '.' or '..' op_mea1 is unknown so for that case fetch the real parents FID.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4603
Reviewed-on: http://review.whamcloud.com/9191
--- drivers/staging/lustre/lustre/llite/dir.c | 27 +++++++++++++++++ .../staging/lustre/lustre/llite/llite_internal.h | 1 + drivers/staging/lustre/lustre/llite/llite_nfs.c | 31 ++++++++++++++------ 3 files changed, 50 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +27 -0
@@ -622,6 +622,33 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) goto out; } +if (unlikely (op_data->op_mea1)) { +/* +* This is only needed for striped dir to fill .., +* see lmv_read_page +*/ +if (file_dentry (filp)->d_parent && +file_dentry (filp)->d_parent->d_inode) { +__u64 ibits =MDS_INODELOCK_UPDATE ; +struct inode *parent; + + parent =file_dentry (filp)->d_parent->d_inode; +if (ll_have_md_lock (parent, &ibits,LCK_MINMODE )) + op_data->op_fid3 = *ll_inode2fid (parent); + } + +/* +* If it can not find in cache, do lookup .. on the master +* object +*/ +if (fid_is_zero (&op_data->op_fid3)) { + rc =ll_dir_get_parent_fid (inode, &op_data->op_fid3); +if (rc) { +ll_finish_md_op_data (op_data); +return rc; + } + } + } ctx->pos = pos; rc =ll_dir_read (inode, &pos, op_data, ctx); pos = ctx->pos;
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -0
@@ -812,6 +812,7 @@ __u32 get_uuid2int(const char *name, int len);void get_uuid2fsid (const char *name,int len,__kernel_fsid_t *fsid);struct inode *search_inode_for_lustre (struct super_block *sb,const struct lu_fid *fid); +int ll_dir_get_parent_fid (struct inode *dir,struct lu_fid *parent_fid);/* llite/symlink.c */ extern const struct inode_operations ll_fast_symlink_inode_operations;
drivers/staging/lustre/lustre/llite/llite_nfs.c +22 -9
@@ -302,14 +302,12 @@ static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,return ll_iget_for_nfs (sb, &nfs_fid->lnf_parent,NULL ); } -static struct dentry *ll_get_parent (struct dentry *dchild) +int ll_dir_get_parent_fid (struct inode *dir,struct lu_fid *parent_fid) {struct ptlrpc_request *req =NULL ; -struct inode *dir =d_inode (dchild);struct ll_sb_info *sbi; -struct dentry *result =NULL ;struct mdt_body *body; -static char dotdot[] =".." ; +static const char dotdot[] =".." ;struct md_op_data *op_data;int rc;int lmmsize;
@@ -324,13 +322,13 @@ static struct dentry *ll_get_parent(struct dentry *dchild) rc =ll_get_default_mdsize (sbi, &lmmsize);if (rc !=0 ) -return ERR_PTR (rc); +return rc; op_data =ll_prep_md_op_data (NULL , dir,NULL , dotdot,strlen (dotdot), lmmsize,LUSTRE_OPC_ANY ,NULL );if (IS_ERR (op_data)) -return (void *)op_data; +return PTR_ERR (op_data); rc =md_getattr_name (sbi->ll_md_exp, op_data, &req);ll_finish_md_op_data (op_data);
@@ -338,7 +336,7 @@ static struct dentry *ll_get_parent(struct dentry *dchild)CERROR ("%s: failure inode " DFID " get parent: rc = %d\n" ,ll_get_fsname (dir->i_sb,NULL ,0 ),PFID (ll_inode2fid (dir)), rc); -return ERR_PTR (rc); +return rc; } body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY );/*
@@ -348,11 +346,26 @@ static struct dentry *ll_get_parent(struct dentry *dchild)if (body->valid &OBD_MD_FLID ) {CDEBUG (D_INFO ,"parent for " DFID " is " DFID "\n" ,PFID (ll_inode2fid (dir)),PFID (&body->fid1)); + *parent_fid = body->fid1; } - result =ll_iget_for_nfs (dir->i_sb, &body->fid1,NULL );ptlrpc_req_finished (req); -return result; +return 0 ; +} + +static struct dentry *ll_get_parent (struct dentry *dchild) +{ +struct lu_fid parent_fid = {0 }; +struct dentry *dentry; +int rc; + + rc =ll_dir_get_parent_fid (dchild->d_inode, &parent_fid); +if (rc) +return ERR_PTR (rc); + + dentry =ll_iget_for_nfs (dchild->d_inode->i_sb, &parent_fid,NULL ); + +return dentry; }const struct export_operations lustre_export_operations = {
Signature · 1 line
1.7.1
PATCH 49/80 staging: lustre: lmv: validate lock with correct stripe FID
In reply to James SimmonsFrom: wang di <[email protected]>
In ll_lookup_it_finish, we need use the real parent(stripe) FID to validate the parent UPDATE lock.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4925
Reviewed-on: http://review.whamcloud.com/10026
--- drivers/staging/lustre/lustre/include/obd.h | 5 +++++ drivers/staging/lustre/lustre/include/obd_class.h | 13 +++++++++++++ drivers/staging/lustre/lustre/llite/namei.c | 15 +++++++++++++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 19 ++++++++++++++++++- 4 files changed, 49 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/obd.h +5 -0
@@ -1103,6 +1103,11 @@ struct md_ops { ldlm_policy_data_t *, enum ldlm_mode, enum ldlm_cancel_flags flags, void *opaque); +int (*get_fid_from_lsm)(struct obd_export *, +const struct lmv_stripe_md *, +const char *name,int namelen, +struct lu_fid *fid); +int (*intent_getattr_async)(struct obd_export *,struct md_enqueue_info *,struct ldlm_enqueue_info *);
drivers/staging/lustre/lustre/include/obd_class.h +13 -0
@@ -1699,6 +1699,19 @@ static inline int md_revalidate_lock(struct obd_export *exp,return rc; } +static inline int md_get_fid_from_lsm (struct obd_export *exp, +const struct lmv_stripe_md *lsm, +const char *name,int namelen, +struct lu_fid *fid) +{ +int rc; + +EXP_CHECK_MD_OP (exp, get_fid_from_lsm); +EXP_MD_COUNTER_INCREMENT (exp, get_fid_from_lsm); + rc =MDP (exp->exp_obd, get_fid_from_lsm)(exp, lsm, name, namelen, fid); +return rc; +} +/* OBD Metadata Support */ int obd_init_caches (void );
drivers/staging/lustre/lustre/llite/namei.c +13 -2
@@ -487,9 +487,20 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request,struct lookup_intent parent_it = { .it_op =IT_GETATTR , .it_lock_handle =0 }; +struct lu_fid fid =ll_i2info (parent)->lli_fid; + +/* If it is striped directory, get the real stripe parent */ +if (unlikely (ll_i2info (parent)->lli_lsm_md)) { + rc =md_get_fid_from_lsm (ll_i2mdexp (parent), +ll_i2info (parent)->lli_lsm_md, + (*de)->d_name.name, + (*de)->d_name.len, &fid); +if (rc) +return rc; + } -if (md_revalidate_lock (ll_i2mdexp (parent), &parent_it, - &ll_i2info (parent)->lli_fid,NULL )) { +if (md_revalidate_lock (ll_i2mdexp (parent), &parent_it, &fid, +NULL )) {d_lustre_revalidate (*de);ll_intent_release (&parent_it); }
drivers/staging/lustre/lustre/lmv/lmv_obd.c +18 -1
@@ -2991,6 +2991,22 @@ static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,return rc; } +int lmv_get_fid_from_lsm (struct obd_export *exp, +const struct lmv_stripe_md *lsm, +const char *name,int namelen,struct lu_fid *fid) +{ +const struct lmv_oinfo *oinfo; + +LASSERT (lsm); + oinfo =lsm_name_to_stripe_info (lsm, name, namelen); +if (IS_ERR (oinfo)) +return PTR_ERR (oinfo); + + *fid = oinfo->lmo_fid; + +return 0 ; +} +/** * For lmv, only need to send request to master MDT, and the master MDT will * process with other slave MDTs. The only exception is Q_GETOQUOTA for which
@@ -3155,7 +3171,8 @@ static struct md_ops lmv_md_ops = { .set_open_replay_data = lmv_set_open_replay_data, .clear_open_replay_data = lmv_clear_open_replay_data, .intent_getattr_async = lmv_intent_getattr_async, - .revalidate_lock = lmv_revalidate_lock + .revalidate_lock = lmv_revalidate_lock, + .get_fid_from_lsm = lmv_get_fid_from_lsm, };static int __init lmv_init (void )
Signature · 1 line
1.7.1
PATCH 50/80 staging: lustre: lov: new pattern flag for partially repaired file
In reply to James SimmonsFrom: Fan Yong <[email protected]>
When the layout LFSCK repairs orphan OST-object, if the parent MDT-object was lost, then it will re-create the MDT-object and regenerate the LOV EA and fill the target LOV EA slot with the orphan information, and fill other slots with zero (LOV hole); if related LOV EA slot is invalid or hole, then it will refill the target LOV EA slot; if the target slot exceeds current LOV EA tail, then extend the LOV EA, and fill the gaps as zero.
Some of the LOV EA holes may cannot be re-filled finally because of lost some OST-objects. And even if they can be re-filled, but there are still some possible race accessings from client before the re-filling. If the client access the LOV EA with hole(s), it may cause some strange behaviour, such as trigger LBUG()/LASSERT() on the client.
So we will make the client to be aware of the LOV EA is incomplete. We introduce a new LOV EA pattern flag LOV_PATTERN_F_HOLE for that:
any time when the LFSCK repairs the LOV EA with hole(s), the LOV EA will be marked as LOV_PATTERN_F_HOLE; when all the holes in the LOV EA are refilled, the LOV_PATTERN_F_HOLE will be dropped.
For a new client, it recongizes the pattern flag LOV_PATTERN_F_HOLE, then it can permit/forbid some opertions on the file with LOV holes:
1) Normal read/write the file with LOV EA hole is permitted, but the application will get EIO error when read data from the dummy slot or write data to the dummy slot.
2) The users can dump the recovered data via some common read tools, such as "dd conv=sync,noerror".
3) Append data to the file which has LOV EA hole will get EIO failure.
4) Other operations will skip the LOV EA hole(s), and will not get failures, such as {s,g}etattr, {s,g}getxattr, stat, chown/chgrp, chmod, touch, unlink, and so on.
For an old client, since it will not recognize the new pattern flag LOV_PATTERN_F_HOLE. So the LOV EA with hole will be dicarded with failure, but it will not cause the client to be crashed.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4675
Reviewed-on: http://review.whamcloud.com/10042
--- .../lustre/lustre/include/lustre/lustre_idl.h | 1 + .../lustre/lustre/include/lustre/lustre_user.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- drivers/staging/lustre/lustre/lov/lov_io.c | 16 +++++++++++++--- .../lustre/lustre/obdclass/lprocfs_status.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 6 files changed, 20 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +1 -0
@@ -1289,6 +1289,7 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);#define OBD_CONNECT_OPEN_BY_FID 0x20000000000000ULL/* open by fid won't pack * name in request */ +#define OBD_CONNECT_LFSCK 0x40000000000000ULL/* support online LFSCK */ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +1 -1
@@ -284,9 +284,9 @@ struct ost_id {#define LOV_PATTERN_CMOBD 0x200#define LOV_PATTERN_F_MASK 0xffff0000 +#define LOV_PATTERN_F_HOLE 0x40000000/* there is hole in LOV EA */ #define LOV_PATTERN_F_RELEASED 0x80000000/* HSM released file */ -#define LOV_MAXPOOLNAME 16#define LOV_POOLNAMEF "%.16s"
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -189,7 +189,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,OBD_CONNECT_PINGLESS |OBD_CONNECT_MAX_EASIZE |OBD_CONNECT_FLOCK_DEAD | -OBD_CONNECT_DISP_STRIPE ; +OBD_CONNECT_DISP_STRIPE |OBD_CONNECT_LFSCK ;if (sbi->ll_flags &LL_SBI_SOM_PREVIEW ) data->ocd_connect_flags |=OBD_CONNECT_SOM ;
drivers/staging/lustre/lustre/lov/lov_io.c +13 -3
@@ -298,8 +298,8 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,return result; } -static void lov_io_slice_init (struct lov_io *lio, -struct lov_object *obj,struct cl_io *io) +static int lov_io_slice_init (struct lov_io *lio,struct lov_object *obj, +struct cl_io *io) { io->ci_result =0 ; lio->lis_object = obj;
@@ -314,6 +314,15 @@ static void lov_io_slice_init(struct lov_io *lio, lio->lis_io_endpos = lio->lis_endpos;if (cl_io_is_append (io)) {LASSERT (io->ci_type ==CIT_WRITE ); + +/* +* If there is LOV EA hole, then we may cannot locate +* the current file-tail exactly. +*/ +if (unlikely (obj->lo_lsm->lsm_pattern & +LOV_PATTERN_F_HOLE )) +return -EIO ; + lio->lis_pos =0 ; lio->lis_endpos =OBD_OBJECT_EOF ; }
@@ -349,6 +358,7 @@ static void lov_io_slice_init(struct lov_io *lio,default :LBUG (); } +return 0 ; }static void lov_io_fini (const struct lu_env *env,const struct cl_io_slice *ios)
@@ -870,7 +880,7 @@ int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj,struct lov_object *lov =cl2lov (obj);INIT_LIST_HEAD (&lio->lis_active); -lov_io_slice_init (lio, lov, io); + io->ci_result =lov_io_slice_init (lio, lov, io);if (io->ci_result ==0 ) { io->ci_result =lov_io_subio_init (env, lio, io);if (io->ci_result ==0 ) {
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +2 -0
@@ -97,6 +97,8 @@ static const char * const obd_connect_names[] = {"flock_deadlock" ,"disp_stripe" ,"unknown" , +"lfsck" , +"unknown" , NULL };
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +2 -0
@@ -1071,6 +1071,8 @@ void lustre_assert_wire_constants(void) "found 0x%.16llxULL\n", OBD_CONNECT_FLOCK_DEAD);LASSERTF (OBD_CONNECT_OPEN_BY_FID ==0x20000000000000ULL ,"found 0x%.16llxULL\n" ,OBD_CONNECT_OPEN_BY_FID ); +LASSERTF (OBD_CONNECT_LFSCK ==0x40000000000000ULL ,"found 0x%.16llxULL\n" , +OBD_CONNECT_LFSCK );LASSERTF (OBD_CKSUM_CRC32 ==0x00000001UL ,"found 0x%.8xUL\n" , (unsigned )OBD_CKSUM_CRC32 ); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
Signature · 1 line
1.7.1
PATCH 51/80 staging: lustre: lmv: Match MDT where the FID locates first
In reply to James SimmonsFrom: wang di <[email protected]>
With DNE every object can have two locks in different namespaces:
lookup lock in space of MDT storing direntry and update/open lock in space of MDT storing inode. In lmv_find_cbdata/lmv_lock_lock, it should try the MDT that the FID maps to first, since this can be easily found, and only try others if that fails.
In the error handler of lmv_add_targets, it should check whether ld_tgt_count is being increased before ld_tgt_count is being -1.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4098
Reviewed-on: http://review.whamcloud.com/8019
--- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 45 +++++++++++++----- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 57 +++++++++++++++------- 2 files changed, 73 insertions(+), 29 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_internal.h +33 -12
@@ -64,35 +64,56 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, int extra_lock_flags);static inline struct lmv_tgt_desc * -lmv_get_target (struct lmv_obd *lmv,u32 mds) +lmv_get_target (struct lmv_obd *lmv,u32 mdt_idx,int *index) { -int count = lmv->desc.ld_tgt_count;int i; -for (i =0 ; i < count; i++) { +for (i =0 ; i < lmv->desc.ld_tgt_count; i++) {if (!lmv->tgts[i])continue ; -if (lmv->tgts[i]->ltd_idx == mds) +if (lmv->tgts[i]->ltd_idx == mdt_idx) { +if (index) + *index = i;return lmv->tgts[i]; + } }return ERR_PTR (-ENODEV ); } -static inline struct lmv_tgt_desc * -lmv_find_target (struct lmv_obd *lmv,const struct lu_fid *fid) +static inline int +lmv_find_target_index (struct lmv_obd *lmv,const struct lu_fid *fid) { -u32 mds =0 ; -int rc; +struct lmv_tgt_desc *ltd; +u32 mdt_idx =0 ; +int index =0 ;if (lmv->desc.ld_tgt_count >1 ) { - rc =lmv_fld_lookup (lmv, fid, &mds); -if (rc) -return ERR_PTR (rc); +int rc; + + rc =lmv_fld_lookup (lmv, fid, &mdt_idx); +if (rc <0 ) +return rc; } -return lmv_get_target (lmv, mds); + ltd =lmv_get_target (lmv, mdt_idx, &index); +if (IS_ERR (ltd)) +return PTR_ERR (ltd); + +return index; +} + +static inline struct lmv_tgt_desc * +lmv_find_target (struct lmv_obd *lmv,const struct lu_fid *fid) +{ +int index; + + index =lmv_find_target_index (lmv, fid); +if (index <0 ) +return ERR_PTR (index); + +return lmv->tgts[index]; }static inline int lmv_stripe_md_size (int stripe_count)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +40 -17
116 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 52/80 staging: lustre: llite: use the correct mode for striped directory
In reply to James SimmonsFrom: wang di <[email protected]>
Create striped directory with correct mode, which should be handling same as mkdir.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4929
Reviewed-on: http://review.whamcloud.com/10028
--- drivers/staging/lustre/lustre/llite/dir.c | 40 +++++++++++++++++++--------- 1 files changed, 27 insertions(+), 13 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +27 -13
@@ -694,28 +694,40 @@ static int ll_send_mgc_param(struct obd_export *mgc, char *string)return rc; } -static int ll_dir_setdirstripe (struct inode *dir,struct lmv_user_md *lump, -const char *filename) +/** +* Create striped directory with specified stripe(@lump) +* +* param[in] parent the parent of the directory. +* param[in] lump the specified stripes. +* param[in] dirname the name of the directory. +* param[in] mode the specified mode of the directory. +* +* retval =0 if striped directory is being created successfully. +* <0 if the creation is failed. +*/ +static int ll_dir_setdirstripe (struct inode *parent,struct lmv_user_md *lump, +const char *dirname,umode_t mode) {struct ptlrpc_request *request =NULL ;struct md_op_data *op_data; -struct ll_sb_info *sbi =ll_i2sbi (dir); -int mode; +struct ll_sb_info *sbi =ll_i2sbi (parent);int err;if (unlikely (lump->lum_magic !=LMV_USER_MAGIC ))return -EINVAL ;CDEBUG (D_VFSTRACE ,"VFS Op:inode=" DFID "(%p) name %s stripe_offset %d, stripe_count: %u\n" , -PFID (ll_inode2fid (dir)), dir, filename, +PFID (ll_inode2fid (parent)), parent, dirname, (int )lump->lum_stripe_offset, lump->lum_stripe_count);if (lump->lum_magic !=cpu_to_le32 (LMV_USER_MAGIC ))lustre_swab_lmv_user_md (lump); - mode = (~current_umask () &0755 ) |S_IFDIR ; - op_data =ll_prep_md_op_data (NULL , dir,NULL , filename, -strlen (filename), mode,LUSTRE_OPC_MKDIR , +if (!IS_POSIXACL (parent) || !exp_connect_umask (ll_i2mdexp (parent))) + mode &= ~current_umask (); + mode = (mode & (S_IRWXUGO |S_ISVTX )) |S_IFDIR ; + op_data =ll_prep_md_op_data (NULL , parent,NULL , dirname, +strlen (dirname), mode,LUSTRE_OPC_MKDIR , lump);if (IS_ERR (op_data)) { err =PTR_ERR (op_data);
@@ -1379,6 +1391,7 @@ out_free:char *filename;int namelen =0 ;int lumlen =0 ; +umode_t mode;int len;int rc;
@@ -1412,11 +1425,12 @@ out_free: goto lmv_out_free; } -/** -* ll_dir_setdirstripe will be used to set dir stripe -* mdc_create--->mdt_reint_create (with dirstripe) -*/ - rc =ll_dir_setdirstripe (inode, lum, filename); +#if OBD_OCD_VERSION (2 ,9 ,50 ,0 ) >LUSTRE_VERSION_CODE + mode = data->ioc_type !=0 ? data->ioc_type :S_IRWXUGO ; +#else + mode = data->ioc_type; +#endif + rc =ll_dir_setdirstripe (inode, lum, filename, mode); lmv_out_free:obd_ioctl_freedata (buf, len);return rc;
Signature · 1 line
1.7.1
PATCH 53/80 staging: lustre: obd: rename lsr_padding to lsr_valid
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
Simple variable rename.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4345
Reviewed-on: http://review.whamcloud.com/10223
--- .../lustre/lustre/include/lustre/lustre_idl.h | 2 +- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 1 + drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +1 -1
@@ -3036,7 +3036,7 @@ struct llog_setattr64_rec {__u32 lsr_uid_h;__u32 lsr_gid;__u32 lsr_gid_h; -__u64 lsr_padding; +__u64 lsr_valid;struct llog_rec_tail lsr_tail; } __packed;
drivers/staging/lustre/lustre/obdclass/llog_swab.c +1 -0
@@ -224,6 +224,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec)__swab32s (&lsr->lsr_uid_h);__swab32s (&lsr->lsr_gid);__swab32s (&lsr->lsr_gid_h); +__swab64s (&lsr->lsr_valid); tail = &lsr->lsr_tail;break ; }
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +4 -4
@@ -3170,10 +3170,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_setattr64_rec, lsr_gid_h));LASSERTF ((int )sizeof (((struct llog_setattr64_rec *)0 )->lsr_gid_h) ==4 ,"found %lld\n" , (long long )(int )sizeof (((struct llog_setattr64_rec *)0 )->lsr_gid_h)); -LASSERTF ((int )offsetof(struct llog_setattr64_rec , lsr_padding) ==48 ,"found %lld\n" , - (long long )(int )offsetof(struct llog_setattr64_rec , lsr_padding)); -LASSERTF ((int )sizeof (((struct llog_setattr64_rec *)0 )->lsr_padding) ==8 ,"found %lld\n" , - (long long )(int )sizeof (((struct llog_setattr64_rec *)0 )->lsr_padding)); +LASSERTF ((int )offsetof(struct llog_setattr64_rec , lsr_valid) ==48 ,"found %lld\n" , + (long long )(int )offsetof(struct llog_setattr64_rec , lsr_valid)); +LASSERTF ((int )sizeof (((struct llog_setattr64_rec *)0 )->lsr_valid) ==8 ,"found %lld\n" , + (long long )(int )sizeof (((struct llog_setattr64_rec *)0 )->lsr_valid));LASSERTF ((int )offsetof(struct llog_setattr64_rec , lsr_tail) ==56 ,"found %lld\n" , (long long )(int )offsetof(struct llog_setattr64_rec , lsr_tail)); LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_tail) == 8, "found %lld\n",
Signature · 1 line
1.7.1
PATCH 54/80 staging: lustre: llite: set dir LOV xattr length variable
In reply to James SimmonsFrom: Hongchao Zhang <[email protected]>
the LOV xattr of directory could be either lov_user_md_v1 (size is 32) or lov_user_md_v3 (size is 48), then the actual size of the LOV xattr should be return.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5100
Reviewed-on: http://review.whamcloud.com/10453
--- drivers/staging/lustre/lustre/llite/xattr.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/llite/xattr.c +0 -8
@@ -379,14 +379,6 @@ static int ll_xattr_get(const struct xattr_handler *handler,if (!S_ISREG (inode->i_mode) && !S_ISDIR (inode->i_mode))return -ENODATA ; -if (size ==0 &&S_ISDIR (inode->i_mode)) { -/* XXX directory EA is fix for now, optimize to save -* RPC transfer -*/ - rc =sizeof (struct lov_user_md ); - goto out; - } - lsm =ccc_inode_lsm_get (inode);if (!lsm) {if (S_ISDIR (inode->i_mode)) {
Signature · 1 line
1.7.1
PATCH 55/80 staging: lustre: mdt: add mbo_ prefix to members of struct mdt_body
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Rename each member of struct mdt_body, adding the prefix mbo_.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/10202
--- .../lustre/lustre/include/lustre/lustre_idl.h | 74 +++--- drivers/staging/lustre/lustre/include/lustre_mdc.h | 14 +- drivers/staging/lustre/lustre/llite/dir.c | 30 +- drivers/staging/lustre/lustre/llite/file.c | 20 +- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 110 ++++---- drivers/staging/lustre/lustre/llite/llite_nfs.c | 6 +- drivers/staging/lustre/lustre/llite/namei.c | 44 ++-- drivers/staging/lustre/lustre/llite/statahead.c | 4 +- drivers/staging/lustre/lustre/llite/symlink.c | 6 +- drivers/staging/lustre/lustre/llite/xattr.c | 14 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 12 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 38 ++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 16 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 62 +++--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 32 ++-- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 4 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 52 ++-- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 56 ++-- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 268 ++++++++++---------- 20 files changed, 432 insertions(+), 432 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +37 -37
@@ -2097,43 +2097,43 @@ enum md_transient_state { };struct mdt_body { -struct lu_fid fid1; -struct lu_fid fid2; -struct lustre_handle handle; -__u64 valid; -__u64 size;/* Offset, in the case of MDS_READPAGE */ -__s64 mtime; -__s64 atime; -__s64 ctime; -__u64 blocks;/* XID, in the case of MDS_READPAGE */ -__u64 ioepoch; -__u64 t_state;/* transient file state defined in -* enum md_transient_state -* was "ino" until 2.4.0 -*/ -__u32 fsuid; -__u32 fsgid; -__u32 capability; -__u32 mode; -__u32 uid; -__u32 gid; -__u32 flags;/* from vfs for pin/unpin, LUSTRE_BFLAG close */ -__u32 rdev; -__u32 nlink;/* #bytes to read in the case of MDS_READPAGE */ -__u32 unused2;/* was "generation" until 2.4.0 */ -__u32 suppgid; -__u32 eadatasize; -__u32 aclsize; -__u32 max_mdsize; -__u32 max_cookiesize; -__u32 uid_h;/* high 32-bits of uid, for FUID */ -__u32 gid_h;/* high 32-bits of gid, for FUID */ -__u32 padding_5;/* also fix lustre_swab_mdt_body */ -__u64 padding_6; -__u64 padding_7; -__u64 padding_8; -__u64 padding_9; -__u64 padding_10; +struct lu_fid mbo_fid1; +struct lu_fid mbo_fid2; +struct lustre_handle mbo_handle; +__u64 mbo_valid; +__u64 mbo_size;/* Offset, in the case of MDS_READPAGE */ +__s64 mbo_mtime; +__s64 mbo_atime; +__s64 mbo_ctime; +__u64 mbo_blocks;/* XID, in the case of MDS_READPAGE */ +__u64 mbo_ioepoch; +__u64 mbo_t_state;/* transient file state defined in +* enum md_transient_state +* was "ino" until 2.4.0 +*/ +__u32 mbo_fsuid; +__u32 mbo_fsgid; +__u32 mbo_capability; +__u32 mbo_mode; +__u32 mbo_uid; +__u32 mbo_gid; +__u32 mbo_flags; +__u32 mbo_rdev; +__u32 mbo_nlink;/* #bytes to read in the case of MDS_READPAGE */ +__u32 mbo_unused2;/* was "generation" until 2.4.0 */ +__u32 mbo_suppgid; +__u32 mbo_eadatasize; +__u32 mbo_aclsize; +__u32 mbo_max_mdsize; +__u32 mbo_max_cookiesize; +__u32 mbo_uid_h;/* high 32-bits of uid, for FUID */ +__u32 mbo_gid_h;/* high 32-bits of gid, for FUID */ +__u32 mbo_padding_5;/* also fix lustre_swab_mdt_body */ +__u64 mbo_padding_6; +__u64 mbo_padding_7; +__u64 mbo_padding_8; +__u64 mbo_padding_9; +__u64 mbo_padding_10; };/* 216 */ void lustre_swab_mdt_body (struct mdt_body *b);
drivers/staging/lustre/lustre/include/lustre_mdc.h +7 -7
@@ -163,18 +163,18 @@ static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck,static inline void mdc_update_max_ea_from_body (struct obd_export *exp,struct mdt_body *body) { -if (body->valid &OBD_MD_FLMODEASIZE ) { +if (body->mbo_valid &OBD_MD_FLMODEASIZE ) {struct client_obd *cli = &exp->exp_obd->u.cli; -if (cli->cl_max_mds_easize < body->max_mdsize) { - cli->cl_max_mds_easize = body->max_mdsize; +if (cli->cl_max_mds_easize < body->mbo_max_mdsize) { + cli->cl_max_mds_easize = body->mbo_max_mdsize; cli->cl_default_mds_easize = -min_t (__u32, body->max_mdsize,PAGE_SIZE ); +min_t (__u32, body->mbo_max_mdsize,PAGE_SIZE ); } -if (cli->cl_max_mds_cookiesize < body->max_cookiesize) { - cli->cl_max_mds_cookiesize = body->max_cookiesize; +if (cli->cl_max_mds_cookiesize < body->mbo_max_cookiesize) { + cli->cl_max_mds_cookiesize = body->mbo_max_cookiesize; cli->cl_default_mds_cookiesize = -min_t (__u32, body->max_cookiesize,PAGE_SIZE ); +min_t (__u32, body->mbo_max_cookiesize,PAGE_SIZE ); } } }
drivers/staging/lustre/lustre/llite/dir.c +15 -15
@@ -188,8 +188,8 @@ static int ll_dir_filler(void *_hash, struct page *page0) }else if (rc ==0 ) { body =req_capsule_server_get (&request->rq_pill, &RMF_MDT_BODY );/* Checked by mdc_readpage() */ -if (body->valid &OBD_MD_FLSIZE ) -i_size_write (inode, body->size); +if (body->mbo_valid &OBD_MD_FLSIZE ) +i_size_write (inode, body->mbo_size); nrdpgs = (request->rq_bulk->bd_nob_transferred+PAGE_SIZE -1 ) >>PAGE_SHIFT ;
@@ -894,9 +894,9 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size, body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); - lmmsize = body->eadatasize; + lmmsize = body->mbo_eadatasize; -if (!(body->valid & (OBD_MD_FLEASIZE |OBD_MD_FLDIREA )) || +if (!(body->mbo_valid & (OBD_MD_FLEASIZE |OBD_MD_FLDIREA )) || lmmsize ==0 ) { rc = -ENODATA ; goto out;
@@ -1639,18 +1639,18 @@ skip_lmm:lstat_t st = {0 }; st.st_dev = inode->i_sb->s_dev; - st.st_mode = body->mode; - st.st_nlink = body->nlink; - st.st_uid = body->uid; - st.st_gid = body->gid; - st.st_rdev = body->rdev; - st.st_size = body->size; + st.st_mode = body->mbo_mode; + st.st_nlink = body->mbo_nlink; + st.st_uid = body->mbo_uid; + st.st_gid = body->mbo_gid; + st.st_rdev = body->mbo_rdev; + st.st_size = body->mbo_size; st.st_blksize =PAGE_SIZE ; - st.st_blocks = body->blocks; - st.st_atime = body->atime; - st.st_mtime = body->mtime; - st.st_ctime = body->ctime; - st.st_ino =cl_fid_build_ino (&body->fid1, + st.st_blocks = body->mbo_blocks; + st.st_atime = body->mbo_atime; + st.st_mtime = body->mbo_mtime; + st.st_ctime = body->mbo_ctime; + st.st_ino =cl_fid_build_ino (&body->mbo_fid1, sbi->ll_flags &LL_SBI_32BIT_API );
drivers/staging/lustre/lustre/llite/file.c +10 -10
@@ -200,7 +200,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,struct mdt_body *body; body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); -if (!(body->valid &OBD_MD_FLRELEASED )) +if (!(body->mbo_valid &OBD_MD_FLRELEASED )) rc = -EBUSY ; }
@@ -482,8 +482,8 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,struct mdt_body *body; body =req_capsule_server_get (&it->it_request->rq_pill, &RMF_MDT_BODY ); - och->och_fh = body->handle; - och->och_fid = body->fid1; + och->och_fh = body->mbo_handle; + och->och_fid = body->mbo_fid1; och->och_lease_handle.cookie = it->it_lock_handle; och->och_magic =OBD_CLIENT_HANDLE_MAGIC ; och->och_flags = it->it_flags;
@@ -511,7 +511,7 @@ static int ll_local_open(struct file *file, struct lookup_intent *it, body =req_capsule_server_get (&it->it_request->rq_pill, &RMF_MDT_BODY ); -ll_ioepoch_open (lli, body->ioepoch); +ll_ioepoch_open (lli, body->mbo_ioepoch); }LUSTRE_FPRIVATE (file) = fd;
@@ -1451,9 +1451,9 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); - lmmsize = body->eadatasize; + lmmsize = body->mbo_eadatasize; -if (!(body->valid & (OBD_MD_FLEASIZE |OBD_MD_FLDIREA )) || +if (!(body->mbo_valid & (OBD_MD_FLEASIZE |OBD_MD_FLDIREA )) || lmmsize ==0 ) { rc = -ENODATA ; goto out;
@@ -1484,13 +1484,13 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,*/ if (lmm->lmm_magic ==cpu_to_le32 (LOV_MAGIC_V1 )) {lustre_swab_lov_user_md_v1 ((struct lov_user_md_v1 *)lmm); -if (S_ISREG (body->mode)) +if (S_ISREG (body->mbo_mode))lustre_swab_lov_user_md_objects ( ((struct lov_user_md_v1 *)lmm)->lmm_objects, stripe_count); }else if (lmm->lmm_magic ==cpu_to_le32 (LOV_MAGIC_V3 )) {lustre_swab_lov_user_md_v3 ((struct lov_user_md_v3 *)lmm); -if (S_ISREG (body->mode)) +if (S_ISREG (body->mbo_mode))lustre_swab_lov_user_md_objects ( ((struct lov_user_md_v3 *)lmm)->lmm_objects, stripe_count);
@@ -2861,7 +2861,7 @@ int ll_get_fid_by_name(struct inode *parent, const char *name, goto out_req; }if (fid) - *fid = body->fid1; + *fid = body->mbo_fid1; out_req:ptlrpc_req_finished (req);return rc;
@@ -3583,7 +3583,7 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock) goto out; } - lmmsize = body->eadatasize; + lmmsize = body->mbo_eadatasize;if (lmmsize ==0 )/* empty layout */ { rc =0 ; goto out;
drivers/staging/lustre/lustre/llite/lcommon_cl.c +1 -1
@@ -154,7 +154,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)int result =0 ;int refcheck; -LASSERT (md->body->valid &OBD_MD_FLID ); +LASSERT (md->body->mbo_valid &OBD_MD_FLID );LASSERT (S_ISREG (inode->i_mode)); env =cl_env_get (&refcheck);
drivers/staging/lustre/lustre/llite/llite_lib.c +55 -55
212 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_nfs.c +3 -3
@@ -343,10 +343,10 @@ int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid)* LU-3952: MDT may lost the FID of its parent, we should not crash * the NFS server, ll_iget_for_nfs() will handle the error. */ -if (body->valid &OBD_MD_FLID ) { +if (body->mbo_valid &OBD_MD_FLID ) {CDEBUG (D_INFO ,"parent for " DFID " is " DFID "\n" , -PFID (ll_inode2fid (dir)),PFID (&body->fid1)); - *parent_fid = body->fid1; +PFID (ll_inode2fid (dir)),PFID (&body->mbo_fid1)); + *parent_fid = body->mbo_fid1; }ptlrpc_req_finished (req);
drivers/staging/lustre/lustre/llite/namei.c +22 -22
114 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/statahead.c +2 -2
@@ -632,7 +632,7 @@ static void ll_post_statahead(struct ll_statahead_info *sai)/* XXX: No fid in reply, this is probably cross-ref case. * SA can't handle it yet. */ -if (body->valid &OBD_MD_MDS ) { +if (body->mbo_valid &OBD_MD_MDS ) { rc = -EAGAIN ; goto out; }
@@ -641,7 +641,7 @@ static void ll_post_statahead(struct ll_statahead_info *sai)* revalidate. */ /* unlinked and re-created with the same name */ -if (unlikely (!lu_fid_eq (&minfo->mi_data.op_fid2, &body->fid1))) { +if (unlikely (!lu_fid_eq (&minfo->mi_data.op_fid2, &body->mbo_fid1))) { entry->se_inode =NULL ;iput (child); child =NULL ;
drivers/staging/lustre/lustre/llite/symlink.c +3 -3
@@ -80,17 +80,17 @@ static int ll_readlink_internal(struct inode *inode, } body =req_capsule_server_get (&(*request)->rq_pill, &RMF_MDT_BODY ); -if ((body->valid &OBD_MD_LINKNAME ) ==0 ) { +if ((body->mbo_valid &OBD_MD_LINKNAME ) ==0 ) {CERROR ("OBD_MD_LINKNAME not set on reply\n" ); rc = -EPROTO ; goto failed; }LASSERT (symlen !=0 ); -if (body->eadatasize != symlen) { +if (body->mbo_eadatasize != symlen) {CERROR ("%s: inode " DFID ": symlink length %d not expected %d\n" ,ll_get_fsname (inode->i_sb,NULL ,0 ), -PFID (ll_inode2fid (inode)), body->eadatasize -1 , +PFID (ll_inode2fid (inode)), body->mbo_eadatasize -1 , symlen -1 ); rc = -EPROTO ; goto failed;
drivers/staging/lustre/lustre/llite/xattr.c +7 -7
@@ -263,32 +263,32 @@ getxattr_nocache:/* only detect the xattr size */ if (size ==0 ) { - rc = body->eadatasize; + rc = body->mbo_eadatasize; goto out; } -if (size < body->eadatasize) { +if (size < body->mbo_eadatasize) {CERROR ("server bug: replied size %u > %u\n" , - body->eadatasize, (int )size); + body->mbo_eadatasize, (int )size); rc = -ERANGE ; goto out; } -if (body->eadatasize ==0 ) { +if (body->mbo_eadatasize ==0 ) { rc = -ENODATA ; goto out; }/* do not need swab xattr data */ xdata =req_capsule_server_sized_get (&req->rq_pill, &RMF_EADATA , - body->eadatasize); + body->mbo_eadatasize);if (!xdata) { rc = -EFAULT ; goto out; } -memcpy (buffer, xdata, body->eadatasize); - rc = body->eadatasize; +memcpy (buffer, xdata, body->mbo_eadatasize); + rc = body->mbo_eadatasize; } out_xattr:
drivers/staging/lustre/lustre/llite/xattr_cache.c +6 -6
@@ -380,25 +380,25 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) }/* do not need swab xattr data */ xdata =req_capsule_server_sized_get (&req->rq_pill, &RMF_EADATA , - body->eadatasize); + body->mbo_eadatasize); xval =req_capsule_server_sized_get (&req->rq_pill, &RMF_EAVALS , - body->aclsize); + body->mbo_aclsize); xsizes =req_capsule_server_sized_get (&req->rq_pill, &RMF_EAVALS_LENS , - body->max_mdsize *sizeof (__u32)); + body->mbo_max_mdsize *sizeof (__u32));if (!xdata || !xval || !xsizes) {CERROR ("wrong setxattr reply\n" ); rc = -EPROTO ; goto out_destroy; } - xtail = xdata + body->eadatasize; - xvtail = xval + body->aclsize; + xtail = xdata + body->mbo_eadatasize; + xvtail = xval + body->mbo_aclsize;CDEBUG (D_CACHE ,"caching: xdata=%p xtail=%p\n" , xdata, xtail);ll_xattr_cache_init (lli); -for (i =0 ; i < body->max_mdsize; i++) { +for (i =0 ; i < body->mbo_max_mdsize; i++) {CDEBUG (D_CACHE ,"caching [%s]=%.*s\n" , xdata, *xsizes, xval);/* Perform consistency checks: attr names and vals in pill */ if (!memchr (xdata,0 , xtail - xdata)) {
drivers/staging/lustre/lustre/lmv/lmv_intent.c +19 -19
@@ -69,7 +69,7 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,if (!body)return -EPROTO ; -LASSERT ((body->valid &OBD_MD_MDS )); +LASSERT ((body->mbo_valid &OBD_MD_MDS ));/* * Unfortunately, we have to lie to MDC/MDS to retrieve
@@ -88,9 +88,9 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm, it->it_request =NULL ; } -LASSERT (fid_is_sane (&body->fid1)); +LASSERT (fid_is_sane (&body->mbo_fid1)); - tgt =lmv_find_target (lmv, &body->fid1); + tgt =lmv_find_target (lmv, &body->mbo_fid1);if (IS_ERR (tgt)) { rc =PTR_ERR (tgt); goto out;
@@ -102,7 +102,7 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm, goto out; } - op_data->op_fid1 = body->fid1; + op_data->op_fid1 = body->mbo_fid1;/* Sent the parent FID to the remote MDT */ if (parent_fid) {/* The parent fid is only for remote open to
@@ -114,12 +114,12 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,/* Add object FID to op_fid3, in case it needs to check stale * (M_CHECK_STALE), see mdc_finish_intent_lock */ - op_data->op_fid3 = body->fid1; + op_data->op_fid3 = body->mbo_fid1; } op_data->op_bias =MDS_CROSS_REF ;CDEBUG (D_INODE ,"REMOTE_INTENT with fid=" DFID " -> mds #%d\n" , -PFID (&body->fid1), tgt->ltd_idx); +PFID (&body->mbo_fid1), tgt->ltd_idx); rc =md_intent_lock (tgt->ltd_exp, op_data, lmm, lmmsize, it, flags, &req, cb_blocking, extra_lock_flags);
@@ -227,9 +227,9 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, &RMF_MDT_BODY);LASSERT (body); -if (unlikely (body->nlink <2 )) { +if (unlikely (body->mbo_nlink <2 )) {CERROR ("%s: nlink %d < 2 corrupt stripe %d " DFID ":" DFID "\n" , - obd->obd_name, body->nlink, i, + obd->obd_name, body->mbo_nlink, i,PFID (&lsm->lsm_md_oinfo[i].lmo_fid),PFID (&lsm->lsm_md_oinfo[0 ].lmo_fid));
@@ -245,11 +245,11 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, goto cleanup; } -i_size_write (inode, body->size); -set_nlink (inode, body->nlink); -LTIME_S (inode->i_atime) = body->atime; -LTIME_S (inode->i_ctime) = body->ctime; -LTIME_S (inode->i_mtime) = body->mtime; +i_size_write (inode, body->mbo_size); +set_nlink (inode, body->mbo_nlink); +LTIME_S (inode->i_atime) = body->mbo_atime; +LTIME_S (inode->i_ctime) = body->mbo_ctime; +LTIME_S (inode->i_mtime) = body->mbo_mtime;if (req)ptlrpc_req_finished (req);
@@ -288,9 +288,9 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, PFID(&lsm->lsm_md_oinfo[0].lmo_fid));if (mbody) { - mbody->atime = atime; - mbody->ctime = ctime; - mbody->mtime = mtime; + mbody->mbo_atime = atime; + mbody->mbo_ctime = ctime; + mbody->mbo_mtime = mtime; } cleanup:kfree (op_data);
@@ -360,7 +360,7 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,if (rc !=0 )return rc;/* -* Nothing is found, do not access body->fid1 as it is zero and thus +* Nothing is found, do not access body->mbo_fid1 as it is zero and thus * pointless. */ if ((it->it_disposition & DISP_LOOKUP_NEG) &&
@@ -373,7 +373,7 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,return -EPROTO ;/* Not cross-ref case, just get out of here. */ -if (unlikely ((body->valid &OBD_MD_MDS ))) { +if (unlikely ((body->mbo_valid &OBD_MD_MDS ))) { rc =lmv_intent_remote (exp, lmm, lmmsize, it, &op_data->op_fid1, flags, reqp, cb_blocking, extra_lock_flags);
@@ -470,7 +470,7 @@ static int lmv_intent_lookup(struct obd_export *exp,return -EPROTO ;/* Not cross-ref case, just get out of here. */ -if (unlikely ((body->valid &OBD_MD_MDS ))) { +if (unlikely ((body->mbo_valid &OBD_MD_MDS ))) { rc =lmv_intent_remote (exp, lmm, lmmsize, it,NULL , flags, reqp, cb_blocking, extra_lock_flags);if (rc !=0 )
drivers/staging/lustre/lustre/lmv/lmv_obd.c +8 -8
@@ -1813,11 +1813,11 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo, body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); -if (!(body->valid &OBD_MD_MDS )) +if (!(body->mbo_valid &OBD_MD_MDS ))return 0 ;CDEBUG (D_INODE ,"REMOTE_ENQUEUE '%s' on " DFID " -> " DFID "\n" , -LL_IT2STR (it),PFID (&op_data->op_fid1),PFID (&body->fid1)); +LL_IT2STR (it),PFID (&op_data->op_fid1),PFID (&body->mbo_fid1));/* * We got LOOKUP lock, but we really need attrs.
@@ -1827,7 +1827,7 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo,memcpy (&plock, lockh,sizeof (plock)); it->it_lock_mode =0 ; it->it_request =NULL ; - fid1 = body->fid1; + fid1 = body->mbo_fid1;ptlrpc_req_finished (req);
@@ -1917,8 +1917,8 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data,return rc; body =req_capsule_server_get (&(*preq)->rq_pill, &RMF_MDT_BODY ); -if (body->valid &OBD_MD_MDS ) { -struct lu_fid rid = body->fid1; +if (body->mbo_valid &OBD_MD_MDS ) { +struct lu_fid rid = body->mbo_fid1;CDEBUG (D_INODE ,"Request attrs for " DFID "\n" ,PFID (&rid));
@@ -2433,11 +2433,11 @@ retry:return -EPROTO ;/* Not cross-ref case, just get out of here. */ -if (likely (!(body->valid &OBD_MD_MDS ))) +if (likely (!(body->mbo_valid &OBD_MD_MDS )))return 0 ;CDEBUG (D_INODE ,"%s: try unlink to another MDT for " DFID "\n" , - exp->exp_obd->obd_name,PFID (&body->fid1)); + exp->exp_obd->obd_name,PFID (&body->mbo_fid1));/* This is a remote object, try remote MDT, Note: it may * try more than 1 time here, Considering following case
@@ -2459,7 +2459,7 @@ retry:* In theory, it might try unlimited time here, but it should * be very rare case. */ - op_data->op_fid2 = body->fid1; + op_data->op_fid2 = body->mbo_fid1;ptlrpc_req_finished (*request); *request =NULL ;
drivers/staging/lustre/lustre/mdc/mdc_lib.c +31 -31
107 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_locks.c +16 -16
@@ -240,12 +240,12 @@ static void mdc_realloc_openmsg(struct ptlrpc_request *req,/* FIXME: remove this explicit offset. */ rc =sptlrpc_cli_enlarge_reqbuf (req,DLM_INTENT_REC_OFF +4 , - body->eadatasize); + body->mbo_eadatasize);if (rc) {CERROR ("Can't enlarge segment %d size to %d\n" , -DLM_INTENT_REC_OFF +4 , body->eadatasize); - body->valid &= ~OBD_MD_FLEASIZE ; - body->eadatasize =0 ; +DLM_INTENT_REC_OFF +4 , body->mbo_eadatasize); + body->mbo_valid &= ~OBD_MD_FLEASIZE ; + body->mbo_eadatasize =0 ; } }
@@ -608,7 +608,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,mdc_set_open_replay_data (NULL ,NULL , it); } -if ((body->valid & (OBD_MD_FLDIREA |OBD_MD_FLEASIZE )) !=0 ) { +if ((body->mbo_valid & (OBD_MD_FLDIREA |OBD_MD_FLEASIZE )) !=0 ) {void *eadata;mdc_update_max_ea_from_body (exp, body);
@@ -618,7 +618,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,* Eventually, obd_unpackmd() will check the contents. */ eadata =req_capsule_server_sized_get (pill, &RMF_MDT_MD , - body->eadatasize); + body->mbo_eadatasize);if (!eadata)return -EPROTO ;
@@ -626,7 +626,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,* lock */ lvb_data = eadata; - lvb_len = body->eadatasize; + lvb_len = body->mbo_eadatasize;/* * We save the reply LOV EA in case we have to replay a
@@ -642,20 +642,20 @@ static int mdc_finish_enqueue(struct obd_export *exp,if (req_capsule_get_size (pill, &RMF_EADATA ,RCL_CLIENT ) < - body->eadatasize) + body->mbo_eadatasize)mdc_realloc_openmsg (req, body);else req_capsule_shrink (pill, &RMF_EADATA , - body->eadatasize, + body->mbo_eadatasize,RCL_CLIENT );req_capsule_set_size (pill, &RMF_EADATA ,RCL_CLIENT , - body->eadatasize); + body->mbo_eadatasize); lmm =req_capsule_client_get (pill, &RMF_EADATA );if (lmm) -memcpy (lmm, eadata, body->eadatasize); +memcpy (lmm, eadata, body->mbo_eadatasize); } } }else if (it->it_op &IT_LAYOUT ) {
@@ -935,11 +935,11 @@ static int mdc_finish_intent_lock(struct obd_export *exp,* op_fid3 - existent fid - if file only open. * op_fid3 is saved in lmv_intent_open */ -if ((!lu_fid_eq (&op_data->op_fid2, &mdt_body->fid1)) && - (!lu_fid_eq (&op_data->op_fid3, &mdt_body->fid1))) { +if ((!lu_fid_eq (&op_data->op_fid2, &mdt_body->mbo_fid1)) && + (!lu_fid_eq (&op_data->op_fid3, &mdt_body->mbo_fid1))) {CDEBUG (D_DENTRY ,"Found stale data " DFID "(" DFID ")/" DFID "\n" ,PFID (&op_data->op_fid2), -PFID (&op_data->op_fid2),PFID (&mdt_body->fid1)); +PFID (&op_data->op_fid2),PFID (&mdt_body->mbo_fid1));return -ESTALE ; } }
@@ -986,10 +986,10 @@ static int mdc_finish_intent_lock(struct obd_export *exp,LDLM_DEBUG (lock,"matching against this" ); -LASSERTF (fid_res_name_eq (&mdt_body->fid1, +LASSERTF (fid_res_name_eq (&mdt_body->mbo_fid1, &lock->l_resource->lr_name),"Lock res_id: " DLDLMRES ", fid: " DFID "\n" , -PLDLMRES (lock->l_resource),PFID (&mdt_body->fid1)); +PLDLMRES (lock->l_resource),PFID (&mdt_body->mbo_fid1));LDLM_LOCK_PUT (lock);memcpy (&old_lock, lockh,sizeof (*lockh));
drivers/staging/lustre/lustre/mdc/mdc_reint.c +2 -2
@@ -177,8 +177,8 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, epoch =req_capsule_client_get (&req->rq_pill, &RMF_MDT_EPOCH ); body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); - epoch->handle = body->handle; - epoch->ioepoch = body->ioepoch; + epoch->handle = body->mbo_handle; + epoch->ioepoch = body->mbo_ioepoch; req->rq_replay_cb = mdc_replay_open;/** bug 3633, open may be committed and estale answer is not error */ }else if (rc == -ESTALE && (op_data->op_flags &MF_SOM_CHANGE )) {
drivers/staging/lustre/lustre/mdc/mdc_request.c +26 -26
154 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +28 -28
63 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +134 -134
287 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 56/80 staging: lustre: clio: Reduce memory overhead of per-page allocation
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
A page in clio used to occupy 584 bytes, which will use size-1024 slab cache. This patch reduces the per-page overhead to 512 bytes so it can use size-512 instead.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4793
Reviewed-on: http://review.whamcloud.com/10070
--- drivers/staging/lustre/lustre/include/cl_object.h | 37 +++++--------------- drivers/staging/lustre/lustre/llite/vvp_internal.h | 6 ++-- .../staging/lustre/lustre/lov/lov_cl_internal.h | 4 +- drivers/staging/lustre/lustre/lov/lov_io.c | 6 +-- drivers/staging/lustre/lustre/lov/lov_page.c | 1 + drivers/staging/lustre/lustre/obdclass/cl_io.c | 10 +----- drivers/staging/lustre/lustre/obdclass/cl_page.c | 12 +----- drivers/staging/lustre/lustre/osc/osc_internal.h | 1 - drivers/staging/lustre/lustre/osc/osc_io.c | 7 +++- drivers/staging/lustre/lustre/osc/osc_request.c | 6 --- 10 files changed, 26 insertions(+), 64 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +9 -28
@@ -690,17 +690,6 @@ enum cl_page_type { };/** -* Flags maintained for every cl_page. -*/ -enum cl_page_flags { -/** -* Set when pagein completes. Used for debugging (read completes at -* most once for a page). -*/ -CPF_READ_COMPLETED =1 <<0 -}; - -/** * Fields are protected by the lock on struct page, except for atomics and * immutables. *
@@ -712,26 +701,23 @@ enum cl_page_flags {struct cl_page {/** Reference counter. */ atomic_t cp_ref; +/** Transfer error. */ +int cp_error;/** An object this page is a part of. Immutable after creation. */ struct cl_object *cp_obj; -/** List of slices. Immutable after creation. */ -struct list_head cp_layers;/** vmpage */ struct page *cp_vmpage; +/** Linkage of pages within group. Pages must be owned */ +struct list_head cp_batch; +/** List of slices. Immutable after creation. */ +struct list_head cp_layers; +/** Linkage of pages within cl_req. */ +struct list_head cp_flight;/** * Page state. This field is const to avoid accidental update, it is * modified only internally within cl_page.c. Protected by a VM lock. */ const enum cl_page_state cp_state; -/** Linkage of pages within group. Protected by cl_page::cp_mutex. */ -struct list_head cp_batch; -/** Mutex serializing membership of a page in a batch. */ -struct mutex cp_mutex; -/** Linkage of pages within cl_req. */ -struct list_head cp_flight; -/** Transfer error. */ -int cp_error; -/** * Page type. Only CPT_TRANSIENT is used so far. Immutable after * creation.
@@ -744,10 +730,6 @@ struct cl_page {*/ struct cl_io *cp_owner;/** -* Debug information, the task is owning the page. -*/ -struct task_struct *cp_task; -/** * Owning IO request in cl_page_state::CPS_PAGEOUT and * cl_page_state::CPS_PAGEIN states. This field is maintained only in * the top-level pages. Protected by a VM lock.
@@ -759,8 +741,6 @@ struct cl_page {struct lu_ref_link cp_obj_ref;/** Link to a queue, for debugging. */ struct lu_ref_link cp_queue_ref; -/** Per-page flags from enum cl_page_flags. Protected by a VM lock. */ -unsigned cp_flags;/** Assigned if doing a sync_io */ struct cl_sync_io *cp_sync_io; };
@@ -2200,6 +2180,7 @@ static inline void cl_object_page_init(struct cl_object *clob, int size) { clob->co_slice_off =cl_object_header (clob)->coh_page_bufsize;cl_object_header (clob)->coh_page_bufsize +=cfs_size_round (size); +WARN_ON (cl_object_header (clob)->coh_page_bufsize >512 ); } static inline void *cl_object_page_slice(struct cl_object *clob,
drivers/staging/lustre/lustre/llite/vvp_internal.h +3 -3
@@ -247,9 +247,9 @@ struct vvp_object {*/ struct vvp_page {struct cl_page_slice vpg_cl; -int vpg_defer_uptodate; -int vpg_ra_used; -int vpg_write_queued; +unsigned int vpg_defer_uptodate:1 , + vpg_ra_used:1 , + vpg_write_queued:1 ;/** * Non-empty iff this page is already counted in * vvp_object::vob_pending_list. This list is only used as a flag,
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +2 -2
@@ -289,8 +289,8 @@ struct lov_lock { };struct lov_page { -struct cl_page_slice lps_cl; -int lps_invalid; +struct cl_page_slice lps_cl; +unsigned int lps_stripe;/* stripe index */ };/*
drivers/staging/lustre/lustre/lov/lov_io.c +2 -4
@@ -244,14 +244,12 @@ void lov_sub_put(struct lov_io_sub *sub)int lov_page_stripe (const struct cl_page *page) { -struct lovsub_object *subobj;const struct cl_page_slice *slice; - slice =cl_page_at (page, &lovsub_device_type); + slice =cl_page_at (page, &lov_device_type);LASSERT (slice->cpl_obj); - subobj =cl2lovsub (slice->cpl_obj); -return subobj->lso_index; +return cl2lov_page (slice)->lps_stripe; } struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
drivers/staging/lustre/lustre/lov/lov_page.c +1 -0
@@ -129,6 +129,7 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj, rc =lov_stripe_offset (loo->lo_lsm, offset, stripe, &suboff);LASSERT (rc ==0 ); + lpg->lps_stripe = stripe;cl_page_slice_add (page, &lpg->lps_cl, obj, index, &lov_raid0_page_ops); sub =lov_sub_get (env, lio, stripe);
drivers/staging/lustre/lustre/obdclass/cl_io.c +1 -9
@@ -859,9 +859,6 @@ void cl_page_list_add(struct cl_page_list *plist, struct cl_page *page)LASSERT (page->cp_owner);LINVRNT (plist->pl_owner == current); -lockdep_off (); -mutex_lock (&page->cp_mutex); -lockdep_on ();LASSERT (list_empty (&page->cp_batch));list_add_tail (&page->cp_batch, &plist->pl_pages); ++plist->pl_nr;
@@ -877,12 +874,10 @@ void cl_page_list_del(const struct lu_env *env, struct cl_page_list *plist, struct cl_page *page) {LASSERT (plist->pl_nr >0 ); +LASSERT (cl_page_is_vmlocked (env, page));LINVRNT (plist->pl_owner == current);list_del_init (&page->cp_batch); -lockdep_off (); -mutex_unlock (&page->cp_mutex); -lockdep_on (); --plist->pl_nr;lu_ref_del_at (&page->cp_reference, &page->cp_queue_ref,"queue" , plist);cl_page_put (env, page);
@@ -959,9 +954,6 @@ void cl_page_list_disown(const struct lu_env *env,LASSERT (plist->pl_nr >0 );list_del_init (&page->cp_batch); -lockdep_off (); -mutex_unlock (&page->cp_mutex); -lockdep_on (); --plist->pl_nr;/* * cl_page_disown0 rather than usual cl_page_disown() is used,
drivers/staging/lustre/lustre/obdclass/cl_page.c +2 -10
@@ -151,7 +151,6 @@ struct cl_page *cl_page_alloc(const struct lu_env *env,INIT_LIST_HEAD (&page->cp_layers);INIT_LIST_HEAD (&page->cp_batch);INIT_LIST_HEAD (&page->cp_flight); -mutex_init (&page->cp_mutex);lu_ref_init (&page->cp_reference); head = o->co_lu.lo_header;list_for_each_entry (o, &head->loh_layers, co_lu.lo_linkage) {
@@ -478,7 +477,6 @@ static void cl_page_owner_clear(struct cl_page *page)LASSERT (page->cp_owner->ci_owned_nr >0 ); page->cp_owner->ci_owned_nr--; page->cp_owner =NULL ; - page->cp_task =NULL ; } }
@@ -562,7 +560,6 @@ static int cl_page_own0(const struct lu_env *env, struct cl_io *io,PASSERT (env, pg, !pg->cp_owner);PASSERT (env, pg, !pg->cp_req); pg->cp_owner =cl_io_top (io); - pg->cp_task = current;cl_page_owner_set (pg);if (pg->cp_state !=CPS_FREEING ) {cl_page_state_set (env, pg,CPS_OWNED );
@@ -619,7 +616,6 @@ void cl_page_assume(const struct lu_env *env,cl_page_invoid (env, io, pg,CL_PAGE_OP (cpo_assume));PASSERT (env, pg, !pg->cp_owner); pg->cp_owner =cl_io_top (io); - pg->cp_task = current;cl_page_owner_set (pg);cl_page_state_set (env, pg,CPS_OWNED ); }
@@ -860,10 +856,6 @@ void cl_page_completion(const struct lu_env *env,PASSERT (env, pg, pg->cp_state ==cl_req_type_state (crt));CL_PAGE_HEADER (D_TRACE , env, pg,"%d %d\n" , crt, ioret); -if (crt ==CRT_READ && ioret ==0 ) { -PASSERT (env, pg, !(pg->cp_flags &CPF_READ_COMPLETED )); - pg->cp_flags |=CPF_READ_COMPLETED ; - }cl_page_state_set (env, pg,CPS_CACHED );if (crt >=CRT_NR )
@@ -989,10 +981,10 @@ void cl_page_header_print(const struct lu_env *env, void *cookie, lu_printer_t printer, const struct cl_page *pg) { (*printer)(env, cookie, -"page@%p[%d %p %d %d %d %p %p %#x]\n" , +"page@%p[%d %p %d %d %d %p %p]\n" , pg,atomic_read (&pg->cp_ref), pg->cp_obj, pg->cp_state, pg->cp_error, pg->cp_type, - pg->cp_owner, pg->cp_req, pg->cp_flags); + pg->cp_owner, pg->cp_req); }EXPORT_SYMBOL (cl_page_header_print);
drivers/staging/lustre/lustre/osc/osc_internal.h +0 -1
@@ -71,7 +71,6 @@ struct osc_async_page {struct client_obd *oap_cli;struct osc_object *oap_obj; -struct ldlm_lock *oap_ldlm_lock;spinlock_t oap_lock; };
drivers/staging/lustre/lustre/osc/osc_io.c +6 -1
@@ -163,7 +163,6 @@ static int osc_io_submit(const struct lu_env *env,continue ; } -cl_page_list_move (qout, qin, page);spin_lock (&oap->oap_lock); oap->oap_async_flags =ASYNC_URGENT |ASYNC_READY ; oap->oap_async_flags |=ASYNC_COUNT_STABLE ;
@@ -171,6 +170,12 @@ static int osc_io_submit(const struct lu_env *env,osc_page_submit (env, opg, crt, brw_flags);list_add_tail (&oap->oap_pending_item, &list); + +if (page->cp_sync_io) +cl_page_list_move (qout, qin, page); +else /* async IO */ +cl_page_list_del (env, qin, page); +if (++queued == max_pages) { queued =0 ; result = osc_queue_sync_pages(env, osc, &list, cmd,
drivers/staging/lustre/lustre/osc/osc_request.c +0 -6
@@ -1882,7 +1882,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,struct osc_async_page *tmp;struct cl_req *clerq =NULL ;enum cl_req_type crt = (cmd &OBD_BRW_WRITE ) ?CRT_WRITE :CRT_READ ; -struct ldlm_lock *lock =NULL ;struct cl_req_attr *crattr =NULL ;u64 starting_offset =OBD_OBJECT_EOF ;u64 ending_offset =0 ;
@@ -1948,7 +1947,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, rc =PTR_ERR (clerq); goto out; } - lock = oap->oap_ldlm_lock; }if (mem_tight) oap->oap_brw_flags |=OBD_BRW_MEMALLOC ;
@@ -1965,10 +1963,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,LASSERT (clerq); crattr->cra_oa = oa;cl_req_attr_set (env, clerq, crattr, ~0ULL ); -if (lock) { - oa->o_handle = lock->l_remote_handle; - oa->o_valid |=OBD_MD_FLHANDLE ; - } rc =cl_req_prep (env, clerq);if (rc !=0 ) {
Signature · 1 line
1.7.1
PATCH 57/80 staging: lustre: osc: revise unstable pages accounting
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
A few changes are made in this patch for unstable pages tracking:
1. Remove kernel NFS unstable pages tracking because it killed performance
2. Track unstable pages as part of LRU cache. Otherwise Lustre can use much more memory than max_cached_mb
3. Remove obd_unstable_pages tracking to avoid using global atomic counter
4. Make unstable pages track optional. Tracking unstable pages is turned off by default, and can be controlled by llite.*.unstable_stats.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4841
Reviewed-on: http://review.whamcloud.com/10003
--- drivers/staging/lustre/lustre/include/cl_object.h | 35 +++- .../staging/lustre/lustre/include/obd_support.h | 1 - drivers/staging/lustre/lustre/llite/lproc_llite.c | 41 ++++- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 - drivers/staging/lustre/lustre/osc/osc_cache.c | 96 +--------- drivers/staging/lustre/lustre/osc/osc_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_page.c | 208 +++++++++++++++++--- drivers/staging/lustre/lustre/osc/osc_request.c | 13 +- 8 files changed, 253 insertions(+), 145 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +24 -11
@@ -1039,23 +1039,32 @@ do { \ } \ }while (0 ) -static inline int __page_in_use(const struct cl_page *page, int refc) -{ -if (page->cp_type ==CPT_CACHEABLE ) - ++refc; -LASSERT (atomic_read (&page->cp_ref) >0 ); -return (atomic_read (&page->cp_ref) > refc); -} - -#define cl_page_in_use (pg) __page_in_use(pg, 1) -#define cl_page_in_use_noref (pg) __page_in_use(pg, 0) - static inline struct page *cl_page_vmpage(struct cl_page *page) {LASSERT (page->cp_vmpage);return page->cp_vmpage; } +/** +* Check if a cl_page is in use. +* +* Client cache holds a refcount, this refcount will be dropped when +* the page is taken out of cache, see vvp_page_delete(). +*/ +static inline bool __page_in_use (const struct cl_page *page,int refc) +{ +return (atomic_read (&page->cp_ref) > refc +1 ); +} + +/** +* Caller itself holds a refcount of cl_page. +*/ +#define cl_page_in_use (pg) __page_in_use(pg, 1) +/** +* Caller doesn't hold a refcount. +*/ +#define cl_page_in_use_noref (pg) __page_in_use(pg, 0) +/** @} cl_page */ /** \addtogroup cl_lock cl_lock
@@ -2331,6 +2340,10 @@ struct cl_client_cache {*/ spinlock_t ccc_lru_lock;/** +* Set if unstable check is enabled +*/ + unsigned int ccc_unstable_check:1; +/** * # of unstable pages for this mount point */ atomic_t ccc_unstable_nr;
drivers/staging/lustre/lustre/include/obd_support.h +0 -1
@@ -54,7 +54,6 @@ extern int at_early_margin;extern int at_extra;extern unsigned int obd_sync_filter;extern unsigned int obd_max_dirty_pages; -extern atomic_t obd_unstable_pages;extern atomic_t obd_dirty_pages;extern atomic_t obd_dirty_transit_pages;extern char obd_jobid_var[];
drivers/staging/lustre/lustre/llite/lproc_llite.c +38 -3
48 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/class_obd.c +0 -2
@@ -57,8 +57,6 @@ unsigned int obd_dump_on_eviction;EXPORT_SYMBOL (obd_dump_on_eviction);unsigned int obd_max_dirty_pages =256 ;EXPORT_SYMBOL (obd_max_dirty_pages); -atomic_t obd_unstable_pages; -EXPORT_SYMBOL (obd_unstable_pages);atomic_t obd_dirty_pages;EXPORT_SYMBOL (obd_dirty_pages);unsigned int obd_timeout =OBD_TIMEOUT_DEFAULT ;/* seconds */
drivers/staging/lustre/lustre/osc/osc_cache.c +4 -92
135 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/osc_internal.h +1 -1
@@ -197,7 +197,7 @@ int osc_quotacheck(struct obd_device *unused, struct obd_export *exp,int osc_quota_poll_check (struct obd_export *exp,struct if_quotacheck *qchk);void osc_inc_unstable_pages (struct ptlrpc_request *req);void osc_dec_unstable_pages (struct ptlrpc_request *req); -int osc_over_unstable_soft_limit (struct client_obd *cli); +bool osc_over_unstable_soft_limit (struct client_obd *cli); struct ldlm_lock *osc_dlmlock_at_pgoff(const struct lu_env *env, struct osc_object *obj, pgoff_t index,
drivers/staging/lustre/lustre/osc/osc_page.c +177 -31
248 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/osc_request.c +9 -4
@@ -807,17 +807,15 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,CERROR ("dirty %lu - %lu > dirty_max %lu\n" , cli->cl_dirty, cli->cl_dirty_transit, cli->cl_dirty_max); oa->o_undirty =0 ; - }else if (unlikely (atomic_read (&obd_unstable_pages) + -atomic_read (&obd_dirty_pages) - + }else if (unlikely (atomic_read (&obd_dirty_pages) -atomic_read (&obd_dirty_transit_pages) > (long )(obd_max_dirty_pages +1 ))) {/* The atomic_read() allowing the atomic_inc() are * not covered by a lock thus they may safely race and trip * this CERROR() unless we add in a small fudge factor (+1). */ -CERROR ("%s: dirty %d + %d - %d > system dirty_max %d\n" , +CERROR ("%s: dirty %d + %d > system dirty_max %d\n" , cli->cl_import->imp_obd->obd_name, -atomic_read (&obd_unstable_pages),atomic_read (&obd_dirty_pages),atomic_read (&obd_dirty_transit_pages), obd_max_dirty_pages);
@@ -1818,6 +1816,9 @@ static int brw_interpret(const struct lu_env *env, }kmem_cache_free (obdo_cachep, aa->aa_oa); +if (lustre_msg_get_opc (req->rq_reqmsg) ==OST_WRITE && rc ==0 ) +osc_inc_unstable_pages (req); +list_for_each_entry_safe (ext, tmp, &aa->aa_exts, oe_link) {list_del_init (&ext->oe_link);osc_extent_finish (env, ext,1 , rc);
@@ -1888,6 +1889,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,int mpflag =0 ;int mem_tight =0 ;int page_count =0 ; +bool soft_sync = false;int i;int rc;struct ost_body *body;
@@ -1915,6 +1917,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, } } + soft_sync =osc_over_unstable_soft_limit (cli);if (mem_tight) mpflag =cfs_memory_pressure_get_and_set ();
@@ -1950,6 +1953,8 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, }if (mem_tight) oap->oap_brw_flags |=OBD_BRW_MEMALLOC ; +if (soft_sync) + oap->oap_brw_flags |=OBD_BRW_SOFT_SYNC ; pga[i] = &oap->oap_brw_page; pga[i]->off = oap->oap_obj_off + oap->oap_page_off; CDEBUG(0, "put page %p index %lu oap %p flg %x to pga\n",
Signature · 1 line
1.7.1
Greg Kroah-Hartman
maintainerRe: [PATCH 57/80] staging: lustre: osc: revise unstable pages accounting
Digging up an old email...
Quoted 127 lines · James Simmons
From: Jinshan Xiong <[email protected]>
A few changes are made in this patch for unstable pages tracking:
1. Remove kernel NFS unstable pages tracking because it killed performance
2. Track unstable pages as part of LRU cache. Otherwise Lustre can use much more memory thanmax_cached_mb
3. Removeobd_unstable_pagestracking to avoid using global atomic counter
4. Make unstable pages track optional. Tracking unstable pages is turned off by default, and can be controlled by llite.*.unstable_stats.Signed-off-by Jinshan Xiong <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4841
Reviewed-on: http://review.whamcloud.com/10003Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Lai Siyao <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/include/cl_object.h | 35 +++- .../staging/lustre/lustre/include/obd_support.h | 1 - drivers/staging/lustre/lustre/llite/lproc_llite.c | 41 ++++- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 - drivers/staging/lustre/lustre/osc/osc_cache.c | 96 +--------- drivers/staging/lustre/lustre/osc/osc_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_page.c | 208 +++++++++++++++++--- drivers/staging/lustre/lustre/osc/osc_request.c | 13 +- 8 files changed, 253 insertions(+), 145 deletions(-)drivers/staging/lustre/lustre/include/cl_object.h +24
-11@@ -1039,23 +1039,32 @@ do { \ } \ }while (0 ) -static inline int __page_in_use(const struct cl_page *page, int refc) -{ -if (page->cp_type ==CPT_CACHEABLE ) - ++refc; -LASSERT (atomic_read (&page->cp_ref) >0 ); -return (atomic_read (&page->cp_ref) > refc); -} - -#define cl_page_in_use (pg) __page_in_use(pg, 1) -#define cl_page_in_use_noref (pg) __page_in_use(pg, 0) - static inline struct page *cl_page_vmpage(struct cl_page *page) {LASSERT (page->cp_vmpage);return page->cp_vmpage; } +/** +* Check if a cl_page is in use. +* +* Client cache holds a refcount, this refcount will be dropped when +* the page is taken out of cache, see vvp_page_delete(). +*/ +static inline bool __page_in_use (const struct cl_page *page,int refc) +{ +return (atomic_read (&page->cp_ref) > refc +1 ); +} + +/** +* Caller itself holds a refcount of cl_page. +*/ +#define cl_page_in_use (pg) __page_in_use(pg, 1) +/** +* Caller doesn't hold a refcount. +*/ +#define cl_page_in_use_noref (pg) __page_in_use(pg, 0) +/** @} cl_page */ /** \addtogroup cl_lock cl_lock @@ -2331,6 +2340,10 @@ struct cl_client_cache {*/ spinlock_t ccc_lru_lock;/** +* Set if unstable check is enabled +*/ + unsigned int ccc_unstable_check:1; +/** * # of unstable pages for this mount point */ atomic_t ccc_unstable_nr;drivers/staging/lustre/lustre/include/obd_support.h +0
-1@@ -54,7 +54,6 @@ extern int at_early_margin;extern int at_extra;extern unsigned int obd_sync_filter;extern unsigned int obd_max_dirty_pages; -extern atomic_t obd_unstable_pages;extern atomic_t obd_dirty_pages;extern atomic_t obd_dirty_transit_pages;extern char obd_jobid_var[];drivers/staging/lustre/lustre/llite/lproc_llite.c +12
-3@@ -828,10 +828,45 @@ static ssize_t unstable_stats_show(struct kobject *kobj, pages =atomic_read (&cache->ccc_unstable_nr); mb = (pages *PAGE_SIZE ) >>20 ; -return sprintf (buf,"unstable_pages: %8d\n" -"unstable_mb: %8d\n" , pages, mb); +return sprintf (buf,"unstable_check: %8d\n" +"unstable_pages: %8d\n" +"unstable_mb: %8d\n" , + cache->ccc_unstable_check, pages, mb); } -LUSTRE_RO_ATTR (unstable_stats); + +static ssize_t unstable_stats_store (struct kobject *kobj, +struct attribute *attr, +const char *buffer, +size_t count) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kobj);
drivers/staging/lustre/lustre/llite/lproc_llite.c static ssize_t unstable_stats_show(struct kobject *kobj, · line 853
Quoted 10 lines
drivers/staging/lustre/lustre/llite/lproc_llite.c +10
-0+char kernbuf[128 ]; +int val, rc; + +if (!count) +return 0 ; +if (count <0 || count >=sizeof (kernbuf)) +return -EINVAL ; + +if (copy_from_user (kernbuf, buffer, count)) +return -EFAULT ;
It was just pointed out to me that this code has obviously never been tested at all.
Sorry for missing this before, do you want me to revert this? Or will you send me a fix?
And I think I'm going to have to be stricter now, this patch did way too much all at once. When you have to list the different things a patch does, that means it needs to be broken up. This wasn't a simple one to review, as is obvious with everyone who missed this basic issue (myself include.)
Also, go fix your test harness, it's not being used, or is totally buggy :)
thanks,
greg k-h
Re: [PATCH 57/80] staging: lustre: osc: revise unstable pages accounting
Quoted 135 lines · Greg Kroah-Hartman
Digging up an old email...
Quoted 132 lines · James Simmons
From: Jinshan Xiong <[email protected]>
A few changes are made in this patch for unstable pages tracking:
1. Remove kernel NFS unstable pages tracking because it killed performance
2. Track unstable pages as part of LRU cache. Otherwise Lustre can use much more memory thanmax_cached_mb
3. Removeobd_unstable_pagestracking to avoid using global atomic counter
4. Make unstable pages track optional. Tracking unstable pages is turned off by default, and can be controlled by llite.*.unstable_stats.Signed-off-by Jinshan Xiong <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4841
Reviewed-on: http://review.whamcloud.com/10003Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Lai Siyao <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>---
drivers/staging/lustre/lustre/include/cl_object.h | 35 +++- .../staging/lustre/lustre/include/obd_support.h | 1 - drivers/staging/lustre/lustre/llite/lproc_llite.c | 41 ++++- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 - drivers/staging/lustre/lustre/osc/osc_cache.c | 96 +--------- drivers/staging/lustre/lustre/osc/osc_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_page.c | 208 +++++++++++++++++--- drivers/staging/lustre/lustre/osc/osc_request.c | 13 +- 8 files changed, 253 insertions(+), 145 deletions(-)drivers/staging/lustre/lustre/include/cl_object.h +24
-11@@ -1039,23 +1039,32 @@ do { \ } \ }while (0 ) -static inline int __page_in_use(const struct cl_page *page, int refc) -{ -if (page->cp_type ==CPT_CACHEABLE ) - ++refc; -LASSERT (atomic_read (&page->cp_ref) >0 ); -return (atomic_read (&page->cp_ref) > refc); -} - -#define cl_page_in_use (pg) __page_in_use(pg, 1) -#define cl_page_in_use_noref (pg) __page_in_use(pg, 0) - static inline struct page *cl_page_vmpage(struct cl_page *page) {LASSERT (page->cp_vmpage);return page->cp_vmpage; } +/** +* Check if a cl_page is in use. +* +* Client cache holds a refcount, this refcount will be dropped when +* the page is taken out of cache, see vvp_page_delete(). +*/ +static inline bool __page_in_use (const struct cl_page *page,int refc) +{ +return (atomic_read (&page->cp_ref) > refc +1 ); +} + +/** +* Caller itself holds a refcount of cl_page. +*/ +#define cl_page_in_use (pg) __page_in_use(pg, 1) +/** +* Caller doesn't hold a refcount. +*/ +#define cl_page_in_use_noref (pg) __page_in_use(pg, 0) +/** @} cl_page */ /** \addtogroup cl_lock cl_lock @@ -2331,6 +2340,10 @@ struct cl_client_cache {*/ spinlock_t ccc_lru_lock;/** +* Set if unstable check is enabled +*/ + unsigned int ccc_unstable_check:1; +/** * # of unstable pages for this mount point */ atomic_t ccc_unstable_nr;drivers/staging/lustre/lustre/include/obd_support.h +0
-1@@ -54,7 +54,6 @@ extern int at_early_margin;extern int at_extra;extern unsigned int obd_sync_filter;extern unsigned int obd_max_dirty_pages; -extern atomic_t obd_unstable_pages;extern atomic_t obd_dirty_pages;extern atomic_t obd_dirty_transit_pages;extern char obd_jobid_var[];drivers/staging/lustre/lustre/llite/lproc_llite.c +17
-3@@ -828,10 +828,45 @@ static ssize_t unstable_stats_show(struct kobject *kobj, pages =atomic_read (&cache->ccc_unstable_nr); mb = (pages *PAGE_SIZE ) >>20 ; -return sprintf (buf,"unstable_pages: %8d\n" -"unstable_mb: %8d\n" , pages, mb); +return sprintf (buf,"unstable_check: %8d\n" +"unstable_pages: %8d\n" +"unstable_mb: %8d\n" , + cache->ccc_unstable_check, pages, mb); } -LUSTRE_RO_ATTR (unstable_stats); + +static ssize_t unstable_stats_store (struct kobject *kobj, +struct attribute *attr, +const char *buffer, +size_t count) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kobj); +char kernbuf[128 ]; +int val, rc; + +if (!count) +return 0 ;
Quoted 8 lines
drivers/staging/lustre/lustre/llite/lproc_llite.c static ssize_t unstable_stats_show(struct kobject *kobj, · line 853
Quoted 5 lines
drivers/staging/lustre/lustre/llite/lproc_llite.c +5
-0+if (count <0 || count >=sizeof (kernbuf)) +return -EINVAL ; + +if (copy_from_user (kernbuf, buffer, count)) +return -EFAULT ;It was just pointed out to me that this code has obviously never been tested at all.
Whoops.
Quoted 2 lines
Sorry for missing this before, do you want me to revert this? Or will you send me a fix?
I'll have a fix for you in a moment.
Quoted 1 line
Also, go fix your test harness, it's not being used, or is totally buggy :)
Well, at least there was no crash, right? ;)
PATCH 58/80 staging: lustre: mdc: always use D_INFO for debug info when mdc_put_rpc_lock fails
In reply to James SimmonsFrom: wang di <[email protected]>
Also use D_INFO no matter what the error returned from mdc_put_rpc_lock.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4973
Reviewed-on: http://review.whamcloud.com/10150
--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_locks.c +2 -3
@@ -841,9 +841,8 @@ resend:mdc_put_rpc_lock (obddev->u.cli.cl_rpc_lock, it);if (rc <0 ) { -CDEBUG_LIMIT ((rc == -EACCES || rc == -EIDRM ) ?D_INFO :D_ERROR , -"%s: ldlm_cli_enqueue failed: rc = %d\n" , - obddev->obd_name, rc); +CDEBUG (D_INFO ,"%s: ldlm_cli_enqueue failed: rc = %d\n" , + obddev->obd_name, rc);mdc_clear_replay_flag (req, rc);ptlrpc_req_finished (req);
Signature · 1 line
1.7.1
PATCH 59/80 staging: lustre: fld: add fld description documentation
In reply to James SimmonsFrom: Patrick Farrell <[email protected]>
Add subsystem description from Di Wang to header file.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5153
Reviewed-on: http://review.whamcloud.com/10631
--- drivers/staging/lustre/lustre/fld/fld_internal.h | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/staging/lustre/lustre/fld/fld_internal.h +19 -0
@@ -31,6 +31,25 @@* * lustre/fld/fld_internal.h * +* Subsystem Description: +* FLD is FID Location Database, which stores where (IE, on which MDT) +* FIDs are located. +* The database is basically a record file, each record consists of a FID +* sequence range, MDT/OST index, and flags. The FLD for the whole FS +* is only stored on the sequence controller(MDT0) right now, but each target +* also has its local FLD, which only stores the local sequence. +* +* The FLD subsystem usually has two tasks: +* 1. maintain the database, i.e. when the sequence controller allocates +* new sequence ranges to some nodes, it will call the FLD API to insert the +* location information <sequence_range, node_index> in FLDB. +* +* 2. Handle requests from other nodes, i.e. if client needs to know where +* the FID is located, if it can not find the information in the local cache, +* it will send a FLD lookup RPC to the FLD service, and the FLD service will +* look up the FLDB entry and return the location information to client. +* +* * Author: Yury Umanets <[email protected]> * Author: Tom WangDi <[email protected]> */
Signature · 1 line
1.7.1
PATCH 60/80 staging: lustre: ldlm: improve ldlm_lock_create() return value
In reply to James SimmonsFrom: Emoly Liu <[email protected]>
ldlm_lock_create() and ldlm_resource_get() always return NULL as error reporting and "NULL" is interpretted as ENOMEM incorrectly sometimes. This patch fixes this problem by using ERR_PTR() rather than NULL.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4524
Reviewed-on: http://review.whamcloud.com/9004
--- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 28 ++++++++++++-------- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 13 +++----- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 25 +++++------------ drivers/staging/lustre/lustre/mdc/mdc_locks.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 2 +- 7 files changed, 34 insertions(+), 42 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +2 -2
@@ -339,10 +339,10 @@ reprocess: lock->l_granted_mode, &null_cbs, NULL, 0, LVB_T_NONE);lock_res_and_lock (req); -if (!new2) { +if (IS_ERR (new2)) {ldlm_flock_destroy (req, lock->l_granted_mode, *flags); - *err = -ENOLCK ; + *err =PTR_ERR (new2);return LDLM_ITER_STOP ; } goto reprocess;
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +17 -11
@@ -481,8 +481,8 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock,unlock_res_and_lock (lock); newres =ldlm_resource_get (ns,NULL , new_resid, type,1 ); -if (!newres) -return -ENOMEM ; +if (IS_ERR (newres)) +return PTR_ERR (newres);lu_ref_add (&newres->lr_reference,"lock" , lock);/*
@@ -1227,7 +1227,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, } res =ldlm_resource_get (ns,NULL , res_id, type,0 ); -if (!res) { +if (IS_ERR (res)) {LASSERT (!old_lock);return 0 ; }
@@ -1475,15 +1475,15 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, {struct ldlm_lock *lock;struct ldlm_resource *res; +int rc; res =ldlm_resource_get (ns,NULL , res_id, type,1 ); -if (!res) -return NULL ; +if (IS_ERR (res)) +return ERR_CAST (res); lock =ldlm_lock_new (res); -if (!lock) -return NULL ; +return ERR_PTR (-ENOMEM ); lock->l_req_mode = mode; lock->l_ast_data = data;
@@ -1497,27 +1497,33 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, lock->l_tree_node =NULL ;/* if this is the extent lock, allocate the interval tree node */ if (type ==LDLM_EXTENT ) { -if (!ldlm_interval_alloc (lock)) +if (!ldlm_interval_alloc (lock)) { + rc = -ENOMEM ; goto out; + } }if (lvb_len) { lock->l_lvb_len = lvb_len; lock->l_lvb_data =kzalloc (lvb_len,GFP_NOFS ); -if (!lock->l_lvb_data) +if (!lock->l_lvb_data) { + rc = -ENOMEM ; goto out; + } } lock->l_lvb_type = lvb_type; -if (OBD_FAIL_CHECK (OBD_FAIL_LDLM_NEW_LOCK )) +if (OBD_FAIL_CHECK (OBD_FAIL_LDLM_NEW_LOCK )) { + rc = -ENOENT ; goto out; + }return lock; out:ldlm_lock_destroy (lock);LDLM_LOCK_RELEASE (lock); -return NULL ; +return ERR_PTR (rc); }/**
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +5 -8
@@ -694,8 +694,8 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, lock =ldlm_lock_create (ns, res_id, einfo->ei_type, einfo->ei_mode, &cbs, einfo->ei_cbdata, lvb_len, lvb_type); -if (!lock) -return -ENOMEM ; +if (IS_ERR (lock)) +return PTR_ERR (lock);/* for the local lock, add the reference */ ldlm_lock_addref_internal (lock, einfo->ei_mode);ldlm_lock2handle (lock, lockh);
@@ -1658,7 +1658,7 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,int rc; res =ldlm_resource_get (ns,NULL , res_id,0 ,0 ); -if (!res) { +if (IS_ERR (res)) {/* This is not a problem. */ CDEBUG (D_INFO ,"No resource %llu\n" , res_id->name[0 ]);return 0 ;
@@ -1809,13 +1809,10 @@ int ldlm_resource_iterate(struct ldlm_namespace *ns,struct ldlm_resource *res;int rc; -if (!ns) { -CERROR ("must pass in namespace\n" ); -LBUG (); - } +LASSERTF (ns,"must pass in namespace\n" ); res =ldlm_resource_get (ns,NULL , res_id,0 ,0 ); -if (!res) +if (IS_ERR (res))return 0 ;LDLM_RESOURCE_ADDREF (res);
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +7 -18
@@ -1088,7 +1088,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, int create) {struct hlist_node *hnode; -struct ldlm_resource *res; +struct ldlm_resource *res =NULL ;struct cfs_hash_bd bd;__u64 version;int ns_refcount =0 ;
@@ -1101,31 +1101,20 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, hnode =cfs_hash_bd_lookup_locked (ns->ns_rs_hash, &bd, (void *)name);if (hnode) {cfs_hash_bd_unlock (ns->ns_rs_hash, &bd,0 ); - res = hlist_entry(hnode, struct ldlm_resource, lr_hash); -/* Synchronize with regard to resource creation. */ -if (ns->ns_lvbo && ns->ns_lvbo->lvbo_init) { -mutex_lock (&res->lr_lvb_mutex); -mutex_unlock (&res->lr_lvb_mutex); - } - -if (unlikely (res->lr_lvb_len <0 )) { -ldlm_resource_putref (res); - res =NULL ; - } -return res; + goto lvbo_init; } version =cfs_hash_bd_version_get (&bd);cfs_hash_bd_unlock (ns->ns_rs_hash, &bd,0 );if (create ==0 ) -return NULL ; +return ERR_PTR (-ENOENT );LASSERTF (type >=LDLM_MIN_TYPE && type <LDLM_MAX_TYPE ,"type: %d\n" , type); res =ldlm_resource_new ();if (!res) -return NULL ; +return ERR_PTR (-ENOMEM ); res->lr_ns_bucket =cfs_hash_bd_extra_get (ns->ns_rs_hash, &bd); res->lr_name = *name;
@@ -1143,7 +1132,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,/* We have taken lr_lvb_mutex. Drop it. */ mutex_unlock (&res->lr_lvb_mutex);kmem_cache_free (ldlm_resource_slab, res); - +lvbo_init: res = hlist_entry(hnode, struct ldlm_resource, lr_hash);/* Synchronize with regard to resource creation. */ if (ns->ns_lvbo && ns->ns_lvbo->lvbo_init) {
@@ -1153,7 +1142,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,if (unlikely (res->lr_lvb_len <0 )) {ldlm_resource_putref (res); - res =NULL ; + res =ERR_PTR (res->lr_lvb_len); }return res; }
@@ -1175,7 +1164,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, res->lr_lvb_len = rc;mutex_unlock (&res->lr_lvb_mutex);ldlm_resource_putref (res); -return NULL ; +return ERR_PTR (rc); } }
drivers/staging/lustre/lustre/mdc/mdc_locks.c +1 -1
@@ -174,7 +174,7 @@ int mdc_null_inode(struct obd_export *exp,fid_build_reg_res_name (fid, &res_id); res =ldlm_resource_get (ns,NULL , &res_id,0 ,0 ); -if (!res) +if (IS_ERR (res))return 0 ;lock_res (res);
drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 -1
@@ -86,7 +86,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,fid_build_reg_res_name (fid, &res_id); res =ldlm_resource_get (exp->exp_obd->obd_namespace,NULL , &res_id,0 ,0 ); -if (!res) +if (IS_ERR (res))return 0 ;LDLM_RESOURCE_ADDREF (res);/* Initialize ibits lock policy. */
drivers/staging/lustre/lustre/osc/osc_request.c +1 -1
@@ -650,7 +650,7 @@ static int osc_resource_get_unused(struct obd_export *exp, struct obdo *oa,ostid_build_res_name (&oa->o_oi, &res_id); res =ldlm_resource_get (ns,NULL , &res_id,0 ,0 ); -if (!res) +if (IS_ERR (res))return 0 ;LDLM_RESOURCE_ADDREF (res);
Signature · 1 line
1.7.1
PATCH 61/80 staging: lustre: obdclass: compile issues with variable not being initialized
In reply to James SimmonsOne of the versions of gcc I have refuses to build obd_mount.c due to index not be initialized in function lmd_make_exclusion before it is used.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-on: http://review.whamcloud.com/10705
--- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/obdclass/obd_mount.c +1 -1
@@ -730,7 +730,7 @@ int lustre_check_exclusion(struct super_block *sb, char *svname)static int lmd_make_exclusion (struct lustre_mount_data *lmd,const char *ptr) {const char *s1 = ptr, *s2; -__u32 index, *exclude_list; +__u32 index =0 , *exclude_list;int rc =0 , devmax;/* The shortest an ost name can be is 8 chars: -OST0000.
Signature · 1 line
1.7.1
PATCH 62/80 staging: lustre: obd: limit lu_object cache
In reply to James SimmonsFrom: Brian Behlendorf <[email protected]>
As the LU cache grows it can consume large enough chunks of memory that ends up preventing buffers for other objects, such as the OIs, from being cached and severely impacting the performance for FID lookups. Limit the lu_object cache to a maximum of lu_cache_nr objects.
NOTES:
* In order to be able to quickly determine the number of objects in the hash table the CFS_HASH_COUNTER flag is added. This adds an atomic_inc/dec to the hash insert/remove paths but is not expected to have any measurable impact of performance.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5164
Reviewed-on: http://review.whamcloud.com/10237
--- drivers/staging/lustre/lustre/obdclass/lu_object.c | 91 ++++++++++++++------ 1 files changed, 64 insertions(+), 27 deletions(-)
drivers/staging/lustre/lustre/obdclass/lu_object.c +64 -27
@@ -55,6 +55,34 @@#include "../include/lu_ref.h" #include <linux/list.h> +enum { +LU_CACHE_PERCENT_MAX =50 , +LU_CACHE_PERCENT_DEFAULT =20 +}; + +#define LU_CACHE_NR_MAX_ADJUST 128 +#define LU_CACHE_NR_UNLIMITED -1 +#define LU_CACHE_NR_DEFAULT LU_CACHE_NR_UNLIMITED +#define LU_CACHE_NR_LDISKFS_LIMIT LU_CACHE_NR_UNLIMITED +#define LU_CACHE_NR_ZFS_LIMIT 256 + +#define LU_SITE_BITS_MIN 12 +#define LU_SITE_BITS_MAX 24 +/** +* total 256 buckets, we don't want too many buckets because: +* - consume too much memory +* - avoid unbalanced LRU list +*/ +#define LU_SITE_BKT_BITS 8 + +static unsigned int lu_cache_percent =LU_CACHE_PERCENT_DEFAULT ; +module_param (lu_cache_percent, int,0644 ); +MODULE_PARM_DESC (lu_cache_percent,"Percentage of memory to be used as lu_object cache" ); + +static long lu_cache_nr =LU_CACHE_NR_DEFAULT ; +module_param (lu_cache_nr, long,0644 ); +MODULE_PARM_DESC (lu_cache_nr,"Maximum number of objects in lu_object cache" ); +static void lu_object_free (const struct lu_env *env,struct lu_object *o);static __u32 ls_stats_read (struct lprocfs_stats *stats,int idx);
@@ -573,6 +601,27 @@ static struct lu_object *lu_object_find(const struct lu_env *env,return lu_object_find_at (env, dev->ld_site->ls_top_dev, f, conf); } +/* +* Limit the lu_object cache to a maximum of lu_cache_nr objects. Because +* the calculation for the number of objects to reclaim is not covered by +* a lock the maximum number of objects is capped by LU_CACHE_MAX_ADJUST. +* This ensures that many concurrent threads will not accidentally purge +* the entire cache. +*/ +static void lu_object_limit (const struct lu_env *env,struct lu_device *dev) +{ +__u64 size, nr; + +if (lu_cache_nr ==LU_CACHE_NR_UNLIMITED ) +return ; + + size =cfs_hash_size_get (dev->ld_site->ls_obj_hash); + nr = (__u64 )lu_cache_nr; +if (size > nr) +lu_site_purge (env, dev->ld_site, +min_t (__u64, size - nr,LU_CACHE_NR_MAX_ADJUST )); +} + static struct lu_object *lu_object_new(const struct lu_env *env, struct lu_device *dev, const struct lu_fid *f,
@@ -590,6 +639,9 @@ static struct lu_object *lu_object_new(const struct lu_env *env,cfs_hash_bd_get_and_lock (hs, (void *)f, &bd,1 );cfs_hash_bd_add_locked (hs, &bd, &o->lo_header->loh_hash);cfs_hash_bd_unlock (hs, &bd,1 ); + +lu_object_limit (env, dev); +return o; }
@@ -656,6 +708,9 @@ static struct lu_object *lu_object_find_try(const struct lu_env *env,if (likely (PTR_ERR (shadow) == -ENOENT )) {cfs_hash_bd_add_locked (hs, &bd, &o->lo_header->loh_hash);cfs_hash_bd_unlock (hs, &bd,1 ); + +lu_object_limit (env, dev); +return o; }
@@ -805,20 +860,12 @@ void lu_site_print(const struct lu_env *env, struct lu_site *s, void *cookie, }EXPORT_SYMBOL (lu_site_print); -enum { -LU_CACHE_PERCENT_MAX =50 , -LU_CACHE_PERCENT_DEFAULT =20 -}; - -static unsigned int lu_cache_percent =LU_CACHE_PERCENT_DEFAULT ; -module_param (lu_cache_percent, int,0644 ); -MODULE_PARM_DESC (lu_cache_percent,"Percentage of memory to be used as lu_object cache" ); -/** * Return desired hash table order. */ -static int lu_htable_order (void ) +static int lu_htable_order (struct lu_device *top) { +unsigned long bits_max =LU_SITE_BITS_MAX ;unsigned long cache_size;int bits;
@@ -851,7 +898,7 @@ static int lu_htable_order(void)for (bits =1 ; (1 << bits) < cache_size; ++bits) { ; } -return bits; +return clamp_t (typeof (bits), bits,LU_SITE_BITS_MIN , bits_max); } static unsigned lu_obj_hop_hash(struct cfs_hash *hs,
@@ -927,28 +974,17 @@ static void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d)/** * Initialize site \a s, with \a d as the top level device. */ -#define LU_SITE_BITS_MIN 12 -#define LU_SITE_BITS_MAX 19 -/** -* total 256 buckets, we don't want too many buckets because: -* - consume too much memory -* - avoid unbalanced LRU list -*/ -#define LU_SITE_BKT_BITS 8 -int lu_site_init (struct lu_site *s,struct lu_device *top) {struct lu_site_bkt_data *bkt;struct cfs_hash_bd bd; +unsigned long bits; +unsigned long i;char name[16 ]; -int bits; -int i;memset (s,0 ,sizeof (*s)); - bits =lu_htable_order ();snprintf (name,16 ,"lu_site_%s" , top->ld_type->ldt_name); -for (bits =min (max (LU_SITE_BITS_MIN , bits),LU_SITE_BITS_MAX ); - bits >=LU_SITE_BITS_MIN ; bits--) { +for (bits =lu_htable_order (top); bits >=LU_SITE_BITS_MIN ; bits--) { s->ls_obj_hash = cfs_hash_create(name, bits, bits, bits - LU_SITE_BKT_BITS, sizeof(*bkt), 0, 0,
@@ -956,13 +992,14 @@ int lu_site_init(struct lu_site *s, struct lu_device *top)CFS_HASH_SPIN_BKTLOCK |CFS_HASH_NO_ITEMREF |CFS_HASH_DEPTH | - CFS_HASH_ASSERT_EMPTY); +CFS_HASH_ASSERT_EMPTY | + CFS_HASH_COUNTER);if (s->ls_obj_hash)break ; }if (!s->ls_obj_hash) { -CERROR ("failed to create lu_site hash with bits: %d\n" , bits); +CERROR ("failed to create lu_site hash with bits: %lu\n" , bits);return -ENOMEM ; }
Signature · 1 line
1.7.1
PATCH 63/80 staging: lustre: fid: do open-by-fid by default
In reply to James SimmonsFrom: Lai Siyao <[email protected]>
Currently client open-by-fid often packs name into the request, but the name may be invalid, eg. NFS export, and even if it's valid, it may cause inconsistency because this operation is done on this fid, which is globally unique, but name not.
Since open-by-fid doesn't pack name, for striped dir we can't know parent stripe fid on client, so we set parent fid the same as child fid, and MDT has to find its parent fid from linkea (this is already supported by MDT).
M_CHECK_STALE becomes obsolete.
Unset MDS_OPEN_FL_INTERNAL from open syscall flags, because these flags are internally used, and should not be set from user space.
It's not necessary to store parent fid in lli_pfid, because MDT can get it's parent fid from linkea, and now that DNE stripe directory stores master inode fid in lli_pfid, stop storing parent fid to avoid conflict.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544
Reviewed-on: http://review.whamcloud.com/7476
Reviewed-on: http://review.whamcloud.com/10692
--- .../lustre/lustre/include/lustre/lustre_idl.h | 5 ++ .../staging/lustre/lustre/include/lustre_lite.h | 1 - drivers/staging/lustre/lustre/include/lustre_mds.h | 3 - drivers/staging/lustre/lustre/llite/file.c | 71 +++++++++----------- .../staging/lustre/lustre/llite/llite_internal.h | 4 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 17 +---- drivers/staging/lustre/lustre/llite/llite_nfs.c | 14 +++- drivers/staging/lustre/lustre/llite/namei.c | 1 + drivers/staging/lustre/lustre/lmv/lmv_intent.c | 41 +++++------ drivers/staging/lustre/lustre/mdc/mdc_internal.h | 1 - drivers/staging/lustre/lustre/mdc/mdc_lib.c | 5 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 21 ------ .../lustre/lustre/obdclass/lprocfs_status.c | 2 +- 13 files changed, 71 insertions(+), 115 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +5 -0
@@ -2252,6 +2252,11 @@ void lustre_swab_mdt_rec_setattr(struct mdt_rec_setattr *sa);*/ #define MDS_OPEN_RELEASE 02000000000000ULL/* Open the file for HSM release */ +#define MDS_OPEN_FL_INTERNAL (MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS | \ + MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_LOCK | \ + MDS_OPEN_BY_FID | MDS_OPEN_LEASE | \ + MDS_OPEN_RELEASE) +enum mds_op_bias {MDS_CHECK_SPLIT =1 <<0 ,MDS_CROSS_REF =1 <<1 ,
drivers/staging/lustre/lustre/include/lustre_lite.h +0 -1
@@ -42,7 +42,6 @@#include "obd_class.h" #include "lustre_net.h" -#include "lustre_mds.h" #include "lustre_ha.h" /* 4UL * 1024 * 1024 */
drivers/staging/lustre/lustre/include/lustre_mds.h +0 -3
@@ -58,9 +58,6 @@ struct mds_group_info {#define MDD_OBD_NAME "mdd_obd"#define MDD_OBD_UUID "mdd_obd_uuid" -/* these are local flags, used only on the client, private */ -#define M_CHECK_STALE 0200000000 -/** @} mds */ #endif
drivers/staging/lustre/lustre/llite/file.c +31 -40
113 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -3
@@ -118,9 +118,7 @@ struct ll_inode_info {/* identifying fields for both metadata and data stacks. */ struct lu_fid lli_fid; -/* Parent fid for accessing default stripe data on parent directory -* for allocating OST objects after a mknod() and later open-by-FID. -*/ +/* master inode fid for stripe directory */ struct lu_fid lli_pfid;struct list_head lli_close_list;
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -15
@@ -189,7 +189,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,OBD_CONNECT_PINGLESS |OBD_CONNECT_MAX_EASIZE |OBD_CONNECT_FLOCK_DEAD | -OBD_CONNECT_DISP_STRIPE |OBD_CONNECT_LFSCK ; +OBD_CONNECT_DISP_STRIPE |OBD_CONNECT_LFSCK | +OBD_CONNECT_OPEN_BY_FID ;if (sbi->ll_flags &LL_SBI_SOM_PREVIEW ) data->ocd_connect_flags |=OBD_CONNECT_SOM ;
@@ -2364,20 +2365,6 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, op_data->op_mds =0 ; op_data->op_data = data; -/* If the file is being opened after mknod() (normally due to NFS) -* try to use the default stripe data from parent directory for -* allocating OST objects. Try to pass the parent FID to MDS. -*/ -if (opc ==LUSTRE_OPC_CREATE && i1 == i2 &&S_ISREG (i2->i_mode) && - !ll_i2info (i2)->lli_has_smd) { -struct ll_inode_info *lli =ll_i2info (i2); - -spin_lock (&lli->lli_lock); -if (likely (!lli->lli_has_smd && !fid_is_zero (&lli->lli_pfid))) - op_data->op_fid1 = lli->lli_pfid; -spin_unlock (&lli->lli_lock); - } -/* When called by ll_setattr_raw, file is i1. */ if (ll_i2info (i1)->lli_flags &LLIF_DATA_MODIFIED ) op_data->op_bias |=MDS_DATA_MODIFIED ;
drivers/staging/lustre/lustre/llite/llite_nfs.c +10 -4
@@ -148,12 +148,18 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *parenreturn ERR_PTR (-ESTALE ); } + result =d_obtain_alias (inode); +if (IS_ERR (result)) { +iput (inode); +return result; + } +/** -* It is an anonymous dentry without OST objects created yet. -* We have to find the parent to tell MDS how to init lov objects. +* In case d_obtain_alias() found a disconnected dentry, always update +* lli_pfid to allow later operation (normally open) have parent fid, +* which may be used by MDS to create data. */ -if (S_ISREG (inode->i_mode) && !ll_i2info (inode)->lli_has_smd && - parent && !fid_is_zero (parent)) { +if (parent) {struct ll_inode_info *lli =ll_i2info (inode);spin_lock (&lli->lli_lock);
drivers/staging/lustre/lustre/llite/namei.c +1 -0
@@ -650,6 +650,7 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, } it->it_create_mode = (mode &S_IALLUGO ) |S_IFREG ; it->it_flags = (open_flags & ~O_ACCMODE ) |OPEN_FMODE (open_flags); + it->it_flags &= ~MDS_OPEN_FL_INTERNAL ;/* Dentry added to dcache tree in ll_lookup_it */ de =ll_lookup_it (dir, dentry, it, lookup_flags);
drivers/staging/lustre/lustre/lmv/lmv_intent.c +19 -22
74 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_internal.h +0 -1
@@ -34,7 +34,6 @@#define _MDC_INTERNAL_H#include "../include/lustre_mdc.h" -#include "../include/lustre_mds.h" void lprocfs_mdc_init_vars (struct lprocfs_static_vars *lvars);
drivers/staging/lustre/lustre/mdc/mdc_lib.c +1 -4
@@ -171,10 +171,7 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,static __u64 mds_pack_open_flags (__u64 flags,__u32 mode) {__u64 cr_flags = (flags & (FMODE_READ |FMODE_WRITE | -MDS_OPEN_HAS_EA |MDS_OPEN_HAS_OBJS | -MDS_OPEN_OWNEROVERRIDE |MDS_OPEN_LOCK | -MDS_OPEN_BY_FID |MDS_OPEN_LEASE | -MDS_OPEN_RELEASE )); +MDS_OPEN_FL_INTERNAL ));if (flags &O_CREAT ) cr_flags |=MDS_OPEN_CREAT ;if (flags &O_EXCL )
drivers/staging/lustre/lustre/mdc/mdc_locks.c +0 -21
@@ -922,27 +922,6 @@ static int mdc_finish_intent_lock(struct obd_export *exp, mdt_body =req_capsule_server_get (&request->rq_pill, &RMF_MDT_BODY );LASSERT (mdt_body);/* mdc_enqueue checked */ -/* If we were revalidating a fid/name pair, mark the intent in -* case we fail and get called again from lookup -*/ -if (fid_is_sane (&op_data->op_fid2) && - it->it_create_mode &M_CHECK_STALE && - it->it_op !=IT_GETATTR ) { -/* Also: did we find the same inode? */ -/* sever can return one of two fids: -* op_fid2 - new allocated fid - if file is created. -* op_fid3 - existent fid - if file only open. -* op_fid3 is saved in lmv_intent_open -*/ -if ((!lu_fid_eq (&op_data->op_fid2, &mdt_body->mbo_fid1)) && - (!lu_fid_eq (&op_data->op_fid3, &mdt_body->mbo_fid1))) { -CDEBUG (D_DENTRY ,"Found stale data " DFID "(" DFID ")/" DFID -"\n" ,PFID (&op_data->op_fid2), -PFID (&op_data->op_fid2),PFID (&mdt_body->mbo_fid1)); -return -ESTALE ; - } - } - rc =it_open_error (DISP_LOOKUP_EXECD , it);if (rc)return rc;
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1 -1
@@ -96,7 +96,7 @@ static const char * const obd_connect_names[] = {"pingless" ,"flock_deadlock" ,"disp_stripe" , -"unknown" , +"open_by_fid" ,"lfsck" ,"unknown" ,NULL
Signature · 1 line
1.7.1
PATCH 64/80 staging: lustre: ptlrpc: add OBD_CONNECT_UNLINK_CLOSE flag
In reply to James SimmonsFrom: Lai Siyao <[email protected]>
Add OBD_CONNECT_UNLINK_CLOSE flag for interop, once this is supported, client packs file handle in unlink RPC, and MDT will close file before unlink.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4367
Reviewed-on: http://review.whamcloud.com/10426
--- .../lustre/lustre/include/lustre/lustre_idl.h | 1 + .../lustre/lustre/obdclass/lprocfs_status.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 3 files changed, 5 insertions(+), 0 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +1 -0
@@ -1290,6 +1290,7 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);* name in request */ #define OBD_CONNECT_LFSCK 0x40000000000000ULL/* support online LFSCK */ +#define OBD_CONNECT_UNLINK_CLOSE 0x100000000000000ULL/* close file in unlink */ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +2 -0
@@ -99,6 +99,8 @@ static const char * const obd_connect_names[] = {"open_by_fid" ,"lfsck" ,"unknown" , +"unlink_close" , +"unknown" , NULL };
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +2 -0
@@ -1073,6 +1073,8 @@ void lustre_assert_wire_constants(void) "found 0x%.16llxULL\n", OBD_CONNECT_OPEN_BY_FID);LASSERTF (OBD_CONNECT_LFSCK ==0x40000000000000ULL ,"found 0x%.16llxULL\n" ,OBD_CONNECT_LFSCK ); +LASSERTF (OBD_CONNECT_UNLINK_CLOSE ==0x100000000000000ULL ,"found 0x%.16llxULL\n" , +OBD_CONNECT_UNLINK_CLOSE );LASSERTF (OBD_CKSUM_CRC32 ==0x00000001UL ,"found 0x%.8xUL\n" , (unsigned )OBD_CKSUM_CRC32 ); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
Signature · 1 line
1.7.1
PATCH 65/80 staging: lustre: llog: keep llog ctxt indices constant
In reply to James SimmonsFrom: Mikhail Pershin <[email protected]>
The llog context id table cannot be shrunk easily because that will cause index shifting and incompatibility between old client and new server and vice versa.
Patch moves llog_ctxt_id table to the lustre_idl.h because this is wire protocol data, these values are added to the wirecheck.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5218
Reviewed-on: http://review.whamcloud.com/10758
--- .../lustre/lustre/include/lustre/lustre_idl.h | 24 +++++++++++++++++++- drivers/staging/lustre/lustre/include/obd.h | 21 ----------------- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 13 ++++++++++ 3 files changed, 36 insertions(+), 22 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +23 -1
@@ -2936,7 +2936,29 @@ enum obd_cmd { };#define OBD_FIRST_OPC OBD_PING -/* catalog of log objects */ +/** +* llog contexts indices. +* +* There is compatibility problem with indexes below, they are not +* continuous and must keep their numbers for compatibility needs. +* See LU-5218 for details. +*/ +enum llog_ctxt_id { +LLOG_CONFIG_ORIG_CTXT =0 , +LLOG_CONFIG_REPL_CTXT =1 , +LLOG_MDS_OST_ORIG_CTXT =2 , +LLOG_MDS_OST_REPL_CTXT =3 ,/* kept just to avoid re-assignment */ +LLOG_SIZE_ORIG_CTXT =4 , +LLOG_SIZE_REPL_CTXT =5 , +LLOG_TEST_ORIG_CTXT =8 , +LLOG_TEST_REPL_CTXT =9 ,/* kept just to avoid re-assignment */ +LLOG_CHANGELOG_ORIG_CTXT =12 ,/**< changelog generation on mdd */ +LLOG_CHANGELOG_REPL_CTXT =13 ,/**< changelog access on clients */ +/* for multiple changelog consumers */ +LLOG_CHANGELOG_USER_ORIG_CTXT =14 , +LLOG_AGENT_ORIG_CTXT =15 ,/**< agent requests generation on cdt */ +LLOG_MAX_CTXTS +};/** Identifier for a single log object */ struct llog_logid {
drivers/staging/lustre/lustre/include/obd.h +0 -21
@@ -172,27 +172,6 @@ struct brw_page {u32 flag; }; -/* llog contexts */ -enum llog_ctxt_id { -LLOG_CONFIG_ORIG_CTXT =0 , -LLOG_CONFIG_REPL_CTXT , -LLOG_MDS_OST_ORIG_CTXT , -LLOG_MDS_OST_REPL_CTXT , -LLOG_SIZE_ORIG_CTXT , -LLOG_SIZE_REPL_CTXT , -LLOG_RD1_ORIG_CTXT , -LLOG_RD1_REPL_CTXT , -LLOG_TEST_ORIG_CTXT , -LLOG_TEST_REPL_CTXT , -LLOG_LOVEA_ORIG_CTXT , -LLOG_LOVEA_REPL_CTXT , -LLOG_CHANGELOG_ORIG_CTXT ,/**< changelog generation on mdd */ -LLOG_CHANGELOG_REPL_CTXT ,/**< changelog access on clients */ -LLOG_CHANGELOG_USER_ORIG_CTXT ,/**< for multiple changelog consumers */ -LLOG_AGENT_ORIG_CTXT ,/**< agent requests generation on cdt */ -LLOG_MAX_CTXTS -}; -struct timeout_item {enum timeout_event ti_event;unsigned long ti_timeout;
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +13 -0
@@ -3483,6 +3483,19 @@ void lustre_assert_wire_constants(void)CLASSERT (LLOG_ORIGIN_HANDLE_DESTROY ==509 );CLASSERT (LLOG_FIRST_OPC ==501 );CLASSERT (LLOG_LAST_OPC ==510 ); +CLASSERT (LLOG_CONFIG_ORIG_CTXT ==0 ); +CLASSERT (LLOG_CONFIG_REPL_CTXT ==1 ); +CLASSERT (LLOG_MDS_OST_ORIG_CTXT ==2 ); +CLASSERT (LLOG_MDS_OST_REPL_CTXT ==3 ); +CLASSERT (LLOG_SIZE_ORIG_CTXT ==4 ); +CLASSERT (LLOG_SIZE_REPL_CTXT ==5 ); +CLASSERT (LLOG_TEST_ORIG_CTXT ==8 ); +CLASSERT (LLOG_TEST_REPL_CTXT ==9 ); +CLASSERT (LLOG_CHANGELOG_ORIG_CTXT ==12 ); +CLASSERT (LLOG_CHANGELOG_REPL_CTXT ==13 ); +CLASSERT (LLOG_CHANGELOG_USER_ORIG_CTXT ==14 ); +CLASSERT (LLOG_AGENT_ORIG_CTXT ==15 ); +CLASSERT (LLOG_MAX_CTXTS ==16 );/* Checks for struct llogd_conn_body */ LASSERTF((int)sizeof(struct llogd_conn_body) == 40, "found %lld\n",
Signature · 1 line
1.7.1
PATCH 66/80 staging: lustre: lmv: try all stripes for unknown hash functions
In reply to James SimmonsFrom: wang di <[email protected]>
For unknown hash type, LMV should try all stripes to locate the name entry. But it will only for lookup and unlink, i.e. we can only list and unlink entries under striped dir with unknown hash type.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4921
Reviewed-on: http://review.whamcloud.com/10041
--- .../lustre/lustre/include/lustre/lustre_user.h | 1 + .../staging/lustre/lustre/include/obd_support.h | 3 + drivers/staging/lustre/lustre/lmv/lmv_intent.c | 70 +++++++--- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 12 ++ drivers/staging/lustre/lustre/lmv/lmv_obd.c | 144 ++++++++++++++++---- 5 files changed, 182 insertions(+), 48 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +1 -0
@@ -383,6 +383,7 @@ struct lmv_user_mds_data { };enum lmv_hash_type { +LMV_HASH_TYPE_UNKNOWN =0 ,/* 0 is reserved for testing purpose */ LMV_HASH_TYPE_ALL_CHARS =1 ,LMV_HASH_TYPE_FNV_1A_64 =2 , };
drivers/staging/lustre/lustre/include/obd_support.h +3 -0
@@ -483,6 +483,9 @@ extern char obd_jobid_var[];#define OBD_FAIL_UPDATE_OBJ_NET 0x1700#define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701 +/* LMV */ +#define OBD_FAIL_UNKNOWN_LMV_STRIPE 0x1901 +/* Assign references to moved code to reduce code changes */ #define OBD_FAIL_PRECHECK (id) CFS_FAIL_PRECHECK(id)#define OBD_FAIL_CHECK (id) CFS_FAIL_CHECK(id)
drivers/staging/lustre/lustre/lmv/lmv_intent.c +50 -20
87 lines not on this page · raw message
drivers/staging/lustre/lustre/lmv/lmv_internal.h +12 -0
@@ -147,6 +147,18 @@ lsm_name_to_stripe_info(const struct lmv_stripe_md *lsm, const char *name,return &lsm->lsm_md_oinfo[stripe_index]; } +static inline bool lmv_is_known_hash_type (const struct lmv_stripe_md *lsm) +{ +return lsm->lsm_md_hash_type ==LMV_HASH_TYPE_FNV_1A_64 || + lsm->lsm_md_hash_type ==LMV_HASH_TYPE_ALL_CHARS ; +} + +static inline bool lmv_need_try_all_stripes (const struct lmv_stripe_md *lsm) +{ +return !lmv_is_known_hash_type (lsm) || + lsm->lsm_md_hash_type &LMV_HASH_FLAG_MIGRATION ; +} +struct lmv_tgt_desc *lmv_locate_mds (struct lmv_obd *lmv,struct md_op_data *op_data,struct lu_fid *fid);
drivers/staging/lustre/lustre/lmv/lmv_obd.c +116 -28
198 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 67/80 staging: lustre: ptlrpc: request gets stuck in UNREGISTERING phase
In reply to James SimmonsFrom: Andriy Skulysh <[email protected]>
Exit condition from UNREGISTERING phase is releasing of both reply and bulk buffers.
Call ptlrpc_unregister_bulk() if ptlrpc_unregister_reply() wasn't completed in async mode before switching to UNREGISTERING phase.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5259
Xyratex-bug-id: MRP-1960
Reviewed-on: http://review.whamcloud.com/10846
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +3 -1
@@ -1630,8 +1630,10 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) req->rq_waiting || req->rq_wait_ctx) {int status; -if (!ptlrpc_unregister_reply (req,1 )) +if (!ptlrpc_unregister_reply (req,1 )) { +ptlrpc_unregister_bulk (req,1 );continue ; + }spin_lock (&imp->imp_lock); if (ptlrpc_import_delay_req(imp, req,
Signature · 1 line
1.7.1
PATCH 68/80 staging: lustre: lmv: build master LMV EA dynamically build via readdir
In reply to James SimmonsFrom: Fan Yong <[email protected]>
When creating a striped directory, the master object saves the slave objects (or shards) as internal sub-directories. The sub-directory's name is composed of ${shard_FID}:${shard_idx}. With the name, we can easily to know what the shard is and where it should be.
On the other hand, we need to store some information related with the striped directory, such as magic, hash type, shards count, and so on. That is the LMV EA (header). We do NOT store the FID of each shard in the LMV EA. Instead, when we need the shards' FIDs (such as readdir() on client-side), we can build the entrie LMV EA on the MDT (in RAM) by iterating the sub-directory entries that are contained in the master object of the striped directroy.
Above mechanism can simplify the striped directory create operation. For very large striped directory, logging the FIDs array in the LMV EA will be trouble. It also simplify the LFSCK for verifying striped directory, because it reduces the inconsistency sources.
Another fixing is about the lmv_master_fid in master LMV EA header, it is redundant information, and may become one of the inconsistency sources. So replace it with two __u64 padding fields.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5223
Reviewed-on: http://review.whamcloud.com/10751
--- .../lustre/lustre/include/lustre/lustre_idl.h | 7 +-- drivers/staging/lustre/lustre/include/lustre_lmv.h | 30 ------------ drivers/staging/lustre/lustre/lmv/lmv_obd.c | 4 -- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 49 ++++++++++++++++++++ 4 files changed, 52 insertions(+), 38 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +3 -4
@@ -2494,10 +2494,9 @@ struct lmv_mds_md_v1 {* for example migrating or dead. */ __u32 lmv_layout_version;/* Used for directory restriping */ -__u32 lmv_padding; -struct lu_fid lmv_master_fid;/* The FID of the master object, which -* is the namespace-visible dir FID -*/ +__u32 lmv_padding1; +__u64 lmv_padding2; +__u64 lmv_padding3;char lmv_pool_name[LOV_MAXPOOLNAME ];/* pool name */ struct lu_fid lmv_stripe_fids[0 ];/* FIDs for each stripe */ };
drivers/staging/lustre/lustre/include/lustre_lmv.h +0 -30
@@ -48,7 +48,6 @@ struct lmv_stripe_md {__u32 lsm_md_layout_version;__u32 lsm_md_default_count;__u32 lsm_md_default_index; -struct lu_fid lsm_md_master_fid;char lsm_md_pool_name[LOV_MAXPOOLNAME ];struct lmv_oinfo lsm_md_oinfo[0 ]; };
@@ -90,23 +89,6 @@ static inline void lmv_free_memmd(struct lmv_stripe_md *lsm)lmv_unpack_md (NULL , &lsm,NULL ,0 ); } -static inline void lmv1_cpu_to_le (struct lmv_mds_md_v1 *lmv_dst, -const struct lmv_mds_md_v1 *lmv_src) -{ -int i; - - lmv_dst->lmv_magic =cpu_to_le32 (lmv_src->lmv_magic); - lmv_dst->lmv_stripe_count =cpu_to_le32 (lmv_src->lmv_stripe_count); - lmv_dst->lmv_master_mdt_index = -cpu_to_le32 (lmv_src->lmv_master_mdt_index); - lmv_dst->lmv_hash_type =cpu_to_le32 (lmv_src->lmv_hash_type); - lmv_dst->lmv_layout_version =cpu_to_le32 (lmv_src->lmv_layout_version); - -for (i =0 ; i < lmv_src->lmv_stripe_count; i++) -fid_cpu_to_le (&lmv_dst->lmv_stripe_fids[i], - &lmv_src->lmv_stripe_fids[i]); -} -static inline void lmv1_le_to_cpu (struct lmv_mds_md_v1 *lmv_dst,const struct lmv_mds_md_v1 *lmv_src) {
@@ -124,18 +106,6 @@ static inline void lmv1_le_to_cpu(struct lmv_mds_md_v1 *lmv_dst, &lmv_src->lmv_stripe_fids[i]); } -static inline void lmv_cpu_to_le (union lmv_mds_md *lmv_dst, -const union lmv_mds_md *lmv_src) -{ -switch (lmv_src->lmv_magic) { -case LMV_MAGIC_V1 : -lmv1_cpu_to_le (&lmv_dst->lmv_md_v1, &lmv_src->lmv_md_v1); -break ; -default : -break ; - } -} -static inline void lmv_le_to_cpu (union lmv_mds_md *lmv_dst,const union lmv_mds_md *lmv_src) {
drivers/staging/lustre/lustre/lmv/lmv_obd.c +0 -4
@@ -2773,13 +2773,9 @@ static int lmv_unpack_md_v1(struct obd_export *exp, struct lmv_stripe_md *lsm,else lsm->lsm_md_hash_type =le32_to_cpu (lmm1->lmv_hash_type); lsm->lsm_md_layout_version =le32_to_cpu (lmm1->lmv_layout_version); -fid_le_to_cpu (&lsm->lsm_md_master_fid, &lmm1->lmv_master_fid); cplen =strlcpy (lsm->lsm_md_pool_name, lmm1->lmv_pool_name,sizeof (lsm->lsm_md_pool_name)); -if (!fid_is_sane (&lsm->lsm_md_master_fid)) -return -EPROTO ; -if (cplen >=sizeof (lsm->lsm_md_pool_name))return -E2BIG ;
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +49 -0
55 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 69/80 staging: lustre: osc: Automatically increase the max_dirty_mb
In reply to James SimmonsFrom: Hongchao Zhang <[email protected]>
When RPC size or the max RPCs in flight is increased, the actual limit might be max_dirty_mb. This patch automatically increases the max_dirty_mb value at connection time and when the related values are tuned manually by proc file system.
this patch also changes the unit of "cl_dirty" and "cl_dirty_max" in client_obd from byte to page.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4933
Reviewed-on: http://review.whamcloud.com/10446
--- drivers/staging/lustre/lustre/include/obd.h | 28 +++++++++++++++++- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 12 +++++--- drivers/staging/lustre/lustre/osc/lproc_osc.c | 10 ++++--- drivers/staging/lustre/lustre/osc/osc_cache.c | 28 +++++++++--------- drivers/staging/lustre/lustre/osc/osc_request.c | 34 +++++++++++++--------- drivers/staging/lustre/lustre/ptlrpc/import.c | 1 + 6 files changed, 74 insertions(+), 39 deletions(-)
drivers/staging/lustre/lustre/include/obd.h +26 -2
@@ -222,8 +222,8 @@ struct client_obd {struct sptlrpc_flavor cl_flvr_mgc;/* fixed flavor of mgc->mgs */ /* the grant values are protected by loi_list_lock below */ -long cl_dirty;/* all _dirty_ in bytes */ -long cl_dirty_max;/* allowed w/o rpc */ +long cl_dirty_pages;/* all _dirty_ in pahges */ +long cl_dirty_max_pages;/* allowed w/o rpc */ long cl_dirty_transit;/* dirty synchronous */ long cl_avail_grant;/* bytes of credit for ost */ long cl_lost_grant;/* lost credits (trunc) */
@@ -1225,4 +1225,28 @@ static inline int cli_brw_size(struct obd_device *obd) return obd->u.cli.cl_max_pages_per_rpc << PAGE_SHIFT; } +/* +* when RPC size or the max RPCs in flight is increased, the max dirty pages +* of the client should be increased accordingly to avoid sending fragmented +* RPCs over the network when the client runs out of the maximum dirty space +* when so many RPCs are being generated. +*/ +static inline void client_adjust_max_dirty (struct client_obd *cli) +{ +/* initializing */ +if (cli->cl_dirty_max_pages <=0 ) + cli->cl_dirty_max_pages = + (OSC_MAX_DIRTY_DEFAULT *1024 *1024 ) >>PAGE_SHIFT ; +else { +long dirty_max = cli->cl_max_rpcs_in_flight * + cli->cl_max_pages_per_rpc; + +if (dirty_max > cli->cl_dirty_max_pages) + cli->cl_dirty_max_pages = dirty_max; + } + +if (cli->cl_dirty_max_pages > totalram_pages /8 ) + cli->cl_dirty_max_pages = totalram_pages /8 ; +} +#endif /* __OBD_H */
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +7 -5
@@ -299,12 +299,14 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) min_t(unsigned int, LUSTRE_CFG_BUFLEN(lcfg, 2), sizeof(server_uuid))); - cli->cl_dirty =0 ; + cli->cl_dirty_pages =0 ; cli->cl_avail_grant =0 ; -/* FIXME: Should limit this for the sum of all cl_dirty_max. */ - cli->cl_dirty_max =OSC_MAX_DIRTY_DEFAULT *1024 *1024 ; -if (cli->cl_dirty_max >>PAGE_SHIFT > totalram_pages /8 ) - cli->cl_dirty_max = totalram_pages << (PAGE_SHIFT -3 ); +/* FIXME: Should limit this for the sum of all cl_dirty_max_pages. */ +/* +* cl_dirty_max_pages may be changed@connect time in +* ptlrpc_connect_interpret(). +*/ +client_adjust_max_dirty (cli);INIT_LIST_HEAD (&cli->cl_cache_waiters);INIT_LIST_HEAD (&cli->cl_loi_ready_list);INIT_LIST_HEAD (&cli->cl_loi_hp_ready_list);
drivers/staging/lustre/lustre/osc/lproc_osc.c +6 -4
@@ -119,6 +119,7 @@ static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,spin_lock (&cli->cl_loi_list_lock); cli->cl_max_rpcs_in_flight = val; +client_adjust_max_dirty (cli);spin_unlock (&cli->cl_loi_list_lock);return count;
@@ -136,10 +137,10 @@ static ssize_t max_dirty_mb_show(struct kobject *kobj,int mult;spin_lock (&cli->cl_loi_list_lock); - val = cli->cl_dirty_max; + val = cli->cl_dirty_max_pages;spin_unlock (&cli->cl_loi_list_lock); - mult =1 <<20 ; + mult =1 << (20 -PAGE_SHIFT );return lprocfs_read_frac_helper (buf,PAGE_SIZE , val, mult); }
@@ -166,7 +167,7 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj,return -ERANGE ;spin_lock (&cli->cl_loi_list_lock); - cli->cl_dirty_max = (u32)(pages_number <<PAGE_SHIFT ); + cli->cl_dirty_max_pages = pages_number;osc_wake_cache_waiters (cli);spin_unlock (&cli->cl_loi_list_lock);
@@ -244,7 +245,7 @@ static ssize_t cur_dirty_bytes_show(struct kobject *kobj,int len;spin_lock (&cli->cl_loi_list_lock); - len =sprintf (buf,"%lu\n" , cli->cl_dirty); + len =sprintf (buf,"%lu\n" , cli->cl_dirty_pages <<PAGE_SHIFT );spin_unlock (&cli->cl_loi_list_lock);return len;
@@ -583,6 +584,7 @@ static ssize_t max_pages_per_rpc_store(struct kobject *kobj, }spin_lock (&cli->cl_loi_list_lock); cli->cl_max_pages_per_rpc = val; +client_adjust_max_dirty (cli);spin_unlock (&cli->cl_loi_list_lock);return count;
drivers/staging/lustre/lustre/osc/osc_cache.c +14 -14
@@ -1387,7 +1387,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,"dropped: %ld avail: %ld, reserved: %ld, flight: %d }" \"lru {in list: %d, left: %d, waiters: %d }" fmt, \ __tmp->cl_import->imp_obd->obd_name, \ - __tmp->cl_dirty, __tmp->cl_dirty_max, \ + __tmp->cl_dirty_pages, __tmp->cl_dirty_max_pages, \atomic_read (&obd_dirty_pages), obd_max_dirty_pages, \ __tmp->cl_lost_grant, __tmp->cl_avail_grant, \ __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, \
@@ -1403,7 +1403,7 @@ static void osc_consume_write_grant(struct client_obd *cli,assert_spin_locked (&cli->cl_loi_list_lock);LASSERT (!(pga->flag &OBD_BRW_FROM_GRANT ));atomic_inc (&obd_dirty_pages); - cli->cl_dirty +=PAGE_SIZE ; + cli->cl_dirty_pages++; pga->flag |=OBD_BRW_FROM_GRANT ;CDEBUG (D_CACHE ,"using %lu grant credits for brw %p page %p\n" ,PAGE_SIZE , pga, pga->pg);
@@ -1423,11 +1423,11 @@ static void osc_release_write_grant(struct client_obd *cli, pga->flag &= ~OBD_BRW_FROM_GRANT ;atomic_dec (&obd_dirty_pages); - cli->cl_dirty -=PAGE_SIZE ; + cli->cl_dirty_pages--;if (pga->flag &OBD_BRW_NOCACHE ) { pga->flag &= ~OBD_BRW_NOCACHE ;atomic_dec (&obd_dirty_transit_pages); - cli->cl_dirty_transit -=PAGE_SIZE ; + cli->cl_dirty_transit--; } }
@@ -1496,7 +1496,7 @@ static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages,spin_lock (&cli->cl_loi_list_lock);atomic_sub (nr_pages, &obd_dirty_pages); - cli->cl_dirty -= nr_pages <<PAGE_SHIFT ; + cli->cl_dirty_pages -= nr_pages; cli->cl_lost_grant += lost_grant;if (cli->cl_avail_grant < grant && cli->cl_lost_grant >= grant) {/* borrow some grant from truncate to avoid the case that
@@ -1509,7 +1509,7 @@ static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages,spin_unlock (&cli->cl_loi_list_lock);CDEBUG (D_CACHE ,"lost %u grant: %lu avail: %lu dirty: %lu\n" , lost_grant, cli->cl_lost_grant, - cli->cl_avail_grant, cli->cl_dirty); + cli->cl_avail_grant, cli->cl_dirty_pages <<PAGE_SHIFT ); }/**
@@ -1539,11 +1539,11 @@ static int osc_enter_cache_try(struct client_obd *cli,if (rc <0 )return 0 ; -if (cli->cl_dirty +PAGE_SIZE <= cli->cl_dirty_max && +if (cli->cl_dirty_pages <= cli->cl_dirty_max_pages &&atomic_read (&obd_dirty_pages) +1 <= obd_max_dirty_pages) {osc_consume_write_grant (cli, &oap->oap_brw_page);if (transient) { - cli->cl_dirty_transit +=PAGE_SIZE ; + cli->cl_dirty_transit++;atomic_inc (&obd_dirty_transit_pages); oap->oap_brw_flags |=OBD_BRW_NOCACHE ; }
@@ -1590,8 +1590,8 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,* of queued writes and create a discontiguous rpc stream */ if (OBD_FAIL_CHECK (OBD_FAIL_OSC_NO_GRANT ) || - cli->cl_dirty_max <PAGE_SIZE || - cli->cl_ar.ar_force_sync || loi->loi_ar.ar_force_sync) { + !cli->cl_dirty_max_pages || cli->cl_ar.ar_force_sync || + loi->loi_ar.ar_force_sync) { rc = -EDQUOT ; goto out; }
@@ -1612,7 +1612,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,init_waitqueue_head (&ocw.ocw_waitq); ocw.ocw_oap = oap; ocw.ocw_grant = bytes; -while (cli->cl_dirty >0 || cli->cl_w_in_flight >0 ) { +while (cli->cl_dirty_pages >0 || cli->cl_w_in_flight >0 ) {list_add_tail (&ocw.ocw_entry, &cli->cl_cache_waiters); ocw.ocw_rc =0 ;spin_unlock (&cli->cl_loi_list_lock);
@@ -1667,11 +1667,11 @@ void osc_wake_cache_waiters(struct client_obd *cli) ocw->ocw_rc = -EDQUOT ;/* we can't dirty more */ -if ((cli->cl_dirty +PAGE_SIZE > cli->cl_dirty_max) || +if ((cli->cl_dirty_pages > cli->cl_dirty_max_pages) || (atomic_read (&obd_dirty_pages) +1 > obd_max_dirty_pages)) {CDEBUG (D_CACHE ,"no dirty room: dirty: %ld osc max %ld, sys max %d\n" , - cli->cl_dirty, - cli->cl_dirty_max, obd_max_dirty_pages); + cli->cl_dirty_pages, cli->cl_dirty_max_pages, + obd_max_dirty_pages); goto wakeup; }
drivers/staging/lustre/lustre/osc/osc_request.c +20 -14
@@ -801,11 +801,12 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, oa->o_valid |= bits;spin_lock (&cli->cl_loi_list_lock); - oa->o_dirty = cli->cl_dirty; -if (unlikely (cli->cl_dirty - cli->cl_dirty_transit > - cli->cl_dirty_max)) { + oa->o_dirty = cli->cl_dirty_pages <<PAGE_SHIFT ; +if (unlikely (cli->cl_dirty_pages - cli->cl_dirty_transit > + cli->cl_dirty_max_pages)) {CERROR ("dirty %lu - %lu > dirty_max %lu\n" , - cli->cl_dirty, cli->cl_dirty_transit, cli->cl_dirty_max); + cli->cl_dirty_pages, cli->cl_dirty_transit, + cli->cl_dirty_max_pages); oa->o_undirty =0 ; } else if (unlikely(atomic_read(&obd_dirty_pages) - atomic_read(&obd_dirty_transit_pages) >
@@ -820,15 +821,17 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,atomic_read (&obd_dirty_transit_pages), obd_max_dirty_pages); oa->o_undirty =0 ; - }else if (unlikely (cli->cl_dirty_max - cli->cl_dirty >0x7fffffff )) { + }else if (unlikely (cli->cl_dirty_max_pages - cli->cl_dirty_pages > +0x7fffffff )) {CERROR ("dirty %lu - dirty_max %lu too big???\n" , - cli->cl_dirty, cli->cl_dirty_max); + cli->cl_dirty_pages, cli->cl_dirty_max_pages); oa->o_undirty =0 ; }else {long max_in_flight = (cli->cl_max_pages_per_rpc <<PAGE_SHIFT )* (cli->cl_max_rpcs_in_flight +1 ); - oa->o_undirty =max (cli->cl_dirty_max, max_in_flight); + oa->o_undirty =max (cli->cl_dirty_max_pages <<PAGE_SHIFT , + max_in_flight); } oa->o_grant = cli->cl_avail_grant + cli->cl_reserved_grant; oa->o_dropped = cli->cl_lost_grant;
@@ -1028,22 +1031,24 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) {/* * ocd_grant is the total grant amount we're expect to hold: if we've -* been evicted, it's the new avail_grant amount, cl_dirty will drop -* to 0 as inflight RPCs fail out; otherwise, it's avail_grant + dirty. +* been evicted, it's the new avail_grant amount, cl_dirty_pages will +* drop to 0 as inflight RPCs fail out; otherwise, it's avail_grant + +* dirty. * * race is tolerable here: if we're evicted, but imp_state already -* left EVICTED state, then cl_dirty must be 0 already. +* left EVICTED state, then cl_dirty_pages must be 0 already. */ spin_lock (&cli->cl_loi_list_lock);if (cli->cl_import->imp_state ==LUSTRE_IMP_EVICTED ) cli->cl_avail_grant = ocd->ocd_grant;else - cli->cl_avail_grant = ocd->ocd_grant - cli->cl_dirty; + cli->cl_avail_grant = ocd->ocd_grant - + (cli->cl_dirty_pages <<PAGE_SHIFT );if (cli->cl_avail_grant <0 ) {CWARN ("%s: available grant < 0: avail/ocd/dirty %ld/%u/%ld\n" , cli->cl_import->imp_obd->obd_name, cli->cl_avail_grant, - ocd->ocd_grant, cli->cl_dirty); + ocd->ocd_grant, cli->cl_dirty_pages <<PAGE_SHIFT );/* workaround for servers which do not have the patch from * LU-2679 */
@@ -3014,8 +3019,9 @@ static int osc_reconnect(const struct lu_env *env,long lost_grant;spin_lock (&cli->cl_loi_list_lock); - data->ocd_grant = (cli->cl_avail_grant + cli->cl_dirty) ?: -2 *cli_brw_size (obd); + data->ocd_grant = (cli->cl_avail_grant + + (cli->cl_dirty_pages <<PAGE_SHIFT )) ?: +2 *cli_brw_size (obd); lost_grant = cli->cl_lost_grant; cli->cl_lost_grant =0 ;spin_unlock (&cli->cl_loi_list_lock);
drivers/staging/lustre/lustre/ptlrpc/import.c +1 -0
@@ -1132,6 +1132,7 @@ finish:LASSERT ((cli->cl_max_pages_per_rpc <=PTLRPC_MAX_BRW_PAGES ) && (cli->cl_max_pages_per_rpc >0 )); +client_adjust_max_dirty (cli); } out:
Signature · 1 line
1.7.1
PATCH 70/80 staging: lustre: include: fix one off errors in lustre_id.h
In reply to James SimmonsDuring inspection of another patch Dan Carpenter noticed some one off errors in lustre_id.h. Fix the condition test for OBIF_MAX_OID.
--- .../lustre/lustre/include/lustre/lustre_idl.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +2 -2
@@ -659,7 +659,7 @@ static inline void ostid_set_id(struct ost_id *oi, __u64 oid) oi->oi_fid.f_oid = oid; oi->oi_fid.f_ver = oid >>48 ; }else { -if (oid >OBIF_MAX_OID ) { +if (oid >=OBIF_MAX_OID ) {CERROR ("Bad %llu to set " DOSTID "\n" , oid,POSTID (oi));return ; }
@@ -684,7 +684,7 @@ static inline int fid_set_id(struct lu_fid *fid, __u64 oid) fid->f_oid = oid; fid->f_ver = oid >>48 ; }else { -if (oid >OBIF_MAX_OID ) { +if (oid >=OBIF_MAX_OID ) {CERROR ("Too large OID %#llx to set REG " DFID "\n" , (unsigned long long )oid,PFID (fid));return -EBADF ;
Signature · 1 line
1.7.1
PATCH 71/80 staging: lustre: llite: remove assert for acl refcount
In reply to James SimmonsThe purpose of this asssert to was to ensure lustre was properly managing its posix_acl access. This test is invalid due to the VFS layer also taking references on the posix_acl. In reality their is no simple way to detect this class of mistakes.
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +0 -1
@@ -1247,7 +1247,6 @@ void ll_clear_inode(struct inode *inode)#ifdef CONFIG_FS_POSIX_ACL if (lli->lli_posix_acl) { -LASSERT (atomic_read (&lli->lli_posix_acl->a_refcount) ==1 );posix_acl_release (lli->lli_posix_acl); lli->lli_posix_acl =NULL ; }
Signature · 1 line
1.7.1
PATCH 72/80 staging: lustre: obd: validate open handle cookies
In reply to James SimmonsFrom: John L. Hammond <[email protected]>
Add a const void *h_owner member to struct portals_handle. Add a const void *owner parameter to class_handle2object() which must be matched by the h_owner member of the handle in addition to the cookie.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3233
Reviewed-on: http://review.whamcloud.com/6938
--- .../staging/lustre/lustre/include/lustre_handles.h | 3 ++- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- .../lustre/lustre/obdclass/lustre_handles.c | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/include/lustre_handles.h +2 -1
@@ -66,6 +66,7 @@ struct portals_handle_ops {struct portals_handle {struct list_head h_link;__u64 h_cookie; +const void *h_owner;struct portals_handle_ops *h_ops;/* newly added fields to handle the RCU issue. -jxiong */
@@ -83,7 +84,7 @@ struct portals_handle {void class_handle_hash (struct portals_handle *,struct portals_handle_ops *ops);void class_handle_unhash (struct portals_handle *); -void *class_handle2object (__u64 cookie); +void *class_handle2object (__u64 cookie,const void *owner);void class_handle_free_cb (struct rcu_head *rcu);int class_handle_init (void );void class_handle_cleanup (void );
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
@@ -542,7 +542,7 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle,LASSERT (handle); - lock =class_handle2object (handle->cookie); + lock =class_handle2object (handle->cookie,NULL );if (!lock)return NULL ;
drivers/staging/lustre/lustre/obdclass/genops.c +1 -1
@@ -618,7 +618,7 @@ struct obd_export *class_conn2export(struct lustre_handle *conn) }CDEBUG (D_INFO ,"looking for export cookie %#llx\n" , conn->cookie); - export =class_handle2object (conn->cookie); + export =class_handle2object (conn->cookie,NULL );return export; }EXPORT_SYMBOL (class_conn2export);
drivers/staging/lustre/lustre/obdclass/lustre_handles.c +2 -2
@@ -130,7 +130,7 @@ void class_handle_unhash(struct portals_handle *h) }EXPORT_SYMBOL (class_handle_unhash); -void *class_handle2object (__u64 cookie) +void *class_handle2object (__u64 cookie,const void *owner) {struct handle_bucket *bucket;struct portals_handle *h;
@@ -145,7 +145,7 @@ void *class_handle2object(__u64 cookie)rcu_read_lock ();list_for_each_entry_rcu (h, &bucket->head, h_link) { -if (h->h_cookie != cookie) +if (h->h_cookie != cookie || h->h_owner != owner)continue ;spin_lock (&h->h_lock);
Signature · 1 line
1.7.1
PATCH 73/80 staging: lustre: lmv: build error with gcc 4.7.0 20110509
In reply to James SimmonsFrom: Dmitry Eremin <[email protected]>
Fixed comparison between signed and unsigned indexes.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3775
Reviewed-on: http://review.whamcloud.com/7382
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 34 ++++++++++++++------------ 1 files changed, 18 insertions(+), 16 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +18 -16
@@ -130,12 +130,12 @@ static void lmv_activate_target(struct lmv_obd *lmv,* -ENOTCONN: The UUID is found, but the target connection is bad (!) * -EBADF : The UUID is found, but the OBD of the wrong type (!) */ -static int lmv_set_mdc_active (struct lmv_obd *lmv,struct obd_uuid *uuid, +static int lmv_set_mdc_active (struct lmv_obd *lmv,const struct obd_uuid *uuid,int activate) {struct lmv_tgt_desc *uninitialized_var (tgt );struct obd_device *obd; -int i; +u32 i;int rc =0 ; CDEBUG(D_INFO, "Searching in lmv %p for uuid %s (activate=%d)\n",
@@ -307,7 +307,7 @@ static int lmv_connect(const struct lu_env *env,static void lmv_set_timeouts (struct obd_device *obd) {struct lmv_obd *lmv; -int i; +u32 i; lmv = &obd->u.lmv;if (lmv->server_timeout ==0 )
@@ -333,7 +333,7 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize, {struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv; -int i; +u32 i;int rc =0 ;int change =0 ;
@@ -578,7 +578,7 @@ int lmv_check_connect(struct obd_device *obd) {struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *tgt; -int i; +u32 i;int rc;int easize;
@@ -693,7 +693,7 @@ static int lmv_disconnect(struct obd_export *exp)struct obd_device *obd =class_exp2obd (exp);struct lmv_obd *lmv = &obd->u.lmv;int rc; -int i; +u32 i;if (!lmv->tgts) goto out_local;
@@ -822,7 +822,7 @@ static int lmv_hsm_req_count(struct lmv_obd *lmv,const struct hsm_user_request *hur, const struct lmv_tgt_desc *tgt_mds) { - int i, nr = 0; + u32 i, nr = 0;struct lmv_tgt_desc *curr_tgt;/* count how many requests must be sent to the given target */
@@ -963,10 +963,10 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,struct obd_device *obddev =class_exp2obd (exp);struct lmv_obd *lmv = &obddev->u.lmv;struct lmv_tgt_desc *tgt =NULL ; -int i =0 ; +u32 i =0 ;int rc =0 ;int set =0 ; -int count = lmv->desc.ld_tgt_count; +u32 count = lmv->desc.ld_tgt_count;if (count ==0 )return -ENOTTY ;
@@ -1444,7 +1444,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,struct lmv_obd *lmv = &obd->u.lmv;struct obd_statfs *temp;int rc =0 ; -int i; +u32 i; rc =lmv_check_connect (obd);if (rc)
@@ -1586,7 +1586,7 @@ static int lmv_null_inode(struct obd_export *exp, const struct lu_fid *fid) {struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv; -int i; +u32 i;int rc; rc =lmv_check_connect (obd);
@@ -1615,7 +1615,7 @@ static int lmv_find_cbdata(struct obd_export *exp, const struct lu_fid *fid,struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv;int tgt; -int i; +u32 i;int rc; rc =lmv_check_connect (obd);
@@ -2923,7 +2923,7 @@ static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,struct lmv_obd *lmv = &obd->u.lmv;int rc =0 ;int err; -int i; +u32 i;LASSERT (fid);
@@ -2966,7 +2966,7 @@ static enum ldlm_mode lmv_lock_match(struct obd_export *exp, __u64 flags,struct lmv_obd *lmv = &obd->u.lmv;enum ldlm_mode rc;int tgt; -int i; +u32 i;CDEBUG (D_INODE ,"Lock match for " DFID "\n" ,PFID (fid));
@@ -3125,8 +3125,9 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp,struct obd_device *obd =class_exp2obd (exp);struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *tgt = lmv->tgts[0 ]; -int rc =0 , i; +int rc =0 ;__u64 curspace =0 , curinodes =0 ; +u32 i;if (!tgt || !tgt->ltd_exp || !tgt->ltd_active || !lmv->desc.ld_tgt_count) {
@@ -3169,7 +3170,8 @@ static int lmv_quotacheck(struct obd_device *unused, struct obd_export *exp,struct obd_device *obd =class_exp2obd (exp);struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *tgt; -int i, rc =0 ; +int rc =0 ; +u32 i;for (i =0 ; i < lmv->desc.ld_tgt_count; i++) {int err;
Signature · 1 line
1.7.1
PATCH 74/80 staging: lustre: obd: implement md_read_page
In reply to James SimmonsFrom: wang di <[email protected]>
This patch adds md_read_page which is a new more flexiable api that will replace md_readpage.
Reviewed-on: http://review.whamcloud.com/10761
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4906
--- drivers/staging/lustre/lustre/include/obd.h | 13 ++++++++++++- drivers/staging/lustre/lustre/include/obd_class.h | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/include/obd.h +12 -1
@@ -830,6 +830,15 @@ struct md_op_data {struct lustre_handle op_lease_handle; }; +#define op_stripe_offset op_ioepoch +#define op_max_pages op_valid + +struct md_callback { +int (*md_blocking_ast)(struct ldlm_lock *lock, +struct ldlm_lock_desc *desc, +void *data,int flag); +}; +enum op_cli_flags {CLI_SET_MEA =1 <<0 ,CLI_RM_ENTRY =1 <<1 ,
@@ -1039,7 +1048,9 @@ struct md_ops { struct ptlrpc_request **); int (*readpage)(struct obd_export *, struct md_op_data *,struct page **,struct ptlrpc_request **); - +int (*read_page)(struct obd_export *,struct md_op_data *, +struct md_callback *cb_op,__u64 hash_offset, +struct page **ppage);int (*unlink)(struct obd_export *,struct md_op_data *,struct ptlrpc_request **);
drivers/staging/lustre/lustre/include/obd_class.h +15 -0
@@ -1535,6 +1535,21 @@ static inline int md_readpage(struct obd_export *exp, struct md_op_data *opdata,return rc; } +static inline int md_read_page (struct obd_export *exp, +struct md_op_data *op_data, +struct md_callback *cb_op, +__u64 hash_offset, +struct page **ppage) +{ +int rc; + +EXP_CHECK_MD_OP (exp, read_page); +EXP_MD_COUNTER_INCREMENT (exp, read_page); + rc =MDP (exp->exp_obd, read_page)(exp, op_data, cb_op, hash_offset, + ppage); +return rc; +} +static inline int md_unlink (struct obd_export *exp,struct md_op_data *op_data,struct ptlrpc_request **request) {
Signature · 1 line
1.7.1
PATCH 75/80 staging: lustre: llite: set op_max_pages
In reply to James SimmonsFrom: wang di <[email protected]>
Cache the maximum allowed pages supported by the llite layer. This value will be used in the mdc and lmv layer.
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
--- drivers/staging/lustre/lustre/llite/dir.c | 1 + drivers/staging/lustre/lustre/llite/llite_nfs.c | 1 + drivers/staging/lustre/lustre/llite/statahead.c | 6 ++++++ 3 files changed, 8 insertions(+), 0 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +1 -0
@@ -649,6 +649,7 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) } } } + op_data->op_max_pages = sbi->ll_md_brw_pages; ctx->pos = pos; rc =ll_dir_read (inode, &pos, op_data, ctx); pos = ctx->pos;
drivers/staging/lustre/lustre/llite/llite_nfs.c +1 -0
@@ -276,6 +276,7 @@ static int ll_get_name(struct dentry *dentry, char *name, goto out; } + op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages;inode_lock (dir); rc =ll_dir_read (dir, &pos, op_data, &lgd.ctx);inode_unlock (dir);
drivers/staging/lustre/lustre/llite/statahead.c +6 -0
@@ -1052,6 +1052,8 @@ static int ll_statahead_thread(void *arg)if (IS_ERR (op_data))return PTR_ERR (op_data); + op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages; +if (sbi->ll_flags &LL_SBI_AGL_ENABLED )ll_start_agl (parent, sai);
@@ -1355,6 +1357,10 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) LUSTRE_OPC_ANY, dir);if (IS_ERR (op_data))return PTR_ERR (op_data); +/** +* FIXME choose the start offset of the readdir +*/ + op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages;ll_dir_chain_init (&chain); page =ll_get_dir_page (dir, op_data, pos, &chain);
Signature · 1 line
1.7.1
PATCH 76/80 staging: lustre: lnet: Do not drop message when shutting down LNet
In reply to James SimmonsFrom: Doug Oucharek <[email protected]>
There is a case in lnet_parse() where we discover that LNet is shutting down but we continue to use the NI when we drop the message and end up calling ko2iblnd_check_send_locked() which tries to allocate from the Tx pool which has been cleaned up already. This triggers a NULL pointer dereference.
This fix just returns from lnet_parse() when we disover LNet is shutting down.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8106
Reviewed-on: http://review.whamcloud.com/19993
--- drivers/staging/lustre/lnet/lnet/lib-move.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-move.c +3 -0
@@ -2002,6 +2002,9 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid,libcfs_nid2str (from_nid),libcfs_nid2str (src_nid), lnet_msgtyp2str(type), rc);lnet_msg_free (msg); +if (rc == -ESHUTDOWN ) +/* We are shutting down. Don't do anything more */ +return 0 ; goto drop; }
Signature · 1 line
1.7.1
PATCH 77/80 staging: lustre: lnet: Correct position of lnet_ni_decref()
In reply to James SimmonsFrom: Doug Oucharek <[email protected]>
In fix http://review.whamcloud.com/#/c/19614/, the call to lnet_ni_decref() should have followed the routines which are using the NI. This patch correct that.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8022
Reviewed-on: http://review.whamcloud.com/21001
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +1 -1
@@ -2526,9 +2526,9 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob) failed:if (ni) { -lnet_ni_decref (ni); rej.ibr_cp.ibcp_queue_depth =kiblnd_msg_queue_size (version, ni); rej.ibr_cp.ibcp_max_frags =kiblnd_rdma_frags (version, ni); +lnet_ni_decref (ni); } rej.ibr_version = version;
Signature · 1 line
1.7.1
PATCH 78/80 staging: lustre: lnet: make connection more stable with packet loss
In reply to James SimmonsFrom: Alexander Boyko <[email protected]>
IB network may lose last connection handshake packet. This problem isn't Lustre specific and described at
https://oss.oracle.com/pipermail/rds-devel/2007-December/000271.html
for example. Solution is to make conection established if any packet is received for it.
Seagate-bug-id: MRP-2883
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8303
Reviewed-on: http://review.whamcloud.com/20874
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +6 -0
@@ -3419,6 +3419,12 @@ kiblnd_qp_event(struct ib_event *event, void *arg)case IB_EVENT_COMM_EST :CDEBUG (D_NET ,"%s established\n" ,libcfs_nid2str (conn->ibc_peer->ibp_nid)); +/* +* We received a packet but connection isn't established +* probably handshake packet was lost, so free to +* force make connection established +*/ +rdma_notify (conn->ibc_cmid,IB_EVENT_COMM_EST );return ;default :
Signature · 1 line
1.7.1