staging/lustre: sync with extern tree, set 2
v2 cover staging/lustre: sync with extern tree, set 2
Hi Greg,
PATCH 1 reverts previous commit ad8dbc9. I forgot to remove it from my local queue after the discussion last time and ended up resending it. Sorry for the noise...
PATCH 2 is updated to fix checkpatch error about return().
PATCH 3 and 4 are extracted from one external tree commit to do separate things. PATCH 5 and 6 are from one external tree commit as well for the same reason. PATCh 12 is updated to remove extra GPL notice that kernel already has one.
Please see if they can be merged.
Thanks,
Tao
Amir Shehata (1):
staging/lustre/ptlrpc: Fix a crash when dereferencing NULL pointer
Andrew Perepechko (1):
staging/lustre/llite: extended attribute cache
Dmitry Eremin (2):
staging/lustre/build: clean up unused variables and dead code staging/lustre/build: fix compilation issue with is_compat_task
Fan Yong (2):
staging/lustre/scrub: OI scrub on OST
staging/lustre: make code align in lma_incompat
JC Lafoucriere (2):
staging/lustre: constify uuid argument of obd_uuid2str staging/lustre: make obd_uuid_equals return bool
Jinshan Xiong (1):
staging/lustre/hsm: Add hsm_release feature.
John L. Hammond (1):
staging/lustre/llite: don't check for O_CREAT in it_create_mode
Mikhail Pershin (1):
staging/lustre/llog: MGC to use OSD API for backup logs
Peng Tao (1):
Revert "staging/lustre/nfs: writing to new files will return ENOENT"
.../staging/lustre/include/linux/libcfs/libcfs.h | 2 - drivers/staging/lustre/lnet/selftest/rpc.c | 2 - drivers/staging/lustre/lnet/selftest/selftest.h | 3 - drivers/staging/lustre/lnet/selftest/timer.c | 6 +- drivers/staging/lustre/lustre/include/dt_object.h | 2 +- .../lustre/lustre/include/linux/lustre_compat25.h | 4 +- .../lustre/lustre/include/linux/lustre_lite.h | 1 + .../lustre/lustre/include/lustre/lustre_idl.h | 41 +- .../lustre/lustre/include/lustre/lustre_user.h | 17 +- drivers/staging/lustre/lustre/include/lustre_ha.h | 3 - drivers/staging/lustre/lustre/include/lustre_log.h | 13 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 - .../lustre/lustre/include/lustre_req_layout.h | 5 + drivers/staging/lustre/lustre/include/md_object.h | 4 +- drivers/staging/lustre/lustre/include/obd.h | 15 +- .../staging/lustre/lustre/include/obd_support.h | 2 + .../staging/lustre/lustre/lclient/lcommon_misc.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 + drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 3 - drivers/staging/lustre/lustre/libcfs/workitem.c | 56 +- drivers/staging/lustre/lustre/llite/Makefile | 2 +- drivers/staging/lustre/lustre/llite/dcache.c | 36 +- drivers/staging/lustre/lustre/llite/dir.c | 24 +- drivers/staging/lustre/lustre/llite/file.c | 105 +++- .../staging/lustre/lustre/llite/llite_internal.h | 46 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 23 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 37 ++ drivers/staging/lustre/lustre/llite/namei.c | 15 +- drivers/staging/lustre/lustre/llite/super25.c | 4 + drivers/staging/lustre/lustre/llite/vvp_object.c | 2 +- drivers/staging/lustre/lustre/llite/xattr.c | 102 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 617 ++++++++++++++++++++ .../staging/lustre/lustre/lov/lov_cl_internal.h | 16 + drivers/staging/lustre/lustre/lov/lov_object.c | 35 +- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 1 + drivers/staging/lustre/lustre/mdc/mdc_lib.c | 26 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 63 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 23 +- drivers/staging/lustre/lustre/mgc/libmgc.c | 3 - drivers/staging/lustre/lustre/mgc/mgc_request.c | 401 ++++++++----- drivers/staging/lustre/lustre/obdclass/llog.c | 212 ++++--- .../staging/lustre/lustre/obdclass/local_storage.c | 9 +- .../staging/lustre/lustre/obdclass/local_storage.h | 3 + .../lustre/lustre/obdclass/lprocfs_status.c | 4 - drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 3 + drivers/staging/lustre/lustre/ptlrpc/client.c | 10 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 - drivers/staging/lustre/lustre/ptlrpc/layout.c | 53 ++ drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 16 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 7 + drivers/staging/lustre/lustre/ptlrpc/pinger.c | 65 --- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 44 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 4 + 54 files changed, 1659 insertions(+), 543 deletions(-) create mode 100644 drivers/staging/lustre/lustre/llite/xattr_cache.c
Signature · 1 line
1.7.9.5
PATCH v2 1/12 Revert "staging/lustre/nfs: writing to new files will return ENOENT"
This reverts commit ad8dbc93a464869f64365a2123b3491965df3b3e.
The original commit was reverted in Lustre tree this due to interoperability problems with 2.1 servers. But I forgot to remove it from my patch queue. sorry for the noise.
--- drivers/staging/lustre/lustre/llite/file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +3 -2
@@ -368,6 +368,8 @@ static int ll_intent_file_open(struct file *file, void *lmm, {struct ll_sb_info *sbi =ll_i2sbi (file->f_dentry->d_inode);struct dentry *parent = file->f_dentry->d_parent; +const char *name = file->f_dentry->d_name.name; +const int len = file->f_dentry->d_name.len;struct md_op_data *op_data;struct ptlrpc_request *req;__u32 opc =LUSTRE_OPC_ANY ;
@@ -392,9 +394,8 @@ static int ll_intent_file_open(struct file *file, void *lmm, } op_data =ll_prep_md_op_data (NULL , parent->d_inode, - file->f_dentry->d_inode,NULL ,0 , + file->f_dentry->d_inode, name, len,O_RDWR , opc,NULL ); -if (IS_ERR (op_data))return PTR_ERR (op_data);
Signature · 1 line
1.7.9.5
PATCH v2 2/12 staging/lustre/llog: MGC to use OSD API for backup logs
In reply to Peng TaoFrom: Mikhail Pershin <[email protected]>
MGC uses lvfs API to access local llogs blocking removal of old code
- MGS is converted to use OSD API for local llogs
- llog_is_empty() and llog_backup() are introduced
- initial OSD start initialize run ctxt so llog can use it too
- shrink dcache after initial scrub in osd-ldiskfs to avoid holding data of unlinked objects until umount.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2059
Lustre-change: http://review.whamcloud.com/5049
--- drivers/staging/lustre/lustre/include/dt_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre_log.h | 13 +- drivers/staging/lustre/lustre/include/obd.h | 4 +- drivers/staging/lustre/lustre/mgc/libmgc.c | 3 - drivers/staging/lustre/lustre/mgc/mgc_request.c | 401 ++++++++++++-------- drivers/staging/lustre/lustre/obdclass/llog.c | 212 +++++++---- .../staging/lustre/lustre/obdclass/local_storage.c | 9 +- .../staging/lustre/lustre/obdclass/local_storage.h | 3 + drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 3 + 10 files changed, 408 insertions(+), 244 deletions(-)
drivers/staging/lustre/lustre/include/dt_object.h +1 -1
@@ -692,7 +692,7 @@ struct local_oid_storage {struct dt_object *los_obj;/* data used to generate new fids */ -struct mutex los_id_lock; +struct mutex los_id_lock;__u64 los_seq;__u32 los_last_oid; };
drivers/staging/lustre/lustre/include/lustre_log.h +12 -1
@@ -136,7 +136,11 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt, struct llog_handle **lgh, struct llog_logid *logid, char *name, enum llog_open_param open_param);int llog_close (const struct lu_env *env,struct llog_handle *cathandle); -int llog_get_size (struct llog_handle *loghandle); +int llog_is_empty (const struct lu_env *env,struct llog_ctxt *ctxt, +char *name); +int llog_backup (const struct lu_env *env,struct obd_device *obd, +struct llog_ctxt *ctxt,struct llog_ctxt *bak_ctxt, +char *name,char *backup);/* llog_process flags */ #define LLOG_FLAG_NODEAMON 0x0001
@@ -382,6 +386,13 @@ static inline int llog_data_len(int len)return cfs_size_round (len); } +static inline int llog_get_size (struct llog_handle *loghandle) +{ +if (loghandle && loghandle->lgh_hdr) +return loghandle->lgh_hdr->llh_count; +return 0 ; +} +static inline struct llog_ctxt *llog_ctxt_get (struct llog_ctxt *ctxt) {atomic_inc (&ctxt->loc_refcount);
drivers/staging/lustre/lustre/include/obd.h +2 -2
@@ -399,8 +399,8 @@ struct client_obd {/* mgc datastruct */ struct semaphore cl_mgc_sem; -struct vfsmount *cl_mgc_vfsmnt; -struct dentry *cl_mgc_configs_dir; +struct local_oid_storage *cl_mgc_los; +struct dt_object *cl_mgc_configs_dir;atomic_t cl_mgc_refcount;struct obd_export *cl_mgc_mgsexp;
drivers/staging/lustre/lustre/mgc/libmgc.c +0 -3
@@ -99,11 +99,8 @@ static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)static int mgc_cleanup (struct obd_device *obd) { -struct client_obd *cli = &obd->u.cli;int rc; -LASSERT (cli->cl_mgc_vfsmnt ==NULL ); -ptlrpcd_decref (); rc =client_obd_cleanup (obd);
drivers/staging/lustre/lustre/mgc/mgc_request.c +246 -155
527 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/llog.c +134 -78
258 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/local_storage.c +6 -3
@@ -855,9 +855,12 @@ out_los: (*los)->los_seq =fid_seq (first_fid); (*los)->los_last_oid =le64_to_cpu (lastid); (*los)->los_obj = o; -/* read value should not be less than initial one */ -LASSERTF ((*los)->los_last_oid >= first_oid,"%u < %u\n" , - (*los)->los_last_oid, first_oid); +/* Read value should not be less than initial one +* but possible after upgrade from older fs. +* In this case just switch to the first_oid in memory and +* it will be updated on disk with first object generated */ +if ((*los)->los_last_oid < first_oid) + (*los)->los_last_oid = first_oid; } out:mutex_unlock (&ls->ls_los_mutex);
drivers/staging/lustre/lustre/obdclass/local_storage.h +3 -0
@@ -29,6 +29,8 @@* * Author: Mikhail Pershin <[email protected]> */ +#ifndef __LOCAL_STORAGE_H +#define __LOCAL_STORAGE_H#include <dt_object.h> #include <obd.h>
@@ -86,3 +88,4 @@ struct los_ondisk { };#define LOS_MAGIC 0xdecafbee +#endif
drivers/staging/lustre/lustre/obdclass/lu_object.c +1 -1
@@ -429,7 +429,7 @@ LU_KEY_INIT_FINI(lu_global, struct lu_cdebug_data);*/ struct lu_context_key lu_global_key = { .lct_tags =LCT_MD_THREAD |LCT_DT_THREAD | -LCT_MG_THREAD |LCT_CL_THREAD , +LCT_MG_THREAD |LCT_CL_THREAD |LCT_LOCAL , .lct_init = lu_global_key_init, .lct_fini = lu_global_key_fini };
drivers/staging/lustre/lustre/obdclass/obd_mount.c +3 -0
@@ -631,6 +631,9 @@ int lustre_put_lsi(struct super_block *sb)CDEBUG (D_MOUNT ,"put %p %d\n" , sb,atomic_read (&lsi->lsi_mounts));if (atomic_dec_and_test (&lsi->lsi_mounts)) {if (IS_SERVER (lsi) && lsi->lsi_osd_exp) { +lu_device_put (&lsi->lsi_dt_dev->dd_lu_dev); + lsi->lsi_osd_exp->exp_obd->obd_lvfs_ctxt.dt =NULL ; + lsi->lsi_dt_dev =NULL ;obd_disconnect (lsi->lsi_osd_exp);/* wait till OSD is gone */ obd_zombie_barrier ();
Signature · 1 line
1.7.9.5
Re: [PATCH v2 02/12] staging/lustre/llog: MGC to use OSD API for backup logs
Hi,
just a few comments, mostly code style.
2013-11-26 16:04, Peng Tao:
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1
-1@@ -1011,23 +1083,17 @@ int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, }if (KEY_IS (KEY_SET_FS )) {struct super_block *sb = (struct super_block *)val; -struct lustre_sb_info *lsi; +
drivers/staging/lustre/lustre/mgc/mgc_request.c int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1091
Quoted 10 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +2
-5if (vallen !=sizeof (struct super_block ))return -EINVAL ; - lsi =s2lsi (sb); - rc =mgc_fs_setup (exp->exp_obd, sb, lsi->lsi_srv_mnt); -if (rc) { -CERROR ("set_fs got %d\n" , rc); - } + + rc =mgc_fs_setup (exp->exp_obd, sb);return rc;
Why set rc when you return it on the next statement? Wouldn't 'return mgc_fs_setup(exp->exp_obd, sb);' be better?
drivers/staging/lustre/lustre/mgc/mgc_request.c int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1097
Quoted 9 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-3}if (KEY_IS (KEY_CLEAR_FS )) {if (vallen !=0 )return -EINVAL ; rc =mgc_fs_cleanup (exp->exp_obd); -if (rc) { -CERROR ("clear_fs got %d\n" , rc); - }return rc;
Same here possibly.
drivers/staging/lustre/lustre/mgc/mgc_request.c static int mgc_process_cfg_log(struct obd_device *mgc, · line 1650
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +6
-0+/* Copy the setup log locally if we can. Don't mess around if we're +* running an MGS though (logs are already local). */ +if (lctxt && lsi &&IS_SERVER (lsi) && !IS_MGS (lsi) && + cli->cl_mgc_configs_dir !=NULL && +lu2dt_dev (cli->cl_mgc_configs_dir->do_lu.lo_dev) == + lsi->lsi_dt_dev) {
I think that is *really* ugly!
(The last comparison is separated into two lines)
Signature · 2 lines
Regards, Levente Kurusa
PATCH v2 3/12 staging/lustre: constify uuid argument of obd_uuid2str
In reply to Peng TaoFrom: JC Lafoucriere <[email protected]>
This is only part of the original Lustre tree commit. Main part of the original commit changes server code and is unneeded at client side.
Lustre-change: http://review.whamcloud.com/6534
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3342
--- .../lustre/lustre/include/lustre/lustre_user.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +1 -1
@@ -446,7 +446,7 @@ static inline void obd_str2uuid(struct obd_uuid *uuid, const char *tmp) }/* For printf's only, make sure uuid is terminated */ -static inline char *obd_uuid2str (struct obd_uuid *uuid) +static inline char *obd_uuid2str (const struct obd_uuid *uuid) {if (uuid->uuid[sizeof (*uuid) -1 ] !='\0' ) {/* Obviously not safe, but for printfs, no real harm done...
Signature · 1 line
1.7.9.5
PATCH v2 4/12 staging/lustre: make obd_uuid_equals return bool
In reply to Peng TaoFrom: JC Lafoucriere <[email protected]>
This is only part of the original Lustre tree commit. Main part of the original commit changes server code and is unneeded at client side.
Lustre-change: http://review.whamcloud.com/6534
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3342
--- .../lustre/lustre/include/lustre/lustre_user.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +2 -2
@@ -428,8 +428,8 @@ struct obd_uuid {char uuid[UUID_MAX ]; }; -static inline int obd_uuid_equals (const struct obd_uuid *u1, -const struct obd_uuid *u2) +static inline bool obd_uuid_equals (const struct obd_uuid *u1, +const struct obd_uuid *u2) {return strcmp ((char *)u1->uuid, (char *)u2->uuid) ==0 ; }
Signature · 1 line
1.7.9.5
PATCH v2 5/12 staging/lustre/scrub: OI scrub on OST
In reply to Peng TaoFrom: Fan Yong <[email protected]>
Main part of original patch in Lustre tree
(http://review.whamcloud.com/6669) changes server code and is unneeded by client. The patch only picks up common functions and data structures change.
Quoting original commit message here:
"
OI scrub should has the ability to handle kinds of OI, including both the OI files on MDT and the /O directory on OST.
We trust the FID in LMA for both MDT objects and OST objects. So if some /O sub-item does not match related LMA, then the /O will be updated, instead of the LMA.
To guarantee that the OI scrub can run without MDT0 involved for FLDB, the OST object needs to store some flag in its LMA to tell OI scrub that it is for an OST object, no need to query the MDT0. "
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3335
Lustre-change: http://review.whamcloud.com/6669
--- .../lustre/lustre/include/lustre/lustre_idl.h | 7 +++++-- .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +5 -2
@@ -321,8 +321,11 @@ static inline int range_compare_loc(const struct lu_seq_range *r1,* xattr. */ enum lma_compat { -LMAC_HSM =0x00000001 , -LMAC_SOM =0x00000002 , +LMAC_HSM =0x00000001 , +LMAC_SOM =0x00000002 , +LMAC_NOT_IN_OI =0x00000004 ,/* the object does NOT need OI mapping */ +LMAC_FID_ON_OST =0x00000008 ,/* For OST-object, its OI mapping is +* under /O/<seq>/d<x>. */ };/**
drivers/staging/lustre/lustre/include/obd_support.h +1 -0
@@ -256,6 +256,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,#define OBD_FAIL_OSD_SCRUB_FATAL 0x192#define OBD_FAIL_OSD_FID_MAPPING 0x193#define OBD_FAIL_OSD_LMA_INCOMPAT 0x194 +#define OBD_FAIL_OSD_COMPAT_INVALID_ENTRY 0x195#define OBD_FAIL_OST 0x200#define OBD_FAIL_OST_CONNECT_NET 0x201
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +4 -0
@@ -433,6 +433,10 @@ void lustre_assert_wire_constants(void) (unsigned)LMAC_HSM);LASSERTF (LMAC_SOM ==0x00000002UL ,"found 0x%.8xUL\n" , (unsigned )LMAC_SOM ); +LASSERTF (LMAC_NOT_IN_OI ==0x00000004UL ,"found 0x%.8xUL\n" , + (unsigned )LMAC_NOT_IN_OI ); +LASSERTF (LMAC_FID_ON_OST ==0x00000008UL ,"found 0x%.8xUL\n" , + (unsigned )LMAC_FID_ON_OST );LASSERTF (OBJ_CREATE ==1 ,"found %lld\n" , (long long )OBJ_CREATE ); LASSERTF(OBJ_DESTROY == 2, "found %lld\n",
Signature · 1 line
1.7.9.5
PATCH v2 6/12 staging/lustre: make code align in lma_incompat
In reply to Peng TaoFrom: Fan Yong <[email protected]>
This is the coding style part of the original Lustre commit.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3335
Lustre-change: http://review.whamcloud.com/6669
--- .../lustre/lustre/include/lustre/lustre_idl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +4 -4
@@ -334,10 +334,10 @@ enum lma_compat {* This information is stored in lustre_mdt_attrs::lma_incompat. */ enum lma_incompat { -LMAI_RELEASED =0x0000001 ,/* file is released */ -LMAI_AGENT =0x00000002 ,/* agent inode */ -LMAI_REMOTE_PARENT =0x00000004 ,/* the parent of the object -is on the remote MDT */ +LMAI_RELEASED =0x00000001 ,/* file is released */ +LMAI_AGENT =0x00000002 ,/* agent inode */ +LMAI_REMOTE_PARENT =0x00000004 ,/* the parent of the object +is on the remote MDT */ };#define LMA_INCOMPAT_SUPP (LMAI_AGENT | LMAI_REMOTE_PARENT)
Signature · 1 line
1.7.9.5
PATCH v2 7/12 staging/lustre/llite: don't check for O_CREAT in it_create_mode
In reply to Peng TaoFrom: "John L. Hammond" <[email protected]>
ll_lookup_it() checks for O_CREAT in struct lookup_intent's it_create_mode member which is nonsensical, as it_create_mode is used for file mode bits (S_IFREG, S_IRUSR, ...). Fix this by just checking for IT_CREATE in it_op and do the same in llu_lookup_it(). This will not affect the behavior of either function, since if O_CREATE (0100) is actually set in o_create_mode then IT_CREATE must have been set in it_op. In ll_atomic_open() check for O_CREAT in the open_flags parameter rather than testing mode.
Lustre-change: http://review.whamcloud.com/6786
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3517
--- drivers/staging/lustre/lustre/llite/namei.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/namei.c +2 -3
@@ -523,8 +523,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, icbd.icbd_childp = &dentry; icbd.icbd_parent = parent; -if (it->it_op &IT_CREAT || - (it->it_op &IT_OPEN && it->it_create_mode &O_CREAT )) +if (it->it_op &IT_CREAT ) opc =LUSTRE_OPC_CREATE ;else opc =LUSTRE_OPC_ANY ;
@@ -623,7 +622,7 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry,return -ENOMEM ; it->it_op =IT_OPEN ; -if (mode) { +if (open_flags &O_CREAT ) { it->it_op |=IT_CREAT ; lookup_flags |=LOOKUP_CREATE ; }
Signature · 1 line
1.7.9.5
PATCH v2 8/12 staging/lustre/build: clean up unused variables and dead code
In reply to Peng TaoFrom: Dmitry Eremin <[email protected]>
Clean up the code from really unused variables and rearrange other to remove SET_BUT_UNUSED and UNUSED macro usage if possible.
Clean up or comment on some dead code.
Removed never implemented suspend timeouts functionality from pinger.c which was commented out since 2007 and going to be replaced by adaptive timeouts. Also removed all references to this functionality from ldlm_lockd.c, ldlm_request.c and import.c which actually nevers executes or do nothing.
pinger.c
Author: tappro <tappro>
Date: Mon Jul 30 21:08:59 2007 +0000
- make HEAD from b_post_cmd3
Lustre-change: http://review.whamcloud.com/6139
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3204
--- .../staging/lustre/include/linux/libcfs/libcfs.h | 2 - drivers/staging/lustre/lnet/selftest/rpc.c | 2 - drivers/staging/lustre/lnet/selftest/selftest.h | 3 - drivers/staging/lustre/lnet/selftest/timer.c | 6 +- .../lustre/lustre/include/linux/lustre_compat25.h | 4 +- drivers/staging/lustre/lustre/include/lustre_ha.h | 3 - drivers/staging/lustre/lustre/include/lustre_net.h | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 3 - drivers/staging/lustre/lustre/libcfs/workitem.c | 56 ++++++++--------- drivers/staging/lustre/lustre/llite/dcache.c | 36 ++++------- drivers/staging/lustre/lustre/llite/namei.c | 6 +- .../lustre/lustre/obdclass/lprocfs_status.c | 4 -- drivers/staging/lustre/lustre/ptlrpc/client.c | 10 ++- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 - drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 10 ++- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 65 -------------------- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 44 ++++++------- 17 files changed, 76 insertions(+), 182 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -2
@@ -181,8 +181,6 @@ static inline void *__container_of(void *ptr, unsigned long shift)#define container_of0 (ptr, type, member) \ ((type *)__container_of((void *)(ptr), offsetof(type, member))) -#define SET_BUT_UNUSED (a) do { } while(sizeof(a) - sizeof(a)) -#define _LIBCFS_H#endif /* _LIBCFS_H */
drivers/staging/lustre/lnet/selftest/rpc.c +0 -2
@@ -124,7 +124,6 @@ srpc_bulk_t * srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) { srpc_bulk_t *bk; -struct page **pages;int i;LASSERT (bulk_npg >0 && bulk_npg <=LNET_MAX_IOV );
@@ -140,7 +139,6 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) bk->bk_sink = sink; bk->bk_len = bulk_len; bk->bk_niov = bulk_npg; -UNUSED (pages);for (i =0 ; i < bulk_npg; i++) {struct page *pg;
drivers/staging/lustre/lnet/selftest/selftest.h +0 -3
@@ -572,9 +572,6 @@ swi_state2str (int state)#undef STATE2STR } -#define UNUSED (x) ( (void)(x) ) - -#define selftest_wait_events () cfs_pause(cfs_time_seconds(1) / 10)
drivers/staging/lustre/lnet/selftest/timer.c +2 -4
@@ -172,9 +172,6 @@ int stt_timer_main(void *arg) {int rc =0 ; -UNUSED (arg); - -SET_BUT_UNUSED (rc);cfs_block_allsigs ();
@@ -184,12 +181,13 @@ stt_timer_main(void *arg) rc =wait_event_timeout (stt_data.stt_waitq, stt_data.stt_shuttingdown,cfs_time_seconds (STTIMER_SLOTTIME )); + rc =0 ;/* Discard jiffies remaining before timeout. */ }spin_lock (&stt_data.stt_lock); stt_data.stt_nthreads--;spin_unlock (&stt_data.stt_lock); -return 0 ; +return rc; }int
drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +2 -2
@@ -171,8 +171,8 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount)#define ll_d_hlist_empty (list) hlist_empty(list)#define ll_d_hlist_entry (ptr, type, name) hlist_entry(ptr.first, type, name)#define ll_d_hlist_for_each (tmp, i_dentry) hlist_for_each(tmp, i_dentry) -#define ll_d_hlist_for_each_entry (dentry, p, i_dentry, alias) \ - p = NULL; hlist_for_each_entry(dentry, i_dentry, alias) +#define ll_d_hlist_for_each_entry (dentry, i_dentry, alias) \ + hlist_for_each_entry(dentry, i_dentry, alias)#define bio_hw_segments (q, bio) 0
drivers/staging/lustre/lustre/include/lustre_ha.h +0 -3
@@ -58,9 +58,6 @@ void ptlrpc_activate_import(struct obd_import *imp);void ptlrpc_deactivate_import (struct obd_import *imp);void ptlrpc_invalidate_import (struct obd_import *imp);void ptlrpc_fail_import (struct obd_import *imp,__u32 conn_cnt); -int ptlrpc_check_suspend (void ); -void ptlrpc_activate_timeouts (struct obd_import *imp); -void ptlrpc_deactivate_timeouts (struct obd_import *imp);/** @} ha */
drivers/staging/lustre/lustre/include/lustre_net.h +0 -2
@@ -3403,10 +3403,8 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list, enum timeout_event event);struct ptlrpc_request *ptlrpc_prep_ping (struct obd_import *imp);int ptlrpc_obd_ping (struct obd_device *obd); -cfs_time_t ptlrpc_suspend_wakeup_time (void );void ping_evictor_start (void );void ping_evictor_stop (void ); -int ptlrpc_check_and_wait_suspend (struct ptlrpc_request *req);void ptlrpc_pinger_ir_up (void );void ptlrpc_pinger_ir_down (void );/** @} */
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +0 -3
@@ -97,9 +97,6 @@ int ldlm_expired_completion_wait(void *data)if (lock->l_conn_export ==NULL ) {static cfs_time_t next_dump =0 , last_dump =0 ; -if (ptlrpc_check_suspend ()) -return 0 ; - LCONSOLE_WARN("lock timed out (enqueued at "CFS_TIME_T", " CFS_DURATION_T"s ago)\n", lock->l_last_activity,
drivers/staging/lustre/lustre/libcfs/workitem.c +27 -29
90 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/dcache.c +13 -23
@@ -270,7 +270,6 @@ void ll_intent_release(struct lookup_intent *it)void ll_invalidate_aliases (struct inode *inode) {struct dentry *dentry; -struct ll_d_hlist_node *p;LASSERT (inode !=NULL );
@@ -278,7 +277,7 @@ void ll_invalidate_aliases(struct inode *inode) inode->i_ino, inode->i_generation, inode);ll_lock_dcache (inode); -ll_d_hlist_for_each_entry (dentry, p, &inode->i_dentry, d_alias) { +ll_d_hlist_for_each_entry (dentry, &inode->i_dentry, d_alias) { CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p " "inode %p flags %d\n", dentry->d_name.len, dentry->d_name.name, dentry, dentry->d_parent,
@@ -404,7 +403,6 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags,struct inode *inode = de->d_inode;struct ll_inode_info *lli =ll_i2info (inode);struct obd_client_handle **och_p; -__u64 *och_usecount;__u64 ibits;/*
@@ -417,38 +415,30 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags,* change, LOOKUP lock is revoked. */ - -if (it->it_flags &FMODE_WRITE ) { +if (it->it_flags &FMODE_WRITE ) och_p = &lli->lli_mds_write_och; - och_usecount = &lli->lli_open_fd_write_count; - }else if (it->it_flags &FMODE_EXEC ) { +else if (it->it_flags &FMODE_EXEC ) och_p = &lli->lli_mds_exec_och; - och_usecount = &lli->lli_open_fd_exec_count; - }else { +else och_p = &lli->lli_mds_read_och; - och_usecount = &lli->lli_open_fd_read_count; - }/* Check for the proper lock. */ ibits =MDS_INODELOCK_LOOKUP ;if (!ll_have_md_lock (inode, &ibits,LCK_MINMODE )) goto do_lock;mutex_lock (&lli->lli_och_mutex);if (*och_p) {/* Everything is open already, do nothing */ -/*(*och_usecount)++; Do not let them steal our open -handle from under us */ -SET_BUT_UNUSED (och_usecount); -/* XXX The code above was my original idea, but in case -we have the handle, but we cannot use it due to later -checks (e.g. O_CREAT|O_EXCL flags set), nobody -would decrement counter increased here. So we just -hope the lock won't be invalidated in between. But -if it would be, we'll reopen the open request to -MDS later during file open path */ +/* Originally it was idea to do not let them steal our +* open handle from under us by (*och_usecount)++ here. +* But in case we have the handle, but we cannot use it +* due to later checks (e.g. O_CREAT|O_EXCL flags set), +* nobody would decrement counter increased here. So we +* just hope the lock won't be invalidated in between. +* But if it would be, we'll reopen the open request to +* MDS later during file open path. */ mutex_unlock (&lli->lli_och_mutex);return 1 ; - }else { -mutex_unlock (&lli->lli_och_mutex); } +mutex_unlock (&lli->lli_och_mutex); }if (it->it_op ==IT_GETATTR ) {
drivers/staging/lustre/lustre/llite/namei.c +2 -4
@@ -172,10 +172,9 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,static void ll_invalidate_negative_children (struct inode *dir) {struct dentry *dentry, *tmp_subdir; -struct ll_d_hlist_node *p;ll_lock_dcache (dir); -ll_d_hlist_for_each_entry (dentry, p, &dir->i_dentry, d_alias) { +ll_d_hlist_for_each_entry (dentry, &dir->i_dentry, d_alias) {spin_lock (&dentry->d_lock);if (!list_empty (&dentry->d_subdirs)) {struct dentry *child;
@@ -352,7 +351,6 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2)static struct dentry *ll_find_alias (struct inode *inode,struct dentry *dentry) {struct dentry *alias, *discon_alias, *invalid_alias; -struct ll_d_hlist_node *p;if (ll_d_hlist_empty (&inode->i_dentry))return NULL ;
@@ -360,7 +358,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) discon_alias = invalid_alias =NULL ;ll_lock_dcache (inode); -ll_d_hlist_for_each_entry (alias, p, &inode->i_dentry, d_alias) { +ll_d_hlist_for_each_entry (alias, &inode->i_dentry, d_alias) {LASSERT (alias != dentry);spin_lock (&alias->d_lock);
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +0 -4
@@ -420,7 +420,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, {unsigned int num_entry;struct lprocfs_counter *percpu_cntr; -struct lprocfs_counter_header *cntr_header;int i;unsigned long flags =0 ;
@@ -439,7 +438,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,for (i =0 ; i < num_entry; i++) {if (stats->ls_percpu[i] ==NULL )continue ; - cntr_header = &stats->ls_cnt_header[idx]; percpu_cntr =lprocfs_stats_counter_get (stats, i, idx); cnt->lc_count += percpu_cntr->lc_count;
@@ -999,7 +997,6 @@ EXPORT_SYMBOL(lprocfs_free_stats);void lprocfs_clear_stats (struct lprocfs_stats *stats) {struct lprocfs_counter *percpu_cntr; -struct lprocfs_counter_header *header;int i;int j;unsigned int num_entry;
@@ -1011,7 +1008,6 @@ void lprocfs_clear_stats(struct lprocfs_stats *stats)if (stats->ls_percpu[i] ==NULL )continue ;for (j =0 ; j < stats->ls_num; j++) { - header = &stats->ls_cnt_header[j]; percpu_cntr =lprocfs_stats_counter_get (stats, i, j); percpu_cntr->lc_count =0 ; percpu_cntr->lc_min =LC_MIN_INIT ;
drivers/staging/lustre/lustre/ptlrpc/client.c +4 -6
@@ -2289,7 +2289,6 @@ EXPORT_SYMBOL(ptlrpc_req_xid);int ptlrpc_unregister_reply (struct ptlrpc_request *request,int async) {int rc; -wait_queue_head_t *wq;struct l_wait_info lwi;/*
@@ -2334,12 +2333,11 @@ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)* a chance to run reply_in_callback(), and to make sure we've * unlinked before returning a req to the pool. */ -if (request->rq_set !=NULL ) - wq = &request->rq_set->set_waitq; -else - wq = &request->rq_reply_waitq; -for (;;) { +/* The wq argument is ignored by user-space wait_event macros */ +wait_queue_head_t *wq = (request->rq_set !=NULL ) ? + &request->rq_set->set_waitq : + &request->rq_reply_waitq;/* Network access will complete in finite time but the HUGE * timeout lets us CWARN for visibility of sluggish NALs */ lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK),
drivers/staging/lustre/lustre/ptlrpc/import.c +0 -2
@@ -170,7 +170,6 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) target_len, target_start, libcfs_nid2str(imp->imp_connection->c_peer.nid)); } -ptlrpc_deactivate_timeouts (imp);IMPORT_SET_STATE_NOLOCK (imp,LUSTRE_IMP_DISCON );spin_unlock (&imp->imp_lock);
@@ -383,7 +382,6 @@ void ptlrpc_activate_import(struct obd_import *imp)spin_lock (&imp->imp_lock); imp->imp_invalid =0 ; -ptlrpc_activate_timeouts (imp);spin_unlock (&imp->imp_lock);obd_import_event (obd, imp,IMP_EVENT_ACTIVE ); }
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +4 -6
@@ -243,7 +243,6 @@ EXPORT_SYMBOL(ptlrpc_register_bulk);int ptlrpc_unregister_bulk (struct ptlrpc_request *req,int async) {struct ptlrpc_bulk_desc *desc = req->rq_bulk; -wait_queue_head_t *wq;struct l_wait_info lwi;int rc;
@@ -275,12 +274,11 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async)if (async)return 0 ; -if (req->rq_set !=NULL ) - wq = &req->rq_set->set_waitq; -else - wq = &req->rq_reply_waitq; -for (;;) { +/* The wq argument is ignored by user-space wait_event macros */ +wait_queue_head_t *wq = (req->rq_set !=NULL ) ? + &req->rq_set->set_waitq : + &req->rq_reply_waitq;/* Network access will complete in finite time but the HUGE * timeout lets us CWARN for visibility of sluggish NALs */ lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK),
drivers/staging/lustre/lustre/ptlrpc/pinger.c +0 -65
83 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +22 -22
75 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 9/12 staging/lustre/build: fix compilation issue with is_compat_task
In reply to Peng TaoFrom: Dmitry Eremin <[email protected]>
After removing LIBCFS_HAVE_IS_COMPAT_TASK test we have a compilation issue with kernels configured without CONFIG_COMPAT.
Lustre-change: http://review.whamcloud.com/7118
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800
--- .../staging/lustre/lustre/llite/llite_internal.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +6 -1
@@ -650,7 +650,12 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi)#if BITS_PER_LONG ==32 return 1 ;#else -return unlikely (is_compat_task () || (sbi->ll_flags &LL_SBI_32BIT_API )); + return unlikely( +#ifdef CONFIG_COMPAT +is_compat_task () || +#endif + (sbi->ll_flags &LL_SBI_32BIT_API ) + ); #endif }
Signature · 1 line
1.7.9.5
PATCH v2 10/12 staging/lustre/ptlrpc: Fix a crash when dereferencing NULL pointer
In reply to Peng TaoFrom: Amir Shehata <[email protected]>
When a system runs out of memory and the function ptlrpc_register_bulk() is called from ptl_send_rpc() the call to LNetMEAttach() fails due to failure to allocate memory. This forces the code into an error path, which most probably previously went untested. The error path:
if (rc != 0) {
CERROR("%s: LNetMEAttach failed x"LPU64"/%d: rc = %dn",
desc->bd_export->exp_obd->obd_name, xid,
posted_md, rc);
break;
}This print assumes that desc->bd_export is not NULL. However, it is. In fact it is expected to be NULL. desc->bd_import is the correct structure to access in this case.
Lustre-change: http://review.whamcloud.com/7121
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3585
--- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +3 -3
@@ -180,7 +180,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req) LNET_UNLINK, LNET_INS_AFTER, &me_h);if (rc !=0 ) {CERROR ("%s: LNetMEAttach failed x" LPU64 "/%d: rc = %d\n" , - desc->bd_export->exp_obd->obd_name, xid, + desc->bd_import->imp_obd->obd_name, xid, posted_md, rc);break ; }
@@ -190,7 +190,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req) &desc->bd_mds[posted_md]);if (rc !=0 ) {CERROR ("%s: LNetMDAttach failed x" LPU64 "/%d: rc = %d\n" , - desc->bd_export->exp_obd->obd_name, xid, + desc->bd_import->imp_obd->obd_name, xid, posted_md, rc); rc2 =LNetMEUnlink (me_h);LASSERT (rc2 ==0 );
@@ -220,7 +220,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req)/* Holler if peer manages to touch buffers before he knows the xid */ if (desc->bd_md_count != total_md)CWARN ("%s: Peer %s touched %d buffers while I registered\n" , - desc->bd_export->exp_obd->obd_name,libcfs_id2str (peer), + desc->bd_import->imp_obd->obd_name,libcfs_id2str (peer), total_md - desc->bd_md_count);spin_unlock (&desc->bd_lock);
Signature · 1 line
1.7.9.5
PATCH v2 11/12 staging/lustre/hsm: Add hsm_release feature.
In reply to Peng TaoFrom: Jinshan Xiong <[email protected]>
HSM Release is one of the key feature of HSM. To perform HSM release, clients need to acquire the file lease exclusivelt and flush dirty cache from clients. A special close REQ will be sent to the MDT to release the lease and get rid of OST objects.
Lustre-change: http://review.whamcloud.com/7028
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1333
--- .../lustre/lustre/include/lustre/lustre_idl.h | 14 +++- .../lustre/lustre/include/lustre/lustre_user.h | 11 ++- .../lustre/lustre/include/lustre_req_layout.h | 2 + drivers/staging/lustre/lustre/include/obd.h | 6 +- .../staging/lustre/lustre/lclient/lcommon_misc.c | 4 +- drivers/staging/lustre/lustre/llite/dir.c | 24 +++++- drivers/staging/lustre/lustre/llite/file.c | 87 +++++++++++++++++--- .../staging/lustre/lustre/llite/llite_internal.h | 3 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 2 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 16 ++++ drivers/staging/lustre/lustre/lov/lov_object.c | 35 +++++--- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 26 +++++- drivers/staging/lustre/lustre/mdc/mdc_request.c | 23 +++++- drivers/staging/lustre/lustre/ptlrpc/layout.c | 19 +++++ .../staging/lustre/lustre/ptlrpc/pack_generic.c | 7 ++ 15 files changed, 242 insertions(+), 37 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +13 -1
@@ -1761,6 +1761,7 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)#define OBD_MD_FLRMTRGETFACL (0x0008000000000000ULL)/* lfs rgetfacl case */ #define OBD_MD_FLDATAVERSION (0x0010000000000000ULL)/* iversion sum */ +#define OBD_MD_FLRELEASED (0x0020000000000000ULL)/* file released */ #define OBD_MD_FLGETATTR (OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME | \ OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLKSZ | \
@@ -2397,6 +2398,7 @@ extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa);* delegation, succeed if it's not * being opened with conflict mode. */ +#define MDS_OPEN_RELEASE 02000000000000ULL/* Open the file for HSM release */ /* permission for create non-directory file */ #define MAY_CREATE (1 << 7)
@@ -2415,7 +2417,7 @@ extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa);/* lfs rgetfacl permission check */ #define MAY_RGETFACL (1 << 14) -enum { +enum mds_op_bias {MDS_CHECK_SPLIT =1 <<0 ,MDS_CROSS_REF =1 <<1 ,MDS_VTX_BYPASS =1 <<2 ,
@@ -2428,6 +2430,7 @@ enum {MDS_DATA_MODIFIED =1 <<9 ,MDS_CREATE_VOLATILE =1 <<10 ,MDS_OWNEROVERRIDE =1 <<11 , + MDS_HSM_RELEASE = 1 << 12, };/* instance of mdt_reint_rec */
@@ -3751,5 +3754,14 @@ struct mdc_swap_layouts {void lustre_swab_swap_layouts (struct mdc_swap_layouts *msl); +struct close_data { +struct lustre_handle cd_handle; +struct lu_fid cd_fid; +__u64 cd_data_version; +__u64 cd_reserved[8 ]; +}; + +void lustre_swab_close_data (struct close_data *data); +#endif /** @} lustreidl */
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +7 -4
@@ -623,10 +623,13 @@ struct if_quotactl { };/* swap layout flags */ -#define SWAP_LAYOUTS_CHECK_DV1 (1 << 0) -#define SWAP_LAYOUTS_CHECK_DV2 (1 << 1) -#define SWAP_LAYOUTS_KEEP_MTIME (1 << 2) -#define SWAP_LAYOUTS_KEEP_ATIME (1 << 3) +#define SWAP_LAYOUTS_CHECK_DV1 (1 << 0) +#define SWAP_LAYOUTS_CHECK_DV2 (1 << 1) +#define SWAP_LAYOUTS_KEEP_MTIME (1 << 2) +#define SWAP_LAYOUTS_KEEP_ATIME (1 << 3) + +/* Swap XATTR_NAME_HSM as well, only on the MDT so far */ +#define SWAP_LAYOUTS_MDS_HSM (1 << 31)struct lustre_swap_layouts {__u64 sl_flags;__u32 sl_fd;
drivers/staging/lustre/lustre/include/lustre_req_layout.h +2 -0
@@ -164,6 +164,7 @@ extern struct req_format RQF_UPDATE_OBJ;*/ extern struct req_format RQF_MDS_GETATTR_NAME ;extern struct req_format RQF_MDS_CLOSE ; +extern struct req_format RQF_MDS_RELEASE_CLOSE ;extern struct req_format RQF_MDS_PIN ;extern struct req_format RQF_MDS_UNPIN ;extern struct req_format RQF_MDS_CONNECT ;
@@ -262,6 +263,7 @@ extern struct req_msg_field RMF_GETINFO_VAL;extern struct req_msg_field RMF_GETINFO_VALLEN ;extern struct req_msg_field RMF_GETINFO_KEY ;extern struct req_msg_field RMF_IDX_INFO ; +extern struct req_msg_field RMF_CLOSE_DATA ;/* * connection handle received in MDS_CONNECT request.
drivers/staging/lustre/lustre/include/obd.h +5 -1
@@ -1070,7 +1070,7 @@ struct md_op_data {struct obd_capa *op_capa2;/* Various operation flags. */ -__u32 op_bias; +enum mds_op_bias op_bias;/* Operation type */ __u32 op_opc;
@@ -1084,6 +1084,10 @@ struct md_op_data {/* used to transfer info between the stacks of MD client * see enum op_cli_flags */ __u32 op_cli_flags; + +/* File object data version for HSM release, on client */ +__u64 op_data_version; +struct lustre_handle op_lease_handle; };enum op_cli_flags {
drivers/staging/lustre/lustre/lclient/lcommon_misc.c +3 -1
@@ -140,7 +140,9 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock, rc =cl_io_init (env, io,CIT_MISC , io->ci_obj);if (rc) { -LASSERT (rc <0 ); +/* Does not make sense to take GL for released layout */ +if (rc >0 ) + rc = -ENOTSUPP ;cl_env_put (env, &refcheck);return rc; }
drivers/staging/lustre/lustre/llite/dir.c +22 -2
@@ -1809,8 +1809,28 @@ out_rmdir:return -EFAULT ; } - rc =obd_iocontrol (cmd,ll_i2mdexp (inode), totalsize, - hur,NULL ); +if (hur->hur_request.hr_action ==HUA_RELEASE ) { +const struct lu_fid *fid; +struct inode *f; +int i; + +for (i =0 ; i < hur->hur_request.hr_itemcount; i++) { + fid = &hur->hur_user_item[i].hui_fid; + f =search_inode_for_lustre (inode->i_sb, fid); +if (IS_ERR (f)) { + rc =PTR_ERR (f); +break ; + } + + rc =ll_hsm_release (f); +iput (f); +if (rc !=0 ) +break ; + } + }else { + rc =obd_iocontrol (cmd,ll_i2mdexp (inode), totalsize, + hur,NULL ); + }OBD_FREE_LARGE (hur, totalsize);
drivers/staging/lustre/lustre/llite/file.c +75 -12
165 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -1
@@ -787,9 +787,10 @@ int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg);int ll_put_grouplock (struct inode *inode,struct file *file,unsigned long arg);int ll_fid2path (struct inode *inode,void *arg);int ll_data_version (struct inode *inode,__u64 *data_version,int extent_lock); +int ll_hsm_release (struct inode *inode);struct obd_client_handle *ll_lease_open (struct inode *inode,struct file *file, -fmode_t mode); +fmode_t mode,__u64 flags);int ll_lease_close (struct obd_client_handle *och,struct inode *inode,bool *lease_broken);
drivers/staging/lustre/lustre/llite/vvp_object.c +1 -1
@@ -138,7 +138,7 @@ int vvp_conf_set(const struct lu_env *env, struct cl_object *obj, lli->lli_layout_gen, conf->u.coc_md->lsm->lsm_layout_gen); - lli->lli_has_smd = true; + lli->lli_has_smd =lsm_has_objects (conf->u.coc_md->lsm); lli->lli_layout_gen = conf->u.coc_md->lsm->lsm_layout_gen; }else { CDEBUG(D_VFSTRACE, "layout lock destroyed: %u.\n",
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +16 -0
@@ -168,6 +168,22 @@ enum lov_layout_type { LLT_NR }; +static inline char *llt2str (enum lov_layout_type llt) +{ +switch (llt) { +case LLT_EMPTY : +return "EMPTY" ; +case LLT_RAID0 : +return "RAID0" ; +case LLT_RELEASED : +return "RELEASED" ; +case LLT_NR : +LBUG (); + } +LBUG (); +return "" ; +} +/** * lov-specific file state. *
drivers/staging/lustre/lustre/lov/lov_object.c +25 -10
@@ -393,13 +393,13 @@ static int lov_print_empty(const struct lu_env *env, void *cookie,static int lov_print_raid0 (const struct lu_env *env,void *cookie,lu_printer_t p,const struct lu_object *o) { -struct lov_object *lov =lu2lov (o); -struct lov_layout_raid0 *r0 =lov_r0 (lov); -struct lov_stripe_md *lsm = lov->lo_lsm; -int i; +struct lov_object *lov =lu2lov (o); +struct lov_layout_raid0 *r0 =lov_r0 (lov); +struct lov_stripe_md *lsm = lov->lo_lsm; +int i; - (*p)(env, cookie,"stripes: %d, %svalid, lsm{%p 0x%08X %d %u %u}: \n" , - r0->lo_nr, lov->lo_layout_invalid ?"in" :"" , lsm, + (*p)(env, cookie,"stripes: %d, %s, lsm{%p 0x%08X %d %u %u}:\n" , + r0->lo_nr, lov->lo_layout_invalid ?"invalid" :"valid" , lsm, lsm->lsm_magic,atomic_read (&lsm->lsm_refc), lsm->lsm_stripe_count, lsm->lsm_layout_gen);for (i =0 ; i < r0->lo_nr; ++i) {
@@ -408,8 +408,9 @@ static int lov_print_raid0(const struct lu_env *env, void *cookie,if (r0->lo_sub[i] !=NULL ) { sub =lovsub2lu (r0->lo_sub[i]);lu_object_print (env, cookie, p, sub); - }else + }else { (*p)(env, cookie,"sub %d absent\n" , i); + } }return 0 ; }
@@ -417,7 +418,14 @@ static int lov_print_raid0(const struct lu_env *env, void *cookie,static int lov_print_released (const struct lu_env *env,void *cookie,lu_printer_t p,const struct lu_object *o) { - (*p)(env, cookie,"released\n" ); +struct lov_object *lov =lu2lov (o); +struct lov_stripe_md *lsm = lov->lo_lsm; + + (*p)(env, cookie, +"released: %s, lsm{%p 0x%08X %d %u %u}:\n" , + lov->lo_layout_invalid ?"invalid" :"valid" , lsm, + lsm->lsm_magic,atomic_read (&lsm->lsm_refc), + lsm->lsm_stripe_count, lsm->lsm_layout_gen);return 0 ; }
@@ -662,6 +670,10 @@ static int lov_layout_change(const struct lu_env *unused,return PTR_ERR (env); } +CDEBUG (D_INODE ,DFID " from %s to %s\n" , +PFID (lu_object_fid (lov2lu (lov))), +llt2str (lov->lo_type),llt2str (llt)); + old_ops = &lov_dispatch[lov->lo_type]; new_ops = &lov_dispatch[llt];
@@ -750,8 +762,9 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj,if (conf->u.coc_md !=NULL ) lsm = conf->u.coc_md->lsm;if ((lsm ==NULL && lov->lo_lsm ==NULL ) || - (lsm !=NULL && lov->lo_lsm !=NULL && - lov->lo_lsm->lsm_layout_gen == lsm->lsm_layout_gen)) { + ((lsm !=NULL && lov->lo_lsm !=NULL ) && + (lov->lo_lsm->lsm_layout_gen == lsm->lsm_layout_gen) && + (lov->lo_lsm->lsm_pattern == lsm->lsm_pattern))) {/* same version of layout */ lov->lo_layout_invalid = false;GOTO (out, result =0 );
@@ -767,6 +780,8 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj, out:lov_conf_unlock (lov); +CDEBUG (D_INODE ,DFID " lo_layout_invalid=%d\n" , +PFID (lu_object_fid (lov2lu (lov))), lov->lo_layout_invalid);return result; }
drivers/staging/lustre/lustre/mdc/mdc_lib.c +25 -1
@@ -179,7 +179,8 @@ 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_BY_FID |MDS_OPEN_LEASE | +MDS_OPEN_RELEASE ));if (flags &O_CREAT ) cr_flags |=MDS_OPEN_CREAT ;if (flags &O_EXCL )
@@ -490,6 +491,28 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags, } } +static void mdc_hsm_release_pack (struct ptlrpc_request *req, +struct md_op_data *op_data) +{ +if (op_data->op_bias &MDS_HSM_RELEASE ) { +struct close_data *data; +struct ldlm_lock *lock; + + data =req_capsule_client_get (&req->rq_pill, &RMF_CLOSE_DATA ); +LASSERT (data !=NULL ); + + lock =ldlm_handle2lock (&op_data->op_lease_handle); +if (lock !=NULL ) { + data->cd_handle = lock->l_remote_handle; +ldlm_lock_put (lock); + } +ldlm_cli_cancel (&op_data->op_lease_handle,LCF_LOCAL ); + + data->cd_data_version = op_data->op_data_version; + data->cd_fid = op_data->op_fid2; + } +} +void mdc_close_pack (struct ptlrpc_request *req,struct md_op_data *op_data) {struct mdt_ioepoch *epoch;
@@ -501,6 +524,7 @@ void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data)mdc_setattr_pack_rec (rec, op_data);mdc_pack_capa (req, &RMF_CAPA1 , op_data->op_capa1);mdc_ioepoch_pack (epoch, op_data); +mdc_hsm_release_pack (req, op_data); }static int mdc_req_avail (struct client_obd *cli,struct mdc_cache_waiter *mcw)
drivers/staging/lustre/lustre/mdc/mdc_request.c +20 -3
@@ -800,10 +800,27 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data, {struct obd_device *obd =class_exp2obd (exp);struct ptlrpc_request *req; -int rc; +struct req_format *req_fmt; +int rc; +int saved_rc =0 ; + + + req_fmt = &RQF_MDS_CLOSE ; +if (op_data->op_bias &MDS_HSM_RELEASE ) { + req_fmt = &RQF_MDS_RELEASE_CLOSE ; + +/* allocate a FID for volatile file */ + rc =mdc_fid_alloc (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); +/* save the errcode and proceed to close */ + saved_rc = rc; + } + } *request =NULL ; - req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_MDS_CLOSE ); + req =ptlrpc_request_alloc (class_exp2cliimp (exp), req_fmt);if (req ==NULL )return -ENOMEM ;
@@ -893,7 +910,7 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data, } *request = req;mdc_close_handle_reply (req, op_data, rc); -return rc; +return rc <0 ? rc : saved_rc; } int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data,
drivers/staging/lustre/lustre/ptlrpc/layout.c +19 -0
@@ -145,6 +145,14 @@ static const struct req_msg_field *mdt_close_client[] = { &RMF_CAPA1 }; +static const struct req_msg_field *mdt_release_close_client[] = { + &RMF_PTLRPC_BODY , + &RMF_MDT_EPOCH , + &RMF_REC_REINT , + &RMF_CAPA1 , + &RMF_CLOSE_DATA +}; +static const struct req_msg_field *obd_statfs_server[] = { &RMF_PTLRPC_BODY , &RMF_OBD_STATFS
@@ -666,6 +674,7 @@ static struct req_format *req_formats[] = { &RQF_MDS_GETXATTR , &RQF_MDS_SYNC , &RQF_MDS_CLOSE , + &RQF_MDS_RELEASE_CLOSE , &RQF_MDS_PIN , &RQF_MDS_UNPIN , &RQF_MDS_READPAGE,
@@ -885,6 +894,11 @@ struct req_msg_field RMF_PTLRPC_BODY = sizeof(struct ptlrpc_body), lustre_swab_ptlrpc_body, NULL);EXPORT_SYMBOL (RMF_PTLRPC_BODY ); +struct req_msg_field RMF_CLOSE_DATA = +DEFINE_MSGF ("data_version" ,0 , +sizeof (struct close_data ), lustre_swab_close_data,NULL ); +EXPORT_SYMBOL (RMF_CLOSE_DATA ); +struct req_msg_field RMF_OBD_STATFS =DEFINE_MSGF ("obd_statfs" ,0 ,sizeof (struct obd_statfs ), lustre_swab_obd_statfs,NULL );
@@ -1412,6 +1426,11 @@ struct req_format RQF_MDS_CLOSE = mdt_close_client, mds_last_unlink_server);EXPORT_SYMBOL (RQF_MDS_CLOSE ); +struct req_format RQF_MDS_RELEASE_CLOSE = +DEFINE_REQ_FMT0 ("MDS_CLOSE" , + mdt_release_close_client, mds_last_unlink_server); +EXPORT_SYMBOL (RQF_MDS_RELEASE_CLOSE ); +struct req_format RQF_MDS_PIN =DEFINE_REQ_FMT0 ("MDS_PIN" , mdt_body_capa, mdt_body_only);
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +7 -0
@@ -2565,3 +2565,10 @@ void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl)__swab64s (&msl->msl_flags); }EXPORT_SYMBOL (lustre_swab_swap_layouts); + +void lustre_swab_close_data (struct close_data *cd) +{ +lustre_swab_lu_fid (&cd->cd_fid); +__swab64s (&cd->cd_data_version); +} +EXPORT_SYMBOL (lustre_swab_close_data);
Signature · 1 line
1.7.9.5
PATCH v2 12/12 staging/lustre/llite: extended attribute cache
In reply to Peng TaoFrom: Andrew Perepechko <[email protected]>
This patch implements an extended attribute cache for a Lustre client. It is organized as a write-through
cache: reads are performed from cache, updates are sent synchronously to the MDS. An additional inode bit MDS_INODELOCK_XATTR is added to protect the cache.
Lustre-change: http://review.whamcloud.com/5537
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2869
[remove extra GPL notice in original patch as kernel already has one and it causes checkpatch error. -- Peng Tao]
--- .../lustre/lustre/include/linux/lustre_lite.h | 1 + .../lustre/lustre/include/lustre/lustre_idl.h | 12 +- .../lustre/lustre/include/lustre_req_layout.h | 3 + drivers/staging/lustre/lustre/include/md_object.h | 4 +- drivers/staging/lustre/lustre/include/obd.h | 5 + .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 + drivers/staging/lustre/lustre/llite/Makefile | 2 +- drivers/staging/lustre/lustre/llite/file.c | 13 +- .../staging/lustre/lustre/llite/llite_internal.h | 36 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 23 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 37 ++ drivers/staging/lustre/lustre/llite/namei.c | 4 + drivers/staging/lustre/lustre/llite/super25.c | 4 + drivers/staging/lustre/lustre/llite/xattr.c | 102 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 617 ++++++++++++++++++++ drivers/staging/lustre/lustre/mdc/mdc_internal.h | 1 + drivers/staging/lustre/lustre/mdc/mdc_locks.c | 63 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 34 ++ 19 files changed, 902 insertions(+), 62 deletions(-) create mode 100644 drivers/staging/lustre/lustre/llite/xattr_cache.c
drivers/staging/lustre/lustre/include/linux/lustre_lite.h +1 -0
@@ -88,6 +88,7 @@ enum {LPROC_LL_ALLOC_INODE ,LPROC_LL_SETXATTR ,LPROC_LL_GETXATTR , +LPROC_LL_GETXATTR_HITS ,LPROC_LL_LISTXATTR ,LPROC_LL_REMOVEXATTR , LPROC_LL_INODE_PERM,
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +9 -3
@@ -1368,7 +1368,7 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); OBD_CONNECT_EINPROGRESS | \ OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_UMASK | \ OBD_CONNECT_LVB_TYPE | OBD_CONNECT_LAYOUTLOCK |\ - OBD_CONNECT_PINGLESS) + OBD_CONNECT_PINGLESS | OBD_CONNECT_MAX_EASIZE)#define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \
@@ -1752,7 +1752,9 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)#define OBD_MD_FLCKSPLIT (0x0000080000000000ULL)/* Check split on server */ #define OBD_MD_FLCROSSREF (0x0000100000000000ULL)/* Cross-ref case */ #define OBD_MD_FLGETATTRLOCK (0x0000200000000000ULL)/* Get IOEpoch attributes -* under lock */ +* under lock; for xattr +* requests means the +* client holds the lock */ #define OBD_MD_FLOBJCOUNT (0x0000400000000000ULL)/* for multiple destroy */ #define OBD_MD_FLRMTLSETFACL (0x0001000000000000ULL)/* lfs lsetfacl case */
@@ -1769,6 +1771,9 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \ OBD_MD_FLGENER | OBD_MD_FLRDEV | OBD_MD_FLGROUP) +#define OBD_MD_FLXATTRLOCKED OBD_MD_FLGETATTRLOCK +#define OBD_MD_FLXATTRALL (OBD_MD_FLXATTR | OBD_MD_FLXATTRLS) +/* don't forget obdo_fid which is way down at the bottom so it can * come after the definition of llog_cookie */
@@ -2141,8 +2146,9 @@ extern void lustre_swab_generic_32s (__u32 *val);#define MDS_INODELOCK_OPEN 0x000004/* For opened files */ #define MDS_INODELOCK_LAYOUT 0x000008/* for layout */ #define MDS_INODELOCK_PERM 0x000010/* for permission */ +#define MDS_INODELOCK_XATTR 0x000020/* extended attributes */ -#define MDS_INODELOCK_MAXSHIFT 4 +#define MDS_INODELOCK_MAXSHIFT 5/* This FULL lock is useful to take on unlink sort of operations */ #define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
drivers/staging/lustre/lustre/include/lustre_req_layout.h +3 -0
@@ -230,6 +230,7 @@ extern struct req_format RQF_LDLM_INTENT_GETATTR;extern struct req_format RQF_LDLM_INTENT_OPEN ;extern struct req_format RQF_LDLM_INTENT_CREATE ;extern struct req_format RQF_LDLM_INTENT_UNLINK ; +extern struct req_format RQF_LDLM_INTENT_GETXATTR ;extern struct req_format RQF_LDLM_INTENT_QUOTA ;extern struct req_format RQF_LDLM_CANCEL ;extern struct req_format RQF_LDLM_CALLBACK ;
@@ -279,6 +280,8 @@ extern struct req_msg_field RMF_LAYOUT_INTENT;extern struct req_msg_field RMF_MDT_MD ;extern struct req_msg_field RMF_REC_REINT ;extern struct req_msg_field RMF_EADATA ; +extern struct req_msg_field RMF_EAVALS ; +extern struct req_msg_field RMF_EAVALS_LENS ;extern struct req_msg_field RMF_ACL ;extern struct req_msg_field RMF_LOGCOOKIES ;extern struct req_msg_field RMF_CAPA1 ;
drivers/staging/lustre/lustre/include/md_object.h +2 -2
@@ -352,8 +352,8 @@ struct md_device_operations {int (*mdo_root_get)(const struct lu_env *env,struct md_device *m,struct lu_fid *f); -int (*mdo_maxsize_get)(const struct lu_env *env,struct md_device *m, -int *md_size,int *cookie_size); +int (*mdo_maxeasize_get)(const struct lu_env *env,struct md_device *m, +int *easize);int (*mdo_statfs)(const struct lu_env *env,struct md_device *m,struct obd_statfs *sfs);
drivers/staging/lustre/lustre/include/obd.h +5 -0
@@ -1022,6 +1022,7 @@ struct lu_context;#define IT_LAYOUT (1 << 10)#define IT_QUOTA_DQACQ (1 << 11)#define IT_QUOTA_CONN (1 << 12) +#define IT_SETXATTR (1 << 13)static inline int it_to_lock_mode (struct lookup_intent *it) {
@@ -1031,6 +1032,10 @@ static inline int it_to_lock_mode(struct lookup_intent *it)else if (it->it_op & (IT_READDIR |IT_GETATTR |IT_OPEN |IT_LOOKUP |IT_LAYOUT ))return LCK_CR ; +else if (it->it_op &IT_GETXATTR ) +return LCK_PR ; +else if (it->it_op &IT_SETXATTR ) +return LCK_PW ;LASSERTF (0 ,"Invalid it_op: %d\n" , it->it_op);return -EINVAL ;
drivers/staging/lustre/lustre/include/obd_support.h +1 -0
@@ -465,6 +465,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,#define OBD_FAIL_LOCK_STATE_WAIT_INTR 0x1402#define OBD_FAIL_LOV_INIT 0x1403#define OBD_FAIL_GLIMPSE_DELAY 0x1404 +#define OBD_FAIL_LLITE_XATTR_ENOMEM 0x1405#define OBD_FAIL_FID_INDIR 0x1501#define OBD_FAIL_FID_INLMA 0x1502
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +2 -0
@@ -145,6 +145,8 @@ char *ldlm_it2str(int it)return "getxattr" ;case IT_LAYOUT :return "layout" ; +case IT_SETXATTR : +return "setxattr" ;default :CERROR ("Unknown intent %d\n" , it);return "UNKNOWN" ;
drivers/staging/lustre/lustre/llite/Makefile +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_LUSTRE_FS) += lustre.o obj-$(CONFIG_LUSTRE_LLITE_LLOOP) += llite_lloop.o lustre-y := dcache.o dir.o file.o llite_close.o llite_lib.o llite_nfs.o \ rw.o lproc_llite.o namei.o symlink.o llite_mmap.o \ - xattr.o remote_perm.o llite_rmtacl.o llite_capa.o \ + xattr.o xattr_cache.o remote_perm.o llite_rmtacl.o llite_capa.o \ rw26.o super25.o statahead.o \ ../lclient/glimpse.o ../lclient/lcommon_cl.o ../lclient/lcommon_misc.o \ vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o
drivers/staging/lustre/lustre/llite/file.c +8 -5
@@ -2784,7 +2784,8 @@ int ll_have_md_lock(struct inode *inode, __u64 *bits, ldlm_mode_t l_req_mode) }ldlm_mode_t ll_take_md_lock (struct inode *inode,__u64 bits, -struct lustre_handle *lockh,__u64 flags) +struct lustre_handle *lockh,__u64 flags, +ldlm_mode_t mode) {ldlm_policy_data_t policy = { .l_inodebits = {bits}};struct lu_fid *fid;
@@ -2794,8 +2795,8 @@ ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,CDEBUG (D_INFO ,"trying to match res " DFID "\n" ,PFID (fid)); rc =md_lock_match (ll_i2mdexp (inode),LDLM_FL_BLOCK_GRANTED |flags, - fid,LDLM_IBITS , &policy, -LCK_CR |LCK_CW |LCK_PR |LCK_PW , lockh); + fid,LDLM_IBITS , &policy, mode, lockh); +return rc; }
@@ -3471,7 +3472,8 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen)/* mostly layout lock is caching on the local side, so try to match * it before grabbing layout lock mutex. */ - mode =ll_take_md_lock (inode,MDS_INODELOCK_LAYOUT , &lockh,0 ); + mode =ll_take_md_lock (inode,MDS_INODELOCK_LAYOUT , &lockh,0 , +LCK_CR |LCK_CW |LCK_PR |LCK_PW );if (mode !=0 ) {/* hit cached lock */ rc =ll_layout_lock_set (&lockh, mode, inode, gen, false);if (rc ==0 )
@@ -3486,7 +3488,8 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen) again:/* try again. Maybe somebody else has done this. */ - mode =ll_take_md_lock (inode,MDS_INODELOCK_LAYOUT , &lockh,0 ); + mode =ll_take_md_lock (inode,MDS_INODELOCK_LAYOUT , &lockh,0 , +LCK_CR |LCK_CW |LCK_PR |LCK_PW );if (mode !=0 ) {/* hit cached lock */ rc =ll_layout_lock_set (&lockh, mode, inode, gen, true);if (rc == -EAGAIN )
drivers/staging/lustre/lustre/llite/llite_internal.h +33 -3
@@ -127,6 +127,8 @@ enum lli_flags {LLIF_DATA_MODIFIED = (1 <<6 ),/* File is being restored */ LLIF_FILE_RESTORING = (1 <<7 ), +/* Xattr cache is attached to the file */ + LLIF_XATTR_CACHE = (1 << 8), }; struct ll_inode_info {
@@ -279,8 +281,27 @@ struct ll_inode_info {struct mutex lli_layout_mutex;/* valid only inside LAYOUT ibits lock, protected by lli_layout_mutex */ __u32 lli_layout_gen; + +struct rw_semaphore lli_xattrs_list_rwsem; +struct mutex lli_xattrs_enq_lock; +struct list_head lli_xattrs;/* ll_xattr_entry->xe_list */ }; +int ll_xattr_cache_destroy (struct inode *inode); + +int ll_xattr_cache_get (struct inode *inode, +const char *name, +char *buffer, +size_t size, +__u64 valid); + +int ll_xattr_cache_update (struct inode *inode, +const char *name, +const char *newval, +size_t size, +__u64 valid, +int flags); +/* * Locking to guarantee consistency of non-atomic updates to long long i_size, * consistency between file size and KMS.
@@ -402,6 +423,7 @@ enum stats_track_type {#define LL_SBI_VERBOSE 0x10000/* verbose mount/umount */ #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_FLAGS { \ "nolck", \
@@ -409,6 +431,7 @@ enum stats_track_type {"flock" , \"xattr" , \"acl" , \ +"???" , \"rmt_client" , \"mds_capa" , \ "oss_capa", \
@@ -421,7 +444,9 @@ enum stats_track_type {"agl" , \"verbose" , \"layout" , \ - "user_fid2path" } +"user_fid2path" ,\ +"xattr" , \ +} /* default value for ll_sb_info->contention_time */ #define SBI_DEFAULT_CONTENTION_SECONDS 60
@@ -461,7 +486,8 @@ struct ll_sb_info {struct lu_fid ll_root_fid;/* root object fid */ int ll_flags; - unsigned int ll_umounting:1; + unsigned int ll_umounting:1, + ll_xattr_cache_enabled:1;struct list_head ll_conn_chain;/* per-conn chain of SBs */ struct lustre_client_ocd ll_lco;
@@ -732,7 +758,8 @@ extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *,extern int ll_have_md_lock (struct inode *inode,__u64 *bits,ldlm_mode_t l_req_mode);extern ldlm_mode_t ll_take_md_lock (struct inode *inode,__u64 bits, -struct lustre_handle *lockh,__u64 flags); +struct lustre_handle *lockh,__u64 flags, +ldlm_mode_t mode);int __ll_inode_revalidate_it (struct dentry *,struct lookup_intent *,__u64 bits);int ll_revalidate_nd (struct dentry *dentry,unsigned int flags);
@@ -1598,4 +1625,7 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf);int ll_layout_refresh (struct inode *inode,__u32 *gen);int ll_layout_restore (struct inode *inode); +int ll_xattr_init (void ); +void ll_xattr_fini (void ); +#endif /* LLITE_INTERNAL_H */
drivers/staging/lustre/lustre/llite/llite_lib.c +21 -2
@@ -209,7 +209,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,OBD_CONNECT_FULL20 |OBD_CONNECT_64BITHASH |OBD_CONNECT_EINPROGRESS |OBD_CONNECT_JOBSTATS |OBD_CONNECT_LVB_TYPE | -OBD_CONNECT_LAYOUTLOCK |OBD_CONNECT_PINGLESS ; +OBD_CONNECT_LAYOUTLOCK | +OBD_CONNECT_PINGLESS |OBD_CONNECT_MAX_EASIZE ;if (sbi->ll_flags &LL_SBI_SOM_PREVIEW ) data->ocd_connect_flags |=OBD_CONNECT_SOM ;
@@ -383,6 +384,17 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, sbi->ll_flags |=LL_SBI_LAYOUT_LOCK ; } +if (data->ocd_ibits_known &MDS_INODELOCK_XATTR ) { +if (!(data->ocd_connect_flags &OBD_CONNECT_MAX_EASIZE )) { +LCONSOLE_INFO ( +"%s: disabling xattr cache due to unknown maximum xattr size.\n" , + dt); + }else { + sbi->ll_flags |=LL_SBI_XATTR_CACHE ; + sbi->ll_xattr_cache_enabled =1 ; + } + } + obd =class_name2obd (dt);if (!obd) {CERROR ("DT %s: not setup or attached\n" , dt);
@@ -922,6 +934,9 @@ void ll_lli_init(struct ll_inode_info *lli) lli->lli_layout_gen =LL_LAYOUT_GEN_NONE ; lli->lli_clob =NULL ; +init_rwsem (&lli->lli_xattrs_list_rwsem); +mutex_init (&lli->lli_xattrs_enq_lock); +LASSERT (lli->lli_vfs_inode.i_mode !=0 );if (S_ISDIR (lli->lli_vfs_inode.i_mode)) {mutex_init (&lli->lli_readdir_mutex);
@@ -1194,6 +1209,8 @@ void ll_clear_inode(struct inode *inode) lli->lli_symlink_name =NULL ; } +ll_xattr_cache_destroy (inode); +if (sbi->ll_flags &LL_SBI_RMT_CLIENT ) {LASSERT (lli->lli_posix_acl ==NULL );if (lli->lli_remote_perms) {
@@ -1752,7 +1769,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)* lock on the client and set LLIF_MDS_SIZE_LOCK holding * it. */ mode =ll_take_md_lock (inode,MDS_INODELOCK_UPDATE , - &lockh,LDLM_FL_CBPENDING ); + &lockh,LDLM_FL_CBPENDING , +LCK_CR |LCK_CW | +LCK_PR |LCK_PW );if (mode) { if (lli->lli_flags & (LLIF_DONE_WRITING | LLIF_EPOCH_PENDING |
drivers/staging/lustre/lustre/llite/lproc_llite.c +37 -0
@@ -723,6 +723,41 @@ static int ll_sbi_flags_seq_show(struct seq_file *m, void *v) }LPROC_SEQ_FOPS_RO (ll_sbi_flags); +static int ll_xattr_cache_seq_show (struct seq_file *m,void *v) +{ +struct super_block *sb = m->private; +struct ll_sb_info *sbi =ll_s2sbi (sb); +int rc; + + rc =seq_printf (m,"%u\n" , sbi->ll_xattr_cache_enabled); + +return rc; +} + +static ssize_t ll_xattr_cache_seq_write (struct file *file,const char *buffer, +size_t count,loff_t *off) +{ +struct seq_file *seq = file->private_data; +struct super_block *sb = seq->private; +struct ll_sb_info *sbi =ll_s2sbi (sb); +int val, rc; + + rc =lprocfs_write_helper (buffer, count, &val); +if (rc) +return rc; + +if (val !=0 && val !=1 ) +return -ERANGE ; + +if (val ==1 && !(sbi->ll_flags &LL_SBI_XATTR_CACHE )) +return -ENOTSUPP ; + + sbi->ll_xattr_cache_enabled = val; + +return count; +} +LPROC_SEQ_FOPS (ll_xattr_cache); +static struct lprocfs_vars lprocfs_llite_obd_vars[] = { {"uuid" , &ll_sb_uuid_fops,0 ,0 },//{ "mntpt_path", ll_rd_path, 0, 0 },
@@ -751,6 +786,7 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = { { "lazystatfs", &ll_lazystatfs_fops, 0 }, { "max_easize", &ll_maxea_size_fops, 0, 0 }, { "sbi_flags", &ll_sbi_flags_fops, 0, 0 }, + { "xattr_cache", &ll_xattr_cache_fops, 0, 0 }, { 0 } };
@@ -802,6 +838,7 @@ struct llite_file_opcode { { LPROC_LL_ALLOC_INODE, LPROCFS_TYPE_REGS, "alloc_inode" }, { LPROC_LL_SETXATTR, LPROCFS_TYPE_REGS, "setxattr" }, { LPROC_LL_GETXATTR, LPROCFS_TYPE_REGS, "getxattr" }, + { LPROC_LL_GETXATTR_HITS, LPROCFS_TYPE_REGS, "getxattr_hits" }, { LPROC_LL_LISTXATTR, LPROCFS_TYPE_REGS, "listxattr" }, { LPROC_LL_REMOVEXATTR, LPROCFS_TYPE_REGS, "removexattr" }, { LPROC_LL_INODE_PERM, LPROCFS_TYPE_REGS, "inode_permission" },
drivers/staging/lustre/lustre/llite/namei.c +4 -0
@@ -222,6 +222,10 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,break ;LASSERT (lock->l_flags &LDLM_FL_CANCELING ); + +if (bits &MDS_INODELOCK_XATTR ) +ll_xattr_cache_destroy (inode); +/* For OPEN locks we differentiate between lock modes * LCK_CR, LCK_CW, LCK_PR - bug 22891 */ if (bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE |
drivers/staging/lustre/lustre/llite/super25.c +4 -0
@@ -187,11 +187,15 @@ static int __init init_lustre_lite(void)if (rc ==0 ) rc =vvp_global_init (); +if (rc ==0 ) + rc =ll_xattr_init (); +return rc; } static void __exit exit_lustre_lite(void) { +ll_xattr_fini ();vvp_global_fini ();del_timer (&ll_capa_timer);ll_capa_thread_stop ();
drivers/staging/lustre/lustre/llite/xattr.c +57 -45
135 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/xattr_cache.c new file +617 -0
617 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_internal.h +1 -0
@@ -72,6 +72,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, __u32 mode, __u64 rdev, __u64 flags, const void *data, int datalen);void mdc_unlink_pack (struct ptlrpc_request *req,struct md_op_data *op_data); +void mdc_getxattr_pack (struct ptlrpc_request *req,struct md_op_data *op_data);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);
drivers/staging/lustre/lustre/mdc/mdc_locks.c +62 -1
89 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/layout.c +34 -0
@@ -462,6 +462,25 @@ static const struct req_msg_field *ldlm_intent_unlink_client[] = { &RMF_NAME }; +static const struct req_msg_field *ldlm_intent_getxattr_client[] = { + &RMF_PTLRPC_BODY , + &RMF_DLM_REQ , + &RMF_LDLM_INTENT , + &RMF_MDT_BODY , + &RMF_CAPA1 , +}; + +static const struct req_msg_field *ldlm_intent_getxattr_server[] = { + &RMF_PTLRPC_BODY , + &RMF_DLM_REP , + &RMF_MDT_BODY , + &RMF_MDT_MD , + &RMF_ACL ,/* for req_capsule_extend/mdt_intent_policy */ + &RMF_EADATA , + &RMF_EAVALS , + &RMF_EAVALS_LENS +}; +static const struct req_msg_field *mds_getxattr_client[] = { &RMF_PTLRPC_BODY , &RMF_MDT_BODY ,
@@ -739,6 +758,7 @@ static struct req_format *req_formats[] = { &RQF_LDLM_INTENT_OPEN , &RQF_LDLM_INTENT_CREATE , &RQF_LDLM_INTENT_UNLINK , + &RQF_LDLM_INTENT_GETXATTR , &RQF_LDLM_INTENT_QUOTA , &RQF_QUOTA_DQACQ , &RQF_LOG_CANCEL,
@@ -1013,6 +1033,9 @@ struct req_msg_field RMF_EADATA = DEFINE_MSGF("eadata", 0, -1, NULL, NULL);EXPORT_SYMBOL (RMF_EADATA ); +struct req_msg_field RMF_EAVALS =DEFINE_MSGF ("eavals" ,0 ,-1 ,NULL ,NULL ); +EXPORT_SYMBOL (RMF_EAVALS ); +struct req_msg_field RMF_ACL =DEFINE_MSGF ("acl" ,RMF_F_NO_SIZE_CHECK ,LUSTRE_POSIX_ACL_MAX_SIZE ,NULL ,NULL );
@@ -1064,6 +1087,11 @@ struct req_msg_field RMF_RCS = lustre_swab_generic_32s, dump_rcs);EXPORT_SYMBOL (RMF_RCS ); +struct req_msg_field RMF_EAVALS_LENS = +DEFINE_MSGF ("eavals_lens" ,RMF_F_STRUCT_ARRAY ,sizeof (__u32), + lustre_swab_generic_32s,NULL ); +EXPORT_SYMBOL (RMF_EAVALS_LENS ); +struct req_msg_field RMF_OBD_ID =DEFINE_MSGF ("obd_id" ,0 ,sizeof (obd_id), lustre_swab_ost_last_id,NULL );
@@ -1421,6 +1449,12 @@ struct req_format RQF_LDLM_INTENT_UNLINK = ldlm_intent_unlink_client, ldlm_intent_server);EXPORT_SYMBOL (RQF_LDLM_INTENT_UNLINK ); +struct req_format RQF_LDLM_INTENT_GETXATTR = +DEFINE_REQ_FMT0 ("LDLM_INTENT_GETXATTR" , + ldlm_intent_getxattr_client, + ldlm_intent_getxattr_server); +EXPORT_SYMBOL (RQF_LDLM_INTENT_GETXATTR ); +struct req_format RQF_MDS_CLOSE =DEFINE_REQ_FMT0 ("MDS_CLOSE" , mdt_close_client, mds_last_unlink_server);
Signature · 1 line
1.7.9.5