From green at linuxhacker.ru Tue Sep 1 01:47:56 2015 From: green at linuxhacker.ru (Oleg Drokin) Date: Mon, 31 Aug 2015 21:47:56 -0400 Subject: [lustre-devel] New master tag 2.7.59 Message-ID: <77AE4C08-E12E-4AAA-BA8D-A3F5A19810C1@linuxhacker.ru> Hello! master branch of the Lustre community tree was just tagged as 2.7.59. Bye, Oleg From jeffrey.c.becker at nasa.gov Wed Sep 2 18:35:22 2015 From: jeffrey.c.becker at nasa.gov (Jeff Becker) Date: Wed, 2 Sep 2015 11:35:22 -0700 Subject: [lustre-devel] [PATCH v2] staging/lustre: fix block comment formatting In-Reply-To: References: <1440440898-49055-1-git-send-email-Jeffrey.C.Becker@nasa.gov> <188827c902704a95bc479702f4454e40@EXCHCS32.ornl.gov> Message-ID: <55E7416A.8020300@nasa.gov> Hello, On 08/27/2015 11:25 AM, Ben Evans wrote: > I believe the "*/ on a trailing line" is getting picked up by a doxygen > parser, which wants them that way. If you remove the * beginning in a > wrapped comment, I believe it treats it as a ³standard² comment. > > Ideally it would be nice to fully deoxygenate the whole thing, but that > probably shares issues of large-scale changes with tabathon. > > -Ben Evans > > On 8/27/15, 2:16 PM, "lustre-devel on behalf of Simmons, James A." > > wrote: > >>> Running checkpatch.pl on lnet/klnds/o2iblnd/o2iblnd.h produces several >>> "Block comments use a trailing */ on a separate line" warnings. This >>> patch >>> fixes these. >>> >>> Signed-off-by: Jeff Becker >>> --- >>> .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 284 >>> +++++++++------------ >>> 1 file changed, 127 insertions(+), 157 deletions(-) >> This original was done to avoid the 80 character limit with comments. I >> remember >> the discuss to make checkpatch.pl not complain in that case. Was that >> ever implemented? >> If so this patch could neatly tab the comments to make them line up. That >> would make it >> easier on the eyes. If that is not the case this patch is fine as it is. Having heard no further comments, is my patch OK, or does it need further modification? Thanks. -jeff >> >> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h >> b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h >> index f4b6c33..07e81cb 100644 >> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h >> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h >> @@ -79,38 +79,33 @@ >> #define IBLND_N_SCHED_HIGH 4 >> >> typedef struct { >> - int *kib_dev_failover; /* HCA failover */ >> - unsigned int *kib_service; /* IB service number */ >> - int *kib_min_reconnect_interval; /* first failed connection >> - * retry... */ >> - int *kib_max_reconnect_interval; /* ...exponentially increasing >> - * to this */ >> - int *kib_cksum; /* checksum kib_msg_t? */ >> - int *kib_timeout; /* comms timeout (seconds) */ >> - int *kib_keepalive; /* keepalive timeout (seconds) */ >> - int *kib_ntx; /* # tx descs */ >> - int *kib_credits; /* # concurrent sends */ >> - int *kib_peertxcredits; /* # concurrent sends to 1 peer */ >> - int *kib_peerrtrcredits; /* # per-peer router buffer >> - * credits */ >> - int *kib_peercredits_hiw; /* # when eagerly to return >> - * credits */ >> - int *kib_peertimeout; /* seconds to consider peer dead */ >> - char **kib_default_ipif; /* default IPoIB interface */ >> - int *kib_retry_count; >> - int *kib_rnr_retry_count; >> - int *kib_concurrent_sends; /* send work queue sizing */ >> - int *kib_ib_mtu; /* IB MTU */ >> - int *kib_map_on_demand; /* map-on-demand if RD has more >> - * fragments than this value, 0 >> - * disable map-on-demand */ >> - int *kib_fmr_pool_size; /* # FMRs in pool */ >> - int *kib_fmr_flush_trigger; /* When to trigger FMR flush */ >> - int *kib_fmr_cache; /* enable FMR pool cache? */ >> - int *kib_require_priv_port; /* accept only privileged ports */ >> - int *kib_use_priv_port; /* use privileged port for active >> - * connect */ >> - int *kib_nscheds; /* # threads on each CPT */ >> + int *kib_dev_failover; /* HCA failover */ >> + unsigned int *kib_service; /* IB service number */ >> + int *kib_min_reconnect_interval; /* first failed connection retry... */ >> + int *kib_max_reconnect_interval; /* exponentially increasing to this */ >> + int *kib_cksum; /* checksum kib_msg_t? */ >> + int *kib_timeout; /* comms timeout (seconds) */ >> + int *kib_keepalive; /* keepalive timeout (seconds) */ >> + int *kib_ntx; /* # tx descs */ >> + int *kib_credits; /* # concurrent sends */ >> + int *kib_peertxcredits; /* # concurrent sends to 1 peer */ >> + int *kib_peerrtrcredits; /* # per-peer router buffer credits */ >> + int *kib_peercredits_hiw; /* # when eagerly to return credits */ >> + int *kib_peertimeout; /* seconds to consider peer dead */ >> + char **kib_default_ipif; /* default IPoIB interface */ >> + int *kib_retry_count; >> + int *kib_rnr_retry_count; >> + int *kib_concurrent_sends; /* send work queue sizing */ >> + int *kib_ib_mtu; /* IB MTU */ >> + int *kib_map_on_demand; /* map-on-demand if RD has more */ >> + /* fragments than this value, 0 */ >> + /* disable map-on-demand */ >> + int *kib_fmr_pool_size; /* # FMRs in pool */ >> + int *kib_fmr_flush_trigger; /* When to trigger FMR flush */ >> + int *kib_fmr_cache; /* enable FMR pool cache? */ >> + int *kib_require_priv_port; /* accept only privileged ports */ >> + int *kib_use_priv_port; /* use privileged port for active connect */ >> + int *kib_nscheds; /* # threads on each CPT */ >> } kib_tunables_t; >> >> extern kib_tunables_t kiblnd_tunables; >> @@ -199,8 +194,7 @@ typedef struct { >> unsigned long ibd_next_failover; >> int ibd_failed_failover; /* # failover failures */ >> unsigned int ibd_failover; /* failover in progress */ >> - unsigned int ibd_can_failover; /* IPoIB interface is a bonding >> - * master */ >> + unsigned int ibd_can_failover; /* IPoIB interface is a bonding master */ >> struct list_head ibd_nets; >> struct kib_hca_dev *ibd_hdev; >> } kib_dev_t; >> @@ -249,28 +243,26 @@ typedef struct kib_poolset { >> char ps_name[IBLND_POOL_NAME_LEN]; /* pool set name */ >> struct list_head ps_pool_list; /* list of pools */ >> struct list_head ps_failed_pool_list;/* failed pool list */ >> - unsigned long ps_next_retry; /* time stamp for retry if >> - * failed to allocate */ >> + unsigned long ps_next_retry; /* time stamp for retry if */ >> + /* failed to allocate */ >> int ps_increasing; /* is allocating new pool */ >> int ps_pool_size; /* new pool size */ >> int ps_cpt; /* CPT id */ >> >> kib_ps_pool_create_t ps_pool_create; /* create a new pool */ >> kib_ps_pool_destroy_t ps_pool_destroy; /* destroy a pool */ >> - kib_ps_node_init_t ps_node_init; /* initialize new allocated >> - * node */ >> + kib_ps_node_init_t ps_node_init; /* initialize new allocated node */ >> kib_ps_node_fini_t ps_node_fini; /* finalize node */ >> } kib_poolset_t; >> >> typedef struct kib_pool { >> - struct list_head po_list; /* chain on pool list */ >> - struct list_head po_free_list; /* pre-allocated node */ >> - kib_poolset_t *po_owner; /* pool_set of this pool */ >> - unsigned long po_deadline; /* deadline of this pool */ >> - int po_allocated; /* # of elements in use */ >> - int po_failed; /* pool is created on failed >> - * HCA */ >> - int po_size; /* # of pre-allocated elements */ >> + struct list_head po_list; /* chain on pool list */ >> + struct list_head po_free_list; /* pre-allocated node */ >> + kib_poolset_t *po_owner; /* pool_set of this pool */ >> + unsigned long po_deadline; /* deadline of this pool */ >> + int po_allocated; /* # of elements in use */ >> + int po_failed; /* pool is created on failed HCA */ >> + int po_size; /* # of pre-allocated elements */ >> } kib_pool_t; >> >> typedef struct { >> @@ -295,8 +287,8 @@ typedef struct { >> int fps_pool_size; >> int fps_flush_trigger; >> int fps_increasing; /* is allocating new pool */ >> - unsigned long fps_next_retry; /* time stamp for retry if >> - * failed to allocate */ >> + unsigned long fps_next_retry; /* time stamp for retry if*/ >> + /* failed to allocate */ >> } kib_fmr_poolset_t; >> >> typedef struct { >> @@ -344,31 +336,22 @@ struct kib_sched_info { >> }; >> >> typedef struct { >> - int kib_init; /* initialisation state */ >> - int kib_shutdown; /* shut down? */ >> - struct list_head kib_devs; /* IB devices extant */ >> - struct list_head kib_failed_devs; /* list head of failed >> - * devices */ >> - wait_queue_head_t kib_failover_waitq; /* schedulers sleep here */ >> - atomic_t kib_nthreads; /* # live threads */ >> - rwlock_t kib_global_lock; /* stabilize net/dev/peer/conn >> - * ops */ >> - struct list_head *kib_peers; /* hash table of all my known >> - * peers */ >> - int kib_peer_hash_size; /* size of kib_peers */ >> - void *kib_connd; /* the connd task >> - * (serialisation assertions) >> - */ >> - struct list_head kib_connd_conns; /* connections to >> - * setup/teardown */ >> - struct list_head kib_connd_zombies; /* connections with zero >> - * refcount */ >> - wait_queue_head_t kib_connd_waitq; /* connection daemon sleeps >> - * here */ >> - spinlock_t kib_connd_lock; /* serialise */ >> - struct ib_qp_attr kib_error_qpa; /* QP->ERROR */ >> - struct kib_sched_info **kib_scheds; /* percpt data for schedulers >> - */ >> + int kib_init; /* initialisation state */ >> + int kib_shutdown; /* shut down? */ >> + struct list_head kib_devs; /* IB devices extant */ >> + struct list_head kib_failed_devs; /* list head of failed devices */ >> + wait_queue_head_t kib_failover_waitq; /* schedulers sleep here */ >> + atomic_t kib_nthreads; /* # live threads */ >> + rwlock_t kib_global_lock; /* stabilize net/dev/peer/conn ops */ >> + struct list_head *kib_peers; /* hash table of all my known peers */ >> + int kib_peer_hash_size; /* size of kib_peers */ >> + void *kib_connd; /* the connd task (serialisation assertions) */ >> + struct list_head kib_connd_conns; /* connections to setup/teardown */ >> + struct list_head kib_connd_zombies; /* connections with zero refcount */ >> + wait_queue_head_t kib_connd_waitq; /* connection daemon sleeps here */ >> + spinlock_t kib_connd_lock; /* serialise */ >> + struct ib_qp_attr kib_error_qpa; /* QP->ERROR */ >> + struct kib_sched_info **kib_scheds; /* percpt data for schedulers */ >> } kib_data_t; >> >> #define IBLND_INIT_NOTHING 0 >> @@ -480,10 +463,10 @@ typedef struct { >> #define IBLND_REJECT_FATAL 3 /* Anything else */ >> #define IBLND_REJECT_CONN_UNCOMPAT 4 /* incompatible version peer */ >> #define IBLND_REJECT_CONN_STALE 5 /* stale peer */ >> -#define IBLND_REJECT_RDMA_FRAGS 6 /* Fatal: peer's rdma frags can't >> match >> - * mine */ >> -#define IBLND_REJECT_MSG_QUEUE_SIZE 7 /* Fatal: peer's msg queue size >> can't >> - * match mine */ >> +#define IBLND_REJECT_RDMA_FRAGS 6 /* Fatal: peer's rdma frags can't >> match */ >> + /* mine */ >> +#define IBLND_REJECT_MSG_QUEUE_SIZE 7 /* Fatal: peer's msg queue size >> can't */ >> + /* match mine */ >> >> /***********************************************************************/ >> >> @@ -491,8 +474,7 @@ typedef struct kib_rx /* >> receive message */ >> { >> struct list_head rx_list; /* queue for attention */ >> struct kib_conn *rx_conn; /* owning conn */ >> - int rx_nob; /* # bytes received (-1 while >> - * posted) */ >> + int rx_nob; /* # bytes received (-1 while posted) */ >> enum ib_wc_status rx_status; /* completion status */ >> kib_msg_t *rx_msg; /* message buffer (host vaddr) */ >> __u64 rx_msgaddr; /* message buffer (I/O addr) */ >> @@ -501,38 +483,35 @@ typedef struct kib_rx /* >> receive message */ >> struct ib_sge rx_sge; /* ...and its memory */ >> } kib_rx_t; >> >> -#define IBLND_POSTRX_DONT_POST 0 /* don't post */ >> -#define IBLND_POSTRX_NO_CREDIT 1 /* post: no credits */ >> -#define IBLND_POSTRX_PEER_CREDIT 2 /* post: give peer back 1 credit */ >> -#define IBLND_POSTRX_RSRVD_CREDIT 3 /* post: give myself back 1 >> reserved >> - * credit */ >> +#define IBLND_POSTRX_DONT_POST 0 /* don't post */ >> +#define IBLND_POSTRX_NO_CREDIT 1 /* post: no credits */ >> +#define IBLND_POSTRX_PEER_CREDIT 2 /* post: give peer back 1 credit */ >> +#define IBLND_POSTRX_RSRVD_CREDIT 3 /* post: give self back 1 reserved >> credit */ >> >> typedef struct kib_tx /* transmit message */ >> { >> - struct list_head tx_list; /* queue on idle_txs ibc_tx_queue >> - * etc. */ >> - kib_tx_pool_t *tx_pool; /* pool I'm from */ >> - struct kib_conn *tx_conn; /* owning conn */ >> - short tx_sending; /* # tx callbacks outstanding */ >> - short tx_queued; /* queued for sending */ >> - short tx_waiting; /* waiting for peer */ >> - int tx_status; /* LNET completion status */ >> - unsigned long tx_deadline; /* completion deadline */ >> - __u64 tx_cookie; /* completion cookie */ >> - lnet_msg_t *tx_lntmsg[2]; /* lnet msgs to finalize on >> - * completion */ >> - kib_msg_t *tx_msg; /* message buffer (host vaddr) */ >> - __u64 tx_msgaddr; /* message buffer (I/O addr) */ >> + struct list_head tx_list; /* queue on idle_txs ibc_tx_queue etc. */ >> + kib_tx_pool_t *tx_pool; /* pool I'm from */ >> + struct kib_conn *tx_conn; /* owning conn */ >> + short tx_sending; /* # tx callbacks outstanding */ >> + short tx_queued; /* queued for sending */ >> + short tx_waiting; /* waiting for peer */ >> + int tx_status; /* LNET completion status */ >> + unsigned long tx_deadline; /* completion deadline */ >> + __u64 tx_cookie; /* completion cookie */ >> + lnet_msg_t *tx_lntmsg[2]; /* lnet msgs to finalize on completion */ >> + kib_msg_t *tx_msg; /* message buffer (host vaddr) */ >> + __u64 tx_msgaddr; /* message buffer (I/O addr) */ >> DECLARE_PCI_UNMAP_ADDR(tx_msgunmap); /* for dma_unmap_single() */ >> - int tx_nwrq; /* # send work items */ >> - struct ib_send_wr *tx_wrq; /* send work items... */ >> - struct ib_sge *tx_sge; /* ...and their memory */ >> - kib_rdma_desc_t *tx_rd; /* rdma descriptor */ >> - int tx_nfrags; /* # entries in... */ >> - struct scatterlist *tx_frags; /* dma_map_sg descriptor */ >> - __u64 *tx_pages; /* rdma phys page addrs */ >> - kib_fmr_t fmr; /* FMR */ >> - int tx_dmadir; /* dma direction */ >> + int tx_nwrq; /* # send work items */ >> + struct ib_send_wr *tx_wrq; /* send work items... */ >> + struct ib_sge *tx_sge; /* ...and their memory */ >> + kib_rdma_desc_t *tx_rd; /* rdma descriptor */ >> + int tx_nfrags; /* # entries in... */ >> + struct scatterlist *tx_frags; /* dma_map_sg descriptor */ >> + __u64 *tx_pages; /* rdma phys page addrs */ >> + kib_fmr_t fmr; /* FMR */ >> + int tx_dmadir; /* dma direction */ >> } kib_tx_t; >> >> typedef struct kib_connvars { >> @@ -540,53 +519,44 @@ typedef struct kib_connvars { >> } kib_connvars_t; >> >> typedef struct kib_conn { >> - struct kib_sched_info *ibc_sched; /* scheduler information */ >> - struct kib_peer *ibc_peer; /* owning peer */ >> - kib_hca_dev_t *ibc_hdev; /* HCA bound on */ >> - struct list_head ibc_list; /* stash on peer's conn >> - * list */ >> - struct list_head ibc_sched_list; /* schedule for attention */ >> - __u16 ibc_version; /* version of connection */ >> - __u64 ibc_incarnation; /* which instance of the >> - * peer */ >> - atomic_t ibc_refcount; /* # users */ >> - int ibc_state; /* what's happening */ >> - int ibc_nsends_posted; /* # uncompleted sends */ >> - int ibc_noops_posted; /* # uncompleted NOOPs */ >> - int ibc_credits; /* # credits I have */ >> + struct kib_sched_info *ibc_sched; /* scheduler information */ >> + struct kib_peer *ibc_peer; /* owning peer */ >> + kib_hca_dev_t *ibc_hdev; /* HCA bound on */ >> + struct list_head ibc_list; /* stash on peer's conn list */ >> + struct list_head ibc_sched_list; /* schedule for attention */ >> + __u16 ibc_version; /* version of connection */ >> + __u64 ibc_incarnation; /* which instance of the peer */ >> + atomic_t ibc_refcount; /* # users */ >> + int ibc_state; /* what's happening */ >> + int ibc_nsends_posted; /* # uncompleted sends */ >> + int ibc_noops_posted; /* # uncompleted NOOPs */ >> + int ibc_credits; /* # credits I have */ >> int ibc_outstanding_credits; /* # credits to return */ >> int ibc_reserved_credits; /* # ACK/DONE msg credits */ >> - int ibc_comms_error; /* set on comms error */ >> - unsigned int ibc_nrx:16; /* receive buffers owned */ >> - unsigned int ibc_scheduled:1; /* scheduled for attention >> - */ >> - unsigned int ibc_ready:1; /* CQ callback fired */ >> - unsigned long ibc_last_send; /* time of last send */ >> - struct list_head ibc_connd_list; /* link chain for >> - * kiblnd_check_conns only >> - */ >> - struct list_head ibc_early_rxs; /* rxs completed before >> - * ESTABLISHED */ >> - struct list_head ibc_tx_noops; /* IBLND_MSG_NOOPs for >> - * IBLND_MSG_VERSION_1 */ >> - struct list_head ibc_tx_queue; /* sends that need a credit >> - */ >> - struct list_head ibc_tx_queue_nocred; /* sends that don't need a >> - * credit */ >> - struct list_head ibc_tx_queue_rsrvd; /* sends that need to >> - * reserve an ACK/DONE msg >> - */ >> - struct list_head ibc_active_txs; /* active tx awaiting >> - * completion */ >> - spinlock_t ibc_lock; /* serialise */ >> - kib_rx_t *ibc_rxs; /* the rx descs */ >> - kib_pages_t *ibc_rx_pages; /* premapped rx msg pages */ >> - >> - struct rdma_cm_id *ibc_cmid; /* CM id */ >> - struct ib_cq *ibc_cq; /* completion queue */ >> - >> - kib_connvars_t *ibc_connvars; /* in-progress connection >> - * state */ >> + int ibc_comms_error; /* set on comms error */ >> + unsigned int ibc_nrx:16; /* receive buffers owned */ >> + unsigned int ibc_scheduled:1; /* scheduled for attention */ >> + unsigned int ibc_ready:1; /* CQ callback fired */ >> + unsigned long ibc_last_send; /* time of last send */ >> + struct list_head ibc_connd_list; /* link chain for */ >> + /* kiblnd_check_conns only */ >> + struct list_head ibc_early_rxs; /* rxs completed before ESTABLISHED */ >> + struct list_head ibc_tx_noops; /* IBLND_MSG_NOOPs for */ >> + /* IBLND_MSG_VERSION_1 */ >> + struct list_head ibc_tx_queue; /* sends that need a credit */ >> + struct list_head ibc_tx_queue_nocred; /* sends that don't need a */ >> + /* credit */ >> + struct list_head ibc_tx_queue_rsrvd; /* sends that need to */ >> + /* reserve an ACK/DONE msg */ >> + struct list_head ibc_active_txs; /* active tx awaiting completion */ >> + spinlock_t ibc_lock; /* serialise */ >> + kib_rx_t *ibc_rxs; /* the rx descs */ >> + kib_pages_t *ibc_rx_pages; /* premapped rx msg pages */ >> + >> + struct rdma_cm_id *ibc_cmid; /* CM id */ >> + struct ib_cq *ibc_cq; /* completion queue */ >> + >> + kib_connvars_t *ibc_connvars; /* in-progress connection state */ >> } kib_conn_t; >> >> #define IBLND_CONN_INIT 0 /* being initialised */ >> @@ -780,8 +750,8 @@ kiblnd_queue2str(kib_conn_t *conn, struct list_head >> *q) >> return NULL; >> } >> >> -/* CAVEAT EMPTOR: We rely on descriptor alignment to allow us to use the >> - * lowest bits of the work request id to stash the work item type. */ >> +/* CAVEAT EMPTOR: We rely on descriptor alignment to allow us to use the >> */ >> +/* lowest bits of the work request id to stash the work item type. */ >> >> #define IBLND_WID_TX 0 >> #define IBLND_WID_RDMA 1 >> @@ -928,9 +898,9 @@ static inline unsigned int kiblnd_sg_dma_len(struct >> ib_device *dev, >> return ib_sg_dma_len(dev, sg); >> } >> >> -/* XXX We use KIBLND_CONN_PARAM(e) as writable buffer, it's not strictly >> - * right because OFED1.2 defines it as const, to use it we have to add >> - * (void *) cast to overcome "const" */ >> +/* XXX We use KIBLND_CONN_PARAM(e) as writable buffer, it's not strictly >> */ >> +/* right because OFED1.2 defines it as const, to use it we have to add */ >> +/* (void *) cast to overcome "const" */ >> >> #define KIBLND_CONN_PARAM(e) ((e)->param.conn.private_data) >> #define KIBLND_CONN_PARAM_LEN(e) ((e)->param.conn.private_data_len) >> -- >> 2.4.5 >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From simmonsja at ornl.gov Wed Sep 2 22:29:48 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 2 Sep 2015 22:29:48 +0000 Subject: [lustre-devel] LU-6402 MODULE_AUTHOR changes Message-ID: For the LU-6402 the modinfo is pretty stale so I send up a patch at http://review.whamcloud.com/#/c/16132. Andreas brought the topic of who should the MODULE_AUTHOR be. Currently it is Sun Inc which is not the case. I changed it to Intel but not might not be the right choice anymore. So what should the MODULE_AUTHOR be? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bevans at cray.com Thu Sep 3 13:58:15 2015 From: bevans at cray.com (Ben Evans) Date: Thu, 3 Sep 2015 13:58:15 +0000 Subject: [lustre-devel] LU-6402 MODULE_AUTHOR changes Message-ID: My personal preference would be for OpenSFS to be listed, since Lustre development is a community effort, rather than a product of any specific company. For example, I’d have no problem with Intel’s name on their next-gen interconnect lnd code, or with Cray’s name on the GNI code, etc. but the core parts of Lustre should belong to OpenSFS or EOFS. -Ben Evans From: lustre-devel > on behalf of "Simmons, James A." > Date: Wednesday, September 2, 2015 at 5:29 PM To: "lustre-devel at lists.lustre.org" > Subject: [lustre-devel] LU-6402 MODULE_AUTHOR changes For the LU-6402 the modinfo is pretty stale so I send up a patch at http://review.whamcloud.com/#/c/16132. Andreas brought the topic of who should the MODULE_AUTHOR be. Currently it is Sun Inc which is not the case. I changed it to Intel but not might not be the right choice anymore. So what should the MODULE_AUTHOR be? -------------- next part -------------- An HTML attachment was scrubbed... URL: From eman.yarlagadda at intel.com Thu Sep 3 21:27:58 2015 From: eman.yarlagadda at intel.com (Yarlagadda, Eman) Date: Thu, 3 Sep 2015 21:27:58 +0000 Subject: [lustre-devel] Announcing Lustre* User Group PRC 2015 Message-ID: [Intel(r) - High Performance Data Division] Event Details: Hear directly from industry thought leaders about the latest Lustre* file system trends by attending the 2015 PRC Lustre* Users Group conference. Don't miss this exclusive opportunity to collaborate with industry leaders to advance the Lustre* file system and contribute to new releases on behalf of the open source community. Register Here Call for Papers: We are inviting you to send proposals for presentations at this event. Please send an abstract for a 30min technical presentation to fan.yong at intel.com before September 30th 2015. Event Date: October 20th, 2015 from 8:30am - 5:00pm (Click Here to Add Event to your Calendar) Location: Regent Hotel Beijing (99 Jinbao Street, Dongcheng District, Beijing, 100005, China) Telephone: +86 10 8522 1888 Review Agenda (To be published soon) UNABLE TO ATTEND? We're sorry that you cannot make it to the event, but you can still sign-up for our mailing list to receive future communications about this gathering and valuable information about Intel (r) Solutions for Lustre* software. Subscribe to Newsletter (Click Here) [HPDD PRC Footer] [Intel(r)] Trademarks | Terms of Use | Privacy Policy | Contact Us Copyright (c) 2014 Intel Corporation. All rights reserved. Intel, the Intel logo, and Intel Xeon are trademarks of Intel Corporation in the U.S. and/or other countries. *Other names and brands may be claimed as the property of others. *Other names and brands may be claimed as the property of others. -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Tue Sep 8 23:57:41 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Tue, 08 Sep 2015 16:57:41 -0700 Subject: [lustre-devel] Lustre 2.9 planning and Projects page Message-ID: <55EF75F5.70206@llnl.gov> Hello everyone, With Lustre 2.8 nearing completion, it is a good time for everyone to communicate their intentions for major changes that they intend to try to complete in time for 2.9. Not everything we had hoped to land for 2.8 was able to run the complete peer review process and land before the Feature Freeze or Code Freeze windows closed. Those changes that missed the 2.8 landing windows are, at this time, the closest to being ready for landing during the 2.9 landing windows. Keep in mind that major changes and features that you want to get into Lustre are more likely to land smoothly if you discuss your intentions and design details here on the lustre-devel mailing list well in advance of the target landing date that you have in mind. Peer review of designs is as important as peer review of code. If your peers have approved your design ahead code submission time, even informally, then the code review process is likely to go much more smoothly. Also, for any change reasonably large in size (e.g. new features, major code refactorings), it is wise to list your under-way project on the lustre.org wiki's Projects page: http://wiki.lustre.org/Projects Keeping your project entry and its target completion date current will help us all know what other work is going on in parallel that might impact our own projects. Chris From simmonsja at ornl.gov Thu Sep 10 20:15:59 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Thu, 10 Sep 2015 20:15:59 +0000 Subject: [lustre-devel] DNE2 patch list for testing Message-ID: Hi Chris. Here are the patches I'm testing the latest version of master with: http://review.whamcloud.com/#/c/16353 http://review.whamcloud.com/#/c/15899 http://review.whamcloud.com/#/c/16333 http://review.whamcloud.com/#/c/16117 Their also http://review.whamcloud.com/#/c/13224 but that patch needs more work. -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Thu Sep 10 20:35:05 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Thu, 10 Sep 2015 13:35:05 -0700 Subject: [lustre-devel] DNE2 patch list for testing In-Reply-To: References: Message-ID: <55F1E979.3070504@llnl.gov> Great! Thank you. On 09/10/2015 01:15 PM, Simmons, James A. wrote: > Hi Chris. > > Here are the patches I’m testing the latest version of master with: > > http://review.whamcloud.com/#/c/16353 > > http://review.whamcloud.com/#/c/15899 > > http://review.whamcloud.com/#/c/16333 > > http://review.whamcloud.com/#/c/16117 > > Their also http://review.whamcloud.com/#/c/13224 but that patch needs more > > work. > From paf at cray.com Fri Sep 11 19:13:23 2015 From: paf at cray.com (Patrick Farrell) Date: Fri, 11 Sep 2015 19:13:23 +0000 Subject: [lustre-devel] FW: [HPDD-discuss] [PATCH] nfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations In-Reply-To: <1441966830-5517-1-git-send-email-jeff.layton@primarydata.com> References: <1441966830-5517-1-git-send-email-jeff.layton@primarydata.com> Message-ID: Lustre seems a likely candidate for adding this flag as well. Any thoughts? - Patrick ________________________________________ From: HPDD-discuss [hpdd-discuss-bounces at lists.01.org] on behalf of Jeff Layton [jlayton at poochiereds.net] Sent: Friday, September 11, 2015 5:20 AM To: bfields at fieldses.org Cc: cluster-devel at redhat.com; linux-nfs at vger.kernel.org; fuse-devel at lists.sourceforge.net; linux-kernel at vger.kernel.org; HPDD-discuss at lists.01.org; linux-fsdevel at vger.kernel.org; ceph-devel at vger.kernel.org; ocfs2-devel at oss.oracle.com Subject: [HPDD-discuss] [PATCH] nfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations With NFSv3 nfsd will always attempt to send along WCC data to the client. This generally involves saving off the in-core inode information prior to doing the operation on the given filehandle, and then issuing a vfs_getattr to it after the op. Some filesystems (particularly clustered or networked ones) have an expensive ->getattr inode operation. Atomicitiy is also often difficult or impossible to guarantee on such filesystems. For those, we're best off not trying to provide WCC information to the client at all, and to simply allow it to poll for that information as needed with a GETATTR RPC. This patch adds a new flags field to struct export_operations, and defines a new EXPORT_OP_NOWCC flag that filesystems can use to indicate that nfsd should not attempt to provide WCC info in NFSv3 replies. It also adds a blurb about the new flags field and flag to the exporting documentation. The server will also now skip collecting this information for NFSv2 as well, since that info is never used there anyway. Note that this patch does not add this flag to any filesystem export_operations structures. This was originally developed to allow reexporting nfs via nfsd. That code is not (and may never be) suitable for merging into mainline. Other filesystems may want to consider enabling this flag too. It's hard to tell however which ones have export operations to enable export via knfsd and which ones mostly rely on them for open-by-filehandle support, so I'm leaving that up to the individual maintainers to decide. I am cc'ing the relevant lists for those filesystems that I think may want to consider adding this though. Cc: HPDD-discuss at lists.01.org Cc: ceph-devel at vger.kernel.org Cc: cluster-devel at redhat.com Cc: fuse-devel at lists.sourceforge.net Cc: ocfs2-devel at oss.oracle.com Signed-off-by: Jeff Layton --- Documentation/filesystems/nfs/Exporting | 27 +++++++++++++++++++++++++++ fs/nfsd/nfs3xdr.c | 5 ++++- fs/nfsd/nfsfh.c | 14 ++++++++++++++ fs/nfsd/nfsfh.h | 5 ++++- include/linux/exportfs.h | 2 ++ 5 files changed, 51 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/nfs/Exporting b/Documentation/filesystems/nfs/Exporting index 520a4becb75c..fa636cde3907 100644 --- a/Documentation/filesystems/nfs/Exporting +++ b/Documentation/filesystems/nfs/Exporting @@ -138,6 +138,11 @@ struct which has the following members: to find potential names, and matches inode numbers to find the correct match. + flags + Some filesystems may need to be handled differently than others. The + export_operations struct also includes a flags field that allows the + filesystem to communicate such information to nfsd. See the Export + Operations Flags section below for more explanation. A filehandle fragment consists of an array of 1 or more 4byte words, together with a one byte "type". @@ -147,3 +152,25 @@ generated by encode_fh, in which case it will have been padded with nuls. Rather, the encode_fh routine should choose a "type" which indicates the decode_fh how much of the filehandle is valid, and how it should be interpreted. + +Export Operations Flags +----------------------- +In addition to the operation vector pointers, struct export_operations also +contains a "flags" field that allows the filesystem to communicate to nfsd +that it may want to do things differently when dealing with it. The +following flags are defined: + + EXPORT_OP_NOWCC + RFC 1813 recommends that servers always send weak cache consistency + (WCC) data to the client after each operation. The server should + atomically collect attributes about the inode, do an operation on it, + and then collect the attributes afterward. This allows the client to + skip issuing GETATTRs in some situations but means that the server + is calling vfs_getattr for almost all RPCs. On some filesystems + (particularly those that are clustered or networked) this is expensive + and atomicity is difficult to guarantee. This flag indicates to nfsd + that it should skip providing WCC attributes to the client in NFSv3 + replies when doing operations on this filesystem. Consider enabling + this on filesystems that have an expensive ->getattr inode operation, + or when atomicity between pre and post operation attribute collection + is impossible to guarantee. diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 01dcd494f781..c30c8c604e2a 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -203,7 +203,7 @@ static __be32 * encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) { struct dentry *dentry = fhp->fh_dentry; - if (dentry && d_really_is_positive(dentry)) { + if (!fhp->fh_no_wcc && dentry && d_really_is_positive(dentry)) { __be32 err; struct kstat stat; @@ -256,6 +256,9 @@ void fill_post_wcc(struct svc_fh *fhp) { __be32 err; + if (fhp->fh_no_wcc) + return; + if (fhp->fh_post_saved) printk("nfsd: inode locked twice during operation.\n"); diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 350041a40fe5..29ae37f62b9b 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -267,6 +267,16 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp) fhp->fh_dentry = dentry; fhp->fh_export = exp; + + switch (rqstp->rq_vers) { + case 3: + if (!(dentry->d_sb->s_export_op->flags & EXPORT_OP_NOWCC)) + break; + /* Fallthrough */ + case 2: + fhp->fh_no_wcc = true; + } + return 0; out: exp_put(exp); @@ -535,6 +545,9 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, */ set_version_and_fsid_type(fhp, exp, ref_fh); + /* If we have a ref_fh, then copy the fh_no_wcc setting from it. */ + fhp->fh_no_wcc = ref_fh ? ref_fh->fh_no_wcc : false; + if (ref_fh == fhp) fh_put(ref_fh); @@ -641,6 +654,7 @@ fh_put(struct svc_fh *fhp) exp_put(exp); fhp->fh_export = NULL; } + fhp->fh_no_wcc = false; return; } diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h index 1e90dad4926b..9ddead4d98f8 100644 --- a/fs/nfsd/nfsfh.h +++ b/fs/nfsd/nfsfh.h @@ -32,6 +32,7 @@ typedef struct svc_fh { unsigned char fh_locked; /* inode locked by us */ unsigned char fh_want_write; /* remount protection taken */ + bool fh_no_wcc; /* no wcc data needed */ #ifdef CONFIG_NFSD_V3 unsigned char fh_post_saved; /* post-op attrs saved */ @@ -51,7 +52,6 @@ typedef struct svc_fh { struct kstat fh_post_attr; /* full attrs after operation */ u64 fh_post_change; /* nfsv4 change; see above */ #endif /* CONFIG_NFSD_V3 */ - } svc_fh; enum nfsd_fsid { @@ -225,6 +225,9 @@ fill_pre_wcc(struct svc_fh *fhp) { struct inode *inode; + if (fhp->fh_no_wcc) + return; + inode = d_inode(fhp->fh_dentry); if (!fhp->fh_pre_saved) { fhp->fh_pre_mtime = inode->i_mtime; diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index fa05e04c5531..600c3fccc999 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -214,6 +214,8 @@ struct export_operations { bool write, u32 *device_generation); int (*commit_blocks)(struct inode *inode, struct iomap *iomaps, int nr_iomaps, struct iattr *iattr); +#define EXPORT_OP_NOWCC (0x1) /* Don't collect wcc data for NFSv3 replies */ + unsigned long flags; }; extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, -- 2.4.3 _______________________________________________ HPDD-discuss mailing list HPDD-discuss at lists.01.org https://lists.01.org/mailman/listinfo/hpdd-discuss From andreas.dilger at intel.com Sat Sep 12 04:44:54 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Sat, 12 Sep 2015 04:44:54 +0000 Subject: [lustre-devel] FW: [HPDD-discuss] [PATCH] nfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations In-Reply-To: References: <1441966830-5517-1-git-send-email-jeff.layton@primarydata.com> Message-ID: On 2015/09/11, 1:13 PM, "lustre-devel on behalf of Patrick Farrell" wrote: >Lustre seems a likely candidate for adding this flag as well. Any >thoughts? Seems like it might be a win, but then Lustre can fetch the attributes along with most metadata operations and will cache them locally for things like writes, so it isn't a completely obvious win. Any chance you could benchmark this to see if it improves things noticeably? Cheers, Andreas >- Patrick >________________________________________ >From: HPDD-discuss [hpdd-discuss-bounces at lists.01.org] on behalf of Jeff >Layton [jlayton at poochiereds.net] >Sent: Friday, September 11, 2015 5:20 AM >To: bfields at fieldses.org >Cc: cluster-devel at redhat.com; linux-nfs at vger.kernel.org; >fuse-devel at lists.sourceforge.net; linux-kernel at vger.kernel.org; >HPDD-discuss at lists.01.org; linux-fsdevel at vger.kernel.org; >ceph-devel at vger.kernel.org; ocfs2-devel at oss.oracle.com >Subject: [HPDD-discuss] [PATCH] nfsd: add a new EXPORT_OP_NOWCC flag to >struct export_operations > >With NFSv3 nfsd will always attempt to send along WCC data to the >client. This generally involves saving off the in-core inode information >prior to doing the operation on the given filehandle, and then issuing a >vfs_getattr to it after the op. > >Some filesystems (particularly clustered or networked ones) have an >expensive ->getattr inode operation. Atomicitiy is also often difficult >or impossible to guarantee on such filesystems. For those, we're best >off not trying to provide WCC information to the client at all, and to >simply allow it to poll for that information as needed with a GETATTR >RPC. > >This patch adds a new flags field to struct export_operations, and >defines a new EXPORT_OP_NOWCC flag that filesystems can use to indicate >that nfsd should not attempt to provide WCC info in NFSv3 replies. It >also adds a blurb about the new flags field and flag to the exporting >documentation. > >The server will also now skip collecting this information for NFSv2 as >well, since that info is never used there anyway. > >Note that this patch does not add this flag to any filesystem >export_operations structures. This was originally developed to allow >reexporting nfs via nfsd. That code is not (and may never be) suitable >for merging into mainline. > >Other filesystems may want to consider enabling this flag too. It's hard >to tell however which ones have export operations to enable export via >knfsd and which ones mostly rely on them for open-by-filehandle support, >so I'm leaving that up to the individual maintainers to decide. I am >cc'ing the relevant lists for those filesystems that I think may want to >consider adding this though. > >Cc: HPDD-discuss at lists.01.org >Cc: ceph-devel at vger.kernel.org >Cc: cluster-devel at redhat.com >Cc: fuse-devel at lists.sourceforge.net >Cc: ocfs2-devel at oss.oracle.com >Signed-off-by: Jeff Layton >--- > Documentation/filesystems/nfs/Exporting | 27 +++++++++++++++++++++++++++ > fs/nfsd/nfs3xdr.c | 5 ++++- > fs/nfsd/nfsfh.c | 14 ++++++++++++++ > fs/nfsd/nfsfh.h | 5 ++++- > include/linux/exportfs.h | 2 ++ > 5 files changed, 51 insertions(+), 2 deletions(-) > >diff --git a/Documentation/filesystems/nfs/Exporting >b/Documentation/filesystems/nfs/Exporting >index 520a4becb75c..fa636cde3907 100644 >--- a/Documentation/filesystems/nfs/Exporting >+++ b/Documentation/filesystems/nfs/Exporting >@@ -138,6 +138,11 @@ struct which has the following members: > to find potential names, and matches inode numbers to find the >correct > match. > >+ flags >+ Some filesystems may need to be handled differently than others. The >+ export_operations struct also includes a flags field that allows the >+ filesystem to communicate such information to nfsd. See the Export >+ Operations Flags section below for more explanation. > > A filehandle fragment consists of an array of 1 or more 4byte words, > together with a one byte "type". >@@ -147,3 +152,25 @@ generated by encode_fh, in which case it will have >been padded with > nuls. Rather, the encode_fh routine should choose a "type" which > indicates the decode_fh how much of the filehandle is valid, and how > it should be interpreted. >+ >+Export Operations Flags >+----------------------- >+In addition to the operation vector pointers, struct export_operations >also >+contains a "flags" field that allows the filesystem to communicate to >nfsd >+that it may want to do things differently when dealing with it. The >+following flags are defined: >+ >+ EXPORT_OP_NOWCC >+ RFC 1813 recommends that servers always send weak cache consistency >+ (WCC) data to the client after each operation. The server should >+ atomically collect attributes about the inode, do an operation on it, >+ and then collect the attributes afterward. This allows the client to >+ skip issuing GETATTRs in some situations but means that the server >+ is calling vfs_getattr for almost all RPCs. On some filesystems >+ (particularly those that are clustered or networked) this is >expensive >+ and atomicity is difficult to guarantee. This flag indicates to nfsd >+ that it should skip providing WCC attributes to the client in NFSv3 >+ replies when doing operations on this filesystem. Consider enabling >+ this on filesystems that have an expensive ->getattr inode operation, >+ or when atomicity between pre and post operation attribute collection >+ is impossible to guarantee. >diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c >index 01dcd494f781..c30c8c604e2a 100644 >--- a/fs/nfsd/nfs3xdr.c >+++ b/fs/nfsd/nfs3xdr.c >@@ -203,7 +203,7 @@ static __be32 * > encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh >*fhp) > { > struct dentry *dentry = fhp->fh_dentry; >- if (dentry && d_really_is_positive(dentry)) { >+ if (!fhp->fh_no_wcc && dentry && d_really_is_positive(dentry)) { > __be32 err; > struct kstat stat; > >@@ -256,6 +256,9 @@ void fill_post_wcc(struct svc_fh *fhp) > { > __be32 err; > >+ if (fhp->fh_no_wcc) >+ return; >+ > if (fhp->fh_post_saved) > printk("nfsd: inode locked twice during operation.\n"); > >diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c >index 350041a40fe5..29ae37f62b9b 100644 >--- a/fs/nfsd/nfsfh.c >+++ b/fs/nfsd/nfsfh.c >@@ -267,6 +267,16 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst >*rqstp, struct svc_fh *fhp) > > fhp->fh_dentry = dentry; > fhp->fh_export = exp; >+ >+ switch (rqstp->rq_vers) { >+ case 3: >+ if (!(dentry->d_sb->s_export_op->flags & EXPORT_OP_NOWCC)) >+ break; >+ /* Fallthrough */ >+ case 2: >+ fhp->fh_no_wcc = true; >+ } >+ > return 0; > out: > exp_put(exp); >@@ -535,6 +545,9 @@ fh_compose(struct svc_fh *fhp, struct svc_export >*exp, struct dentry *dentry, > */ > set_version_and_fsid_type(fhp, exp, ref_fh); > >+ /* If we have a ref_fh, then copy the fh_no_wcc setting from it. >*/ >+ fhp->fh_no_wcc = ref_fh ? ref_fh->fh_no_wcc : false; >+ > if (ref_fh == fhp) > fh_put(ref_fh); > >@@ -641,6 +654,7 @@ fh_put(struct svc_fh *fhp) > exp_put(exp); > fhp->fh_export = NULL; > } >+ fhp->fh_no_wcc = false; > return; > } > >diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h >index 1e90dad4926b..9ddead4d98f8 100644 >--- a/fs/nfsd/nfsfh.h >+++ b/fs/nfsd/nfsfh.h >@@ -32,6 +32,7 @@ typedef struct svc_fh { > > unsigned char fh_locked; /* inode locked by us */ > unsigned char fh_want_write; /* remount protection >taken */ >+ bool fh_no_wcc; /* no wcc data needed */ > > #ifdef CONFIG_NFSD_V3 > unsigned char fh_post_saved; /* post-op attrs saved */ >@@ -51,7 +52,6 @@ typedef struct svc_fh { > struct kstat fh_post_attr; /* full attrs after >operation */ > u64 fh_post_change; /* nfsv4 change; see >above */ > #endif /* CONFIG_NFSD_V3 */ >- > } svc_fh; > > enum nfsd_fsid { >@@ -225,6 +225,9 @@ fill_pre_wcc(struct svc_fh *fhp) > { > struct inode *inode; > >+ if (fhp->fh_no_wcc) >+ return; >+ > inode = d_inode(fhp->fh_dentry); > if (!fhp->fh_pre_saved) { > fhp->fh_pre_mtime = inode->i_mtime; >diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h >index fa05e04c5531..600c3fccc999 100644 >--- a/include/linux/exportfs.h >+++ b/include/linux/exportfs.h >@@ -214,6 +214,8 @@ struct export_operations { > bool write, u32 *device_generation); > int (*commit_blocks)(struct inode *inode, struct iomap *iomaps, > int nr_iomaps, struct iattr *iattr); >+#define EXPORT_OP_NOWCC (0x1) /* Don't collect wcc data >for NFSv3 replies */ >+ unsigned long flags; > }; > > extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, >-- >2.4.3 > >_______________________________________________ >HPDD-discuss mailing list >HPDD-discuss at lists.01.org >https://lists.01.org/mailman/listinfo/hpdd-discuss >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From bevans at cray.com Tue Sep 15 15:04:29 2015 From: bevans at cray.com (Ben Evans) Date: Tue, 15 Sep 2015 15:04:29 +0000 Subject: [lustre-devel] adding IOCTL for ping Message-ID: Would there be any interest in adding an IOCTL to update the ping time/status for a particular NID? This should allow for implementation of a pinger in userspace which updates the kernel on the status of various NIDs, and if I understand the ping code well enough, would greatly curtail any pings that is sent by the kernel. This might allow for things like Eric’s gossip implementation to simply bolt on top of Lustre without any internal kernel changes, or for integration of external monitoring systems to tell Lustre that failovers have occurred, etc. -Ben Evans -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Tue Sep 15 20:37:26 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Tue, 15 Sep 2015 13:37:26 -0700 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: Message-ID: <55F88186.50803@llnl.gov> Maybe there is just not enough detail in the proposal, but I am not seeing why associating this with NIDs is the right way to go. I believe that the RAS work that would use the gossip protocol dealt, at least in part, with higher level concepts like targets. The existing ptlrpc pinger pings targets, not NIDs. That is one of the problematic design points of the existing system, that when N OSTs live on the same node clients need to send N pings to the same node. Chris On 09/15/2015 08:04 AM, Ben Evans wrote: > Would there be any interest in adding an IOCTL to update the ping > time/status for a particular NID? > > This should allow for implementation of a pinger in userspace which > updates the kernel on the status of various NIDs, and if I understand > the ping code well enough, would greatly curtail any pings that is sent > by the kernel. > > This might allow for things like Eric’s gossip implementation to simply > bolt on top of Lustre without any internal kernel changes, or for > integration of external monitoring systems to tell Lustre that failovers > have occurred, etc. > > -Ben Evans > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From bevans at cray.com Tue Sep 15 20:53:01 2015 From: bevans at cray.com (Ben Evans) Date: Tue, 15 Sep 2015 20:53:01 +0000 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: <55F88186.50803@llnl.gov> References: <55F88186.50803@llnl.gov> Message-ID: You¹re correct, targets and client Ids would probably be better. I was simply thinking that it would be a relatively straightforward piece of code to write that could add some good flexibility into Lustre. Combine it with an "X is dead, evict it² IOCTL and you could probably do quite a bit of good, especially if you¹ve got a management system that is also monitoring aliveness, locations of targets, etc. -Ben Evans On 9/15/15, 4:37 PM, "lustre-devel on behalf of Christopher J. Morrone" wrote: >Maybe there is just not enough detail in the proposal, but I am not >seeing why associating this with NIDs is the right way to go. I believe >that the RAS work that would use the gossip protocol dealt, at least in >part, with higher level concepts like targets. The existing ptlrpc >pinger pings targets, not NIDs. That is one of the problematic design >points of the existing system, that when N OSTs live on the same node >clients need to send N pings to the same node. > >Chris > >On 09/15/2015 08:04 AM, Ben Evans wrote: >> Would there be any interest in adding an IOCTL to update the ping >> time/status for a particular NID? >> >> This should allow for implementation of a pinger in userspace which >> updates the kernel on the status of various NIDs, and if I understand >> the ping code well enough, would greatly curtail any pings that is sent >> by the kernel. >> >> This might allow for things like Eric¹s gossip implementation to simply >> bolt on top of Lustre without any internal kernel changes, or for >> integration of external monitoring systems to tell Lustre that failovers >> have occurred, etc. >> >> -Ben Evans >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From paf at cray.com Tue Sep 15 21:12:56 2015 From: paf at cray.com (Patrick Farrell) Date: Tue, 15 Sep 2015 21:12:56 +0000 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: <55F88186.50803@llnl.gov>, Message-ID: Hmmm. What about a proc interface instead? This feels - to me - better suited to that, since it's a control that isn't part of the I/O path in any way. ________________________________________ From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Ben Evans [bevans at cray.com] Sent: Tuesday, September 15, 2015 3:53 PM To: Christopher J. Morrone; lustre-devel at lists.lustre.org Subject: Re: [lustre-devel] adding IOCTL for ping You¹re correct, targets and client Ids would probably be better. I was simply thinking that it would be a relatively straightforward piece of code to write that could add some good flexibility into Lustre. Combine it with an "X is dead, evict it² IOCTL and you could probably do quite a bit of good, especially if you¹ve got a management system that is also monitoring aliveness, locations of targets, etc. -Ben Evans On 9/15/15, 4:37 PM, "lustre-devel on behalf of Christopher J. Morrone" wrote: >Maybe there is just not enough detail in the proposal, but I am not >seeing why associating this with NIDs is the right way to go. I believe >that the RAS work that would use the gossip protocol dealt, at least in >part, with higher level concepts like targets. The existing ptlrpc >pinger pings targets, not NIDs. That is one of the problematic design >points of the existing system, that when N OSTs live on the same node >clients need to send N pings to the same node. > >Chris > >On 09/15/2015 08:04 AM, Ben Evans wrote: >> Would there be any interest in adding an IOCTL to update the ping >> time/status for a particular NID? >> >> This should allow for implementation of a pinger in userspace which >> updates the kernel on the status of various NIDs, and if I understand >> the ping code well enough, would greatly curtail any pings that is sent >> by the kernel. >> >> This might allow for things like Eric¹s gossip implementation to simply >> bolt on top of Lustre without any internal kernel changes, or for >> integration of external monitoring systems to tell Lustre that failovers >> have occurred, etc. >> >> -Ben Evans >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From bevans at cray.com Wed Sep 16 13:10:18 2015 From: bevans at cray.com (Ben Evans) Date: Wed, 16 Sep 2015 13:10:18 +0000 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: <55F88186.50803@llnl.gov> Message-ID: My understanding is that adding new proc interfaces is discouraged by upstream linux. -Ben On 9/15/15, 5:12 PM, "Patrick Farrell" wrote: >Hmmm. What about a proc interface instead? This feels - to me - better >suited to that, since it's a control that isn't part of the I/O path in >any way. >________________________________________ >From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of >Ben Evans [bevans at cray.com] >Sent: Tuesday, September 15, 2015 3:53 PM >To: Christopher J. Morrone; lustre-devel at lists.lustre.org >Subject: Re: [lustre-devel] adding IOCTL for ping > >You¹re correct, targets and client Ids would probably be better. I was >simply thinking that it would be a relatively straightforward piece of >code to write that could add some good flexibility into Lustre. Combine >it with an "X is dead, evict it² IOCTL and you could probably do quite a >bit of good, especially if you¹ve got a management system that is also >monitoring aliveness, locations of targets, etc. > >-Ben Evans > >On 9/15/15, 4:37 PM, "lustre-devel on behalf of Christopher J. Morrone" > >wrote: > >>Maybe there is just not enough detail in the proposal, but I am not >>seeing why associating this with NIDs is the right way to go. I believe >>that the RAS work that would use the gossip protocol dealt, at least in >>part, with higher level concepts like targets. The existing ptlrpc >>pinger pings targets, not NIDs. That is one of the problematic design >>points of the existing system, that when N OSTs live on the same node >>clients need to send N pings to the same node. >> >>Chris >> >>On 09/15/2015 08:04 AM, Ben Evans wrote: >>> Would there be any interest in adding an IOCTL to update the ping >>> time/status for a particular NID? >>> >>> This should allow for implementation of a pinger in userspace which >>> updates the kernel on the status of various NIDs, and if I understand >>> the ping code well enough, would greatly curtail any pings that is sent >>> by the kernel. >>> >>> This might allow for things like Eric¹s gossip implementation to simply >>> bolt on top of Lustre without any internal kernel changes, or for >>> integration of external monitoring systems to tell Lustre that >>>failovers >>> have occurred, etc. >>> >>> -Ben Evans >>> >>> >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>> >> >>_______________________________________________ >>lustre-devel mailing list >>lustre-devel at lists.lustre.org >>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From simmonsja at ornl.gov Wed Sep 16 15:16:49 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 16 Sep 2015 15:16:49 +0000 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: <55F88186.50803@llnl.gov> Message-ID: >My understanding is that adding new proc interfaces is discouraged by >upstream linux. Please no new ioctls. On 9/15/15, 5:12 PM, "Patrick Farrell" wrote: >Hmmm. What about a proc interface instead? This feels - to me - better >suited to that, since it's a control that isn't part of the I/O path in >any way. >________________________________________ >From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of >Ben Evans [bevans at cray.com] >Sent: Tuesday, September 15, 2015 3:53 PM >To: Christopher J. Morrone; lustre-devel at lists.lustre.org >Subject: Re: [lustre-devel] adding IOCTL for ping > >You¹re correct, targets and client Ids would probably be better. I was >simply thinking that it would be a relatively straightforward piece of >code to write that could add some good flexibility into Lustre. Combine >it with an "X is dead, evict it² IOCTL and you could probably do quite a >bit of good, especially if you¹ve got a management system that is also >monitoring aliveness, locations of targets, etc. > >-Ben Evans > >On 9/15/15, 4:37 PM, "lustre-devel on behalf of Christopher J. Morrone" > >wrote: > >>Maybe there is just not enough detail in the proposal, but I am not >>seeing why associating this with NIDs is the right way to go. I believe >>that the RAS work that would use the gossip protocol dealt, at least in >>part, with higher level concepts like targets. The existing ptlrpc >>pinger pings targets, not NIDs. That is one of the problematic design >>points of the existing system, that when N OSTs live on the same node >>clients need to send N pings to the same node. >> >>Chris >> >>On 09/15/2015 08:04 AM, Ben Evans wrote: >>> Would there be any interest in adding an IOCTL to update the ping >>> time/status for a particular NID? >>> >>> This should allow for implementation of a pinger in userspace which >>> updates the kernel on the status of various NIDs, and if I understand >>> the ping code well enough, would greatly curtail any pings that is sent >>> by the kernel. >>> >>> This might allow for things like Eric¹s gossip implementation to simply >>> bolt on top of Lustre without any internal kernel changes, or for >>> integration of external monitoring systems to tell Lustre that >>>failovers >>> have occurred, etc. >>> >>> -Ben Evans >>> >>> >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>> >> >>_______________________________________________ >>lustre-devel mailing list >>lustre-devel at lists.lustre.org >>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From paf at cray.com Wed Sep 16 15:24:03 2015 From: paf at cray.com (Patrick Farrell) Date: Wed, 16 Sep 2015 15:24:03 +0000 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: <55F88186.50803@llnl.gov> , Message-ID: A further thought: wouldn't an ioctl be unusable on servers? ________________________________________ From: Simmons, James A. [simmonsja at ornl.gov] Sent: Wednesday, September 16, 2015 10:16 AM To: Ben Evans; Patrick Farrell; Christopher J. Morrone; lustre-devel at lists.lustre.org Subject: RE: [lustre-devel] adding IOCTL for ping >My understanding is that adding new proc interfaces is discouraged by >upstream linux. Please no new ioctls. On 9/15/15, 5:12 PM, "Patrick Farrell" wrote: >Hmmm. What about a proc interface instead? This feels - to me - better >suited to that, since it's a control that isn't part of the I/O path in >any way. >________________________________________ >From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of >Ben Evans [bevans at cray.com] >Sent: Tuesday, September 15, 2015 3:53 PM >To: Christopher J. Morrone; lustre-devel at lists.lustre.org >Subject: Re: [lustre-devel] adding IOCTL for ping > >You¹re correct, targets and client Ids would probably be better. I was >simply thinking that it would be a relatively straightforward piece of >code to write that could add some good flexibility into Lustre. Combine >it with an "X is dead, evict it² IOCTL and you could probably do quite a >bit of good, especially if you¹ve got a management system that is also >monitoring aliveness, locations of targets, etc. > >-Ben Evans > >On 9/15/15, 4:37 PM, "lustre-devel on behalf of Christopher J. Morrone" > >wrote: > >>Maybe there is just not enough detail in the proposal, but I am not >>seeing why associating this with NIDs is the right way to go. I believe >>that the RAS work that would use the gossip protocol dealt, at least in >>part, with higher level concepts like targets. The existing ptlrpc >>pinger pings targets, not NIDs. That is one of the problematic design >>points of the existing system, that when N OSTs live on the same node >>clients need to send N pings to the same node. >> >>Chris >> >>On 09/15/2015 08:04 AM, Ben Evans wrote: >>> Would there be any interest in adding an IOCTL to update the ping >>> time/status for a particular NID? >>> >>> This should allow for implementation of a pinger in userspace which >>> updates the kernel on the status of various NIDs, and if I understand >>> the ping code well enough, would greatly curtail any pings that is sent >>> by the kernel. >>> >>> This might allow for things like Eric¹s gossip implementation to simply >>> bolt on top of Lustre without any internal kernel changes, or for >>> integration of external monitoring systems to tell Lustre that >>>failovers >>> have occurred, etc. >>> >>> -Ben Evans >>> >>> >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>> >> >>_______________________________________________ >>lustre-devel mailing list >>lustre-devel at lists.lustre.org >>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From olaf at sgi.com Wed Sep 16 16:14:13 2015 From: olaf at sgi.com (Olaf Weber) Date: Wed, 16 Sep 2015 18:14:13 +0200 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: <55F88186.50803@llnl.gov> Message-ID: <55F99555.4020900@sgi.com> On 16-09-15 17:24, Patrick Farrell wrote: > A further thought: wouldn't an ioctl be unusable on servers? Presumably it would use the /dev/lnet device file, like the other ioctls in libcfs/include/libcfs/libcfs_ioctl.h. Olaf > ________________________________________ > From: Simmons, James A. [simmonsja at ornl.gov] > Sent: Wednesday, September 16, 2015 10:16 AM > To: Ben Evans; Patrick Farrell; Christopher J. Morrone; lustre-devel at lists.lustre.org > Subject: RE: [lustre-devel] adding IOCTL for ping > >> My understanding is that adding new proc interfaces is discouraged by >> upstream linux. > > Please no new ioctls. > > On 9/15/15, 5:12 PM, "Patrick Farrell" wrote: > >> Hmmm. What about a proc interface instead? This feels - to me - better >> suited to that, since it's a control that isn't part of the I/O path in >> any way. >> ________________________________________ >> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of >> Ben Evans [bevans at cray.com] >> Sent: Tuesday, September 15, 2015 3:53 PM >> To: Christopher J. Morrone; lustre-devel at lists.lustre.org >> Subject: Re: [lustre-devel] adding IOCTL for ping >> >> You¹re correct, targets and client Ids would probably be better. I was >> simply thinking that it would be a relatively straightforward piece of >> code to write that could add some good flexibility into Lustre. Combine >> it with an "X is dead, evict it² IOCTL and you could probably do quite a >> bit of good, especially if you¹ve got a management system that is also >> monitoring aliveness, locations of targets, etc. >> >> -Ben Evans >> >> On 9/15/15, 4:37 PM, "lustre-devel on behalf of Christopher J. Morrone" >> >> wrote: >> >>> Maybe there is just not enough detail in the proposal, but I am not >>> seeing why associating this with NIDs is the right way to go. I believe >>> that the RAS work that would use the gossip protocol dealt, at least in >>> part, with higher level concepts like targets. The existing ptlrpc >>> pinger pings targets, not NIDs. That is one of the problematic design >>> points of the existing system, that when N OSTs live on the same node >>> clients need to send N pings to the same node. >>> >>> Chris >>> >>> On 09/15/2015 08:04 AM, Ben Evans wrote: >>>> Would there be any interest in adding an IOCTL to update the ping >>>> time/status for a particular NID? >>>> >>>> This should allow for implementation of a pinger in userspace which >>>> updates the kernel on the status of various NIDs, and if I understand >>>> the ping code well enough, would greatly curtail any pings that is sent >>>> by the kernel. >>>> >>>> This might allow for things like Eric¹s gossip implementation to simply >>>> bolt on top of Lustre without any internal kernel changes, or for >>>> integration of external monitoring systems to tell Lustre that >>>> failovers >>>> have occurred, etc. >>>> >>>> -Ben Evans >>>> >>>> >>>> _______________________________________________ >>>> lustre-devel mailing list >>>> lustre-devel at lists.lustre.org >>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>> >>> >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > -- Olaf Weber SGI Phone: +31(0)30-6696796 Veldzigt 2b Fax: +31(0)30-6696799 Sr Software Engineer 3454 PW de Meern Vnet: 955-6796 Storage Software The Netherlands Email: olaf at sgi.com From s894330 at hotmail.com Mon Sep 21 06:58:09 2015 From: s894330 at hotmail.com (Ting-Chih Hsiao) Date: Mon, 21 Sep 2015 14:58:09 +0800 Subject: [lustre-devel] [PATCH] staging: lustre-mgc: make mgc_obd_ops static Message-ID: Fix sparse warnings of the following type: warning: symbol '....' was not declared. Should it be static? Signed-off-by: Ting-Chih Hsiao --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 9e36642..3e9cca0 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1692,7 +1692,7 @@ out: return rc; } -struct obd_ops mgc_obd_ops = { +static struct obd_ops mgc_obd_ops = { .o_owner = THIS_MODULE, .o_setup = mgc_setup, .o_precleanup = mgc_precleanup, -- 1.9.1 From andreas.dilger at intel.com Mon Sep 21 09:41:23 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Mon, 21 Sep 2015 09:41:23 +0000 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: Message-ID: Maybe I'm missing something here, but why not disable pinging altogether at this point and depend on the external health network? That is already possible today via https://jira.hpdd.intel.com/browse/LU-2467. Cheers, Andreas On Sep 15, 2015, at 17:05, Ben Evans > wrote: Would there be any interest in adding an IOCTL to update the ping time/status for a particular NID? This should allow for implementation of a pinger in userspace which updates the kernel on the status of various NIDs, and if I understand the ping code well enough, would greatly curtail any pings that is sent by the kernel. This might allow for things like Eric’s gossip implementation to simply bolt on top of Lustre without any internal kernel changes, or for integration of external monitoring systems to tell Lustre that failovers have occurred, etc. -Ben Evans _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From bevans at cray.com Mon Sep 21 14:31:30 2015 From: bevans at cray.com (Ben Evans) Date: Mon, 21 Sep 2015 14:31:30 +0000 Subject: [lustre-devel] adding IOCTL for ping In-Reply-To: References: Message-ID: Nope, looks like I was missing something, I wasn¹t terribly familiar with pingless clients and the external health networks. Reading up on those now. -Ben On 9/21/15, 5:41 AM, "Dilger, Andreas" wrote: >Maybe I'm missing something here, but why not disable pinging altogether >at this point and depend on the external health network? That is already >possible today via https://jira.hpdd.intel.com/browse/LU-2467. > >Cheers, Andreas > >On Sep 15, 2015, at 17:05, Ben Evans >> wrote: > >Would there be any interest in adding an IOCTL to update the ping >time/status for a particular NID? > >This should allow for implementation of a pinger in userspace which >updates the kernel on the status of various NIDs, and if I understand the >ping code well enough, would greatly curtail any pings that is sent by >the kernel. > >This might allow for things like Eric¹s gossip implementation to simply >bolt on top of Lustre without any internal kernel changes, or for >integration of external monitoring systems to tell Lustre that failovers >have occurred, etc. > >-Ben Evans >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From oleg.drokin at intel.com Tue Sep 22 02:54:35 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Tue, 22 Sep 2015 02:54:35 +0000 Subject: [lustre-devel] New master tag 2.7.60 Message-ID: <0118D85E-7CAD-4EBB-86F9-AAF35B15D24B@intel.com> Hello! master branch of the Lustre community tree has just been tagged as 2.7.60 Bye, Oleg From anton.gerasimov at openmailbox.org Tue Sep 22 21:35:13 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 00:35:13 +0300 Subject: [lustre-devel] [PATCH 0/3] staging: lustre: fix (non-)static symbols issues Message-ID: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> This series of patches eliminates some sparse warnings concerning static variables in lustre rtlrpc module where it seemed reasonable. Symbols that are really local to a source file are made static and declarations added to a header for symbols that are shared between source files. Anton Gerasimov (3): staging: lustre: add shared variables to the header staging: lustre: include header with local ptlrpc declarations staging: lustre: make non-exported functions static drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++++++ drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) -- 2.5.1 From anton.gerasimov at openmailbox.org Tue Sep 22 21:40:43 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 00:40:43 +0300 Subject: [lustre-devel] [PATCH 1/3] staging: lustre: add shared variables to the header In-Reply-To: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> References: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> Message-ID: <1442958043-15015-1-git-send-email-anton.gerasimov@openmailbox.org> This patch adds declarations for variables used in several files across the ptlrpc module to the local header. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 34c7e28..4e35b14 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -47,6 +47,10 @@ struct ldlm_res_id; struct ptlrpc_request_set; extern int test_req_buffer_pressure; extern struct mutex ptlrpc_all_services_mutex; +extern struct list_head ptlrpc_all_services; + +extern struct mutex ptlrpcd_mutex; +extern struct mutex pinger_mutex; int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait); /* ptlrpcd.c */ @@ -110,6 +114,8 @@ struct nrs_core { }; +extern struct nrs_core nrs_core; + int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc); void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc); -- 2.5.1 From anton.gerasimov at openmailbox.org Tue Sep 22 21:41:26 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 00:41:26 +0300 Subject: [lustre-devel] [PATCH 2/3] staging: lustre: include header with local ptlrpc declarations In-Reply-To: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> References: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> Message-ID: <1442958086-15072-1-git-send-email-anton.gerasimov@openmailbox.org> Include the header with declaations of variables that are shared between several sources in ptlrpc module into the appropriate source files. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c index ce1c563d..0f3c693 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c @@ -47,6 +47,8 @@ #include "../include/lustre_net.h" #include "../include/lustre_sec.h" +#include "ptlrpc_internal.h" + static struct ptlrpc_sec_policy null_policy; static struct ptlrpc_sec null_sec; static struct ptlrpc_cli_ctx null_cli_ctx; diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index b2313af..40f720c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -43,6 +43,8 @@ #include "../include/obd_class.h" #include "../include/lustre_net.h" #include "../include/lustre_disk.h" +#include "ptlrpc_internal.h" + void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' -- 2.5.1 From anton.gerasimov at openmailbox.org Tue Sep 22 21:41:51 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 00:41:51 +0300 Subject: [lustre-devel] [PATCH 3/3] staging: lustre: make non-exported functions static In-Reply-To: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> References: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> Message-ID: <1442958111-15122-1-git-send-email-anton.gerasimov@openmailbox.org> Declare non-exported functions in pack_generic.c as static. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index f138061..dd31215 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -442,8 +442,8 @@ void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size) } EXPORT_SYMBOL(lustre_msg_buf); -int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment, - unsigned int newlen, int move_data) +static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment, + unsigned int newlen, int move_data) { char *tail = NULL, *newpos; int tail_len = 0, n; @@ -1929,7 +1929,7 @@ void lustre_swab_fid2path(struct getinfo_fid2path *gf) } EXPORT_SYMBOL(lustre_swab_fid2path); -void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent) +static void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent) { __swab64s(&fm_extent->fe_logical); __swab64s(&fm_extent->fe_physical); @@ -2405,7 +2405,7 @@ void lustre_swab_hsm_state_set(struct hsm_state_set *hss) } EXPORT_SYMBOL(lustre_swab_hsm_state_set); -void lustre_swab_hsm_extent(struct hsm_extent *extent) +static void lustre_swab_hsm_extent(struct hsm_extent *extent) { __swab64s(&extent->offset); __swab64s(&extent->length); -- 2.5.1 From anton.gerasimov at openmailbox.org Tue Sep 22 22:21:40 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 01:21:40 +0300 Subject: [lustre-devel] [PATCH 0/3] staging: lustre: fix (non-)static symbols issues Message-ID: <20150922222134.GA2749@linux-0hv4.site> This series of patches eliminates some sparse warnings concerning static variables in lustre rtlrpc module where it seemed reasonable. Symbols that are really local to a source file are made static and declarations added to a header for symbols that are shared between source files. Anton Gerasimov (3): staging: lustre: add shared variables to the header staging: lustre: include header with local ptlrpc declarations staging: lustre: make non-exported functions static drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++++++ drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) -- 2.5.1 From anton.gerasimov at openmailbox.org Tue Sep 22 22:24:21 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 01:24:21 +0300 Subject: [lustre-devel] [PATCH 1/3] staging: lustre: add shared variables to the header Message-ID: <20150922222414.GA2777@linux-0hv4.site> This patch adds declarations for variables used in several files across the ptlrpc module to the local header. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 34c7e28..4e35b14 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -47,6 +47,10 @@ struct ldlm_res_id; struct ptlrpc_request_set; extern int test_req_buffer_pressure; extern struct mutex ptlrpc_all_services_mutex; +extern struct list_head ptlrpc_all_services; + +extern struct mutex ptlrpcd_mutex; +extern struct mutex pinger_mutex; int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait); /* ptlrpcd.c */ @@ -110,6 +114,8 @@ struct nrs_core { }; +extern struct nrs_core nrs_core; + int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc); void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc); -- 2.5.1 From anton.gerasimov at openmailbox.org Tue Sep 22 22:28:27 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 01:28:27 +0300 Subject: [lustre-devel] [PATCH 2/3] staging: lustre: include header with local ptlrpc declarations Message-ID: <20150922222822.GA2851@linux-0hv4.site> Include the header with declaations of variables that are shared between several sources in ptlrpc module into the appropriate source files. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c index ce1c563d..0f3c693 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c @@ -47,6 +47,8 @@ #include "../include/lustre_net.h" #include "../include/lustre_sec.h" +#include "ptlrpc_internal.h" + static struct ptlrpc_sec_policy null_policy; static struct ptlrpc_sec null_sec; static struct ptlrpc_cli_ctx null_cli_ctx; diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index b2313af..40f720c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -43,6 +43,8 @@ #include "../include/obd_class.h" #include "../include/lustre_net.h" #include "../include/lustre_disk.h" +#include "ptlrpc_internal.h" + void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' -- 2.5.1 From anton.gerasimov at openmailbox.org Tue Sep 22 22:29:29 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Wed, 23 Sep 2015 01:29:29 +0300 Subject: [lustre-devel] [PATCH 3/3] staging: lustre: make non-exported functions static Message-ID: <20150922222924.GA2913@linux-0hv4.site> Declare non-exported functions in pack_generic.c as static. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index f138061..dd31215 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -442,8 +442,8 @@ void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size) } EXPORT_SYMBOL(lustre_msg_buf); -int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment, - unsigned int newlen, int move_data) +static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment, + unsigned int newlen, int move_data) { char *tail = NULL, *newpos; int tail_len = 0, n; @@ -1929,7 +1929,7 @@ void lustre_swab_fid2path(struct getinfo_fid2path *gf) } EXPORT_SYMBOL(lustre_swab_fid2path); -void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent) +static void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent) { __swab64s(&fm_extent->fe_logical); __swab64s(&fm_extent->fe_physical); @@ -2405,7 +2405,7 @@ void lustre_swab_hsm_state_set(struct hsm_state_set *hss) } EXPORT_SYMBOL(lustre_swab_hsm_state_set); -void lustre_swab_hsm_extent(struct hsm_extent *extent) +static void lustre_swab_hsm_extent(struct hsm_extent *extent) { __swab64s(&extent->offset); __swab64s(&extent->length); -- 2.5.1 From andreas.dilger at intel.com Wed Sep 23 13:13:45 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 23 Sep 2015 13:13:45 +0000 Subject: [lustre-devel] [PATCH 1/3] staging: lustre: add shared variables to the header In-Reply-To: <1442958043-15015-1-git-send-email-anton.gerasimov@openmailbox.org> References: <1442957713-14727-1-git-send-email-anton.gerasimov@openmailbox.org> <1442958043-15015-1-git-send-email-anton.gerasimov@openmailbox.org> Message-ID: On 2015/09/22, 11:40 PM, "Anton Gerasimov" wrote: >This patch adds declarations for variables used in several files >across the ptlrpc module to the local header. > >Signed-off-by: Anton Gerasimov >--- > drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++++++ > 1 file changed, 6 insertions(+) > >diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h >b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h >index 34c7e28..4e35b14 100644 >--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h >+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h >@@ -47,6 +47,10 @@ struct ldlm_res_id; > struct ptlrpc_request_set; > extern int test_req_buffer_pressure; > extern struct mutex ptlrpc_all_services_mutex; >+extern struct list_head ptlrpc_all_services; >+ >+extern struct mutex ptlrpcd_mutex; >+extern struct mutex pinger_mutex; Your patch adds these declarations to ptlrpc_internal.h but it doesn't remove the corresponding "extern" declaration lines from the .c files. Could you please remove these (now redundant) lines and resubmit the patch. Cheers, Andreas > > int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait); > /* ptlrpcd.c */ >@@ -110,6 +114,8 @@ struct nrs_core { > > }; > >+extern struct nrs_core nrs_core; >+ > int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc); > void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc); > >-- >2.5.1 > > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From anton.gerasimov at openmailbox.org Wed Sep 23 21:00:15 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Thu, 24 Sep 2015 00:00:15 +0300 Subject: [lustre-devel] [PATCHv2 0/3] staging: lustre: fix (non-)static symbols issues Message-ID: <20150923205945.GA5335@linux-0hv4.site> This series of patches eliminates some sparse warnings concerning static variables in lustre rtlrpc module where it seemed reasonable. Symbols that are really local to a source file are made static and declarations added to a header for symbols that are shared between source files. v2: Thank Andreas Dilger for the review. Anton Gerasimov (3): staging: lustre: moved extern declarations to a header staging: lustre: include header with local ptlrpc declarations staging: lustre: make non-exported functions static drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 - drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++++++ drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 2 -- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 7 files changed, 14 insertions(+), 8 deletions(-) -- 2.5.1 From anton.gerasimov at openmailbox.org Wed Sep 23 21:02:28 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Thu, 24 Sep 2015 00:02:28 +0300 Subject: [lustre-devel] [PATCHv2 1/3] staging: lustre: moved extern declarations to a header Message-ID: <20150923210146.GA5375@linux-0hv4.site> This patch moves declarations of variables used in several files across the ptlrpc module from source files to a local header. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 - drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++++++ drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 2 -- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 9a10baf..2b88aef 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -420,7 +420,6 @@ LUSTRE_RW_ATTR(threads_max); * \addtogoup nrs * @{ */ -extern struct nrs_core nrs_core; /** * Translates \e ptlrpc_nrs_pol_state values to human-readable strings. diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index d37cdd5..40696f3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -49,7 +49,6 @@ /* XXX: This is just for liblustre. Remove the #if defined directive when the * "cfs_" prefix is dropped from cfs_list_head. */ -extern struct list_head ptlrpc_all_services; /** * NRS core object. diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 34c7e28..4e35b14 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -47,6 +47,10 @@ struct ldlm_res_id; struct ptlrpc_request_set; extern int test_req_buffer_pressure; extern struct mutex ptlrpc_all_services_mutex; +extern struct list_head ptlrpc_all_services; + +extern struct mutex ptlrpcd_mutex; +extern struct mutex pinger_mutex; int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait); /* ptlrpcd.c */ @@ -110,6 +114,8 @@ struct nrs_core { }; +extern struct nrs_core nrs_core; + int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc); void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c index 9985fb6..d12e95b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c @@ -48,8 +48,6 @@ extern spinlock_t ptlrpc_last_xid_lock; #if RS_DEBUG extern spinlock_t ptlrpc_rs_debug_lock; #endif -extern struct mutex pinger_mutex; -extern struct mutex ptlrpcd_mutex; static int __init ptlrpc_init(void) { -- 2.5.1 From anton.gerasimov at openmailbox.org Wed Sep 23 21:04:04 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Thu, 24 Sep 2015 00:04:04 +0300 Subject: [lustre-devel] [PATCHv2 2/3] staging: lustre: include header with local ptlrpc declarations Message-ID: <20150923210321.GA5400@linux-0hv4.site> Include the header with declarations of variables that are shared between several sources in ptlrpc module into the appropriate source files. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c index ce1c563d..0f3c693 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c @@ -47,6 +47,8 @@ #include "../include/lustre_net.h" #include "../include/lustre_sec.h" +#include "ptlrpc_internal.h" + static struct ptlrpc_sec_policy null_policy; static struct ptlrpc_sec null_sec; static struct ptlrpc_cli_ctx null_cli_ctx; diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index b2313af..40f720c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -43,6 +43,8 @@ #include "../include/obd_class.h" #include "../include/lustre_net.h" #include "../include/lustre_disk.h" +#include "ptlrpc_internal.h" + void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' -- 2.5.1 From anton.gerasimov at openmailbox.org Wed Sep 23 21:08:17 2015 From: anton.gerasimov at openmailbox.org (Anton Gerasimov) Date: Thu, 24 Sep 2015 00:08:17 +0300 Subject: [lustre-devel] [PATCHv2 3/3] staging: lustre: make non-exported functions static Message-ID: <20150923210801.GA5426@linux-0hv4.site> Declare non-exported functions as static. Signed-off-by: Anton Gerasimov --- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index f138061..dd31215 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -442,8 +442,8 @@ void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size) } EXPORT_SYMBOL(lustre_msg_buf); -int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment, - unsigned int newlen, int move_data) +static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment, + unsigned int newlen, int move_data) { char *tail = NULL, *newpos; int tail_len = 0, n; @@ -1929,7 +1929,7 @@ void lustre_swab_fid2path(struct getinfo_fid2path *gf) } EXPORT_SYMBOL(lustre_swab_fid2path); -void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent) +static void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent) { __swab64s(&fm_extent->fe_logical); __swab64s(&fm_extent->fe_physical); @@ -2405,7 +2405,7 @@ void lustre_swab_hsm_state_set(struct hsm_state_set *hss) } EXPORT_SYMBOL(lustre_swab_hsm_state_set); -void lustre_swab_hsm_extent(struct hsm_extent *extent) +static void lustre_swab_hsm_extent(struct hsm_extent *extent) { __swab64s(&extent->offset); __swab64s(&extent->length); -- 2.5.1 From oleg.drokin at intel.com Thu Sep 24 19:03:12 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Thu, 24 Sep 2015 19:03:12 +0000 Subject: [lustre-devel] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: <1956624.Zv9KJSmuQh@wuerfel> References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <3291083.GxjVIOEiUy@wuerfel> <273C9862-FEEA-450D-A384-9680B43E4686@intel.com> <1956624.Zv9KJSmuQh@wuerfel> Message-ID: <847A8CB9-E040-4149-BE38-6E284AD73D6F@intel.com> On Sep 24, 2015, at 2:54 PM, Arnd Bergmann wrote: > On Thursday 24 September 2015 16:01:40 Drokin, Oleg wrote: >> >> On Sep 24, 2015, at 11:18 AM, Arnd Bergmann wrote: >> >>> On Thursday 24 September 2015 03:55:20 Drokin, Oleg wrote: >>>> On Sep 23, 2015, at 3:13 PM, Arnd Bergmann wrote: >>>> >>>>> The last request time is stored as an 'unsigned long', which is >>>>> good enough until 2106, but it is then converted to 'long' in >>>>> some places, which overflows in 2038. >>>>> >>>>> This changes the type to time64_t to avoid those problems. >>>> >>>> Hm… >>>> All this code is actually only making sense on server and is unused otherwise, >>>> so it's probably best to drop ping_evictor_start, ping_evictor_main, exp_expired, >>>> class_disconnect_export_list (and two places where it's called from) functions >>>> and exp_last_request_time field. >>>> And with ping evictor gone, we should also drop ptlrpc_update_export_timer. >>>> >>>> While clients do retain the request handling code (to process server-originated >>>> requests like lock callbacks), they are not going to evict the servers because >>>> the server have not talked to us in a while or anything of the sort. >>> >>> I tried doing this, but could not figure out how to get rid of >>> class_disconnect_exports(). >> >> It's only called from class_cleanup like this: >> >> /* The three references that should be remaining are the >> * obd_self_export and the attach and setup references. */ >> if (atomic_read(&obd->obd_refcount) > 3) { >> /* refcount - 3 might be the number of real exports >> (excluding self export). But class_incref is called >> by other things as well, so don't count on it. */ >> CDEBUG(D_IOCTL, "%s: forcing exports to disconnect: %d\n", >> obd->obd_name, atomic_read(&obd->obd_refcount) - 3); >> dump_exports(obd, 0); >> class_disconnect_exports(obd); >> } >> >> >> This is only true on the servers so we can replace it with a corresponding LASSERT, >> I imagine. > > Ok, I see. This wasn't clear as I really know nothing about what lustre > actually does. Just for my information, can you clarify where the server > code sits? Is that a fork of the same code base running in user space, > or is there another set of kernel modules on top of the common ones that > implements the server? Lustre server (and out of tree client) live in http://git.whamcloud.com/fs/lustre-release.git/ Code in the staging tree is a snapshot from between 2.4 and 2.5 releases that undergoes cleanups in order to conform to kernel standards. It's only client too, so all server-side parts are being removed as they are identified. >>> However, I started removing dead code and ended up with a huge patch >>> that would not make it to mailing list servers and that I therefor >>> pasted on http://pastebin.com/uncZQNh7 for reference. >> >> Wow, this is a large patch indeed. >> Some parts of it I was contemplating on my own like whole dt_object.[ch] removal >> with all the ties in llog code, though it was somewhat tricky as some bits in mgc >> seems to be using that somehow. > > I first recursively removed all functions that 'nm' showed as globally defined > but never referenced from another file (except those that should be marked Ah, neat trick. >> I have not finished a detailed runthrough yet, but on the surface, why did you remove >> suppress_pings parameter 0 that is still valid on clients, to let them not ping servers. >> Also ptlrpc_ping_import_soon and friends - all that code is actually needed. >> >> Only "ping evictor" is not needed on the client as it's only servers that are going to >> kick out clients that are silent for too long. Clients are still expected to >> send their "keep alive" pings in periodically (unless suppress_pings option is enabled). >> >> Hm…. I now see it is not fully implemented, that's why you are removing it as it's really not >> called from anywhere. > > Right, I obviously cannot tell the difference between code that is not needed > on the client or that has been orphaned in a previous cleanup and code that > has just been added in order to soon be used. This code is not "soon to be used", so it's ok to kill it now and we can spring it back to life when it actually becomes useful. >> Anyway this does remove a lot of stuff that we don't really need in the client, >> I'll try to get it built and tested just to make sure it does not really break anything >> (unfortunately it does not seem to apply cleanly to the tip of staging-next tree). > Ok. I based the patches on top of my 37 patch series, and if you want I can > upload a git branch somewhere to make rebasing easier. That would be great. Though in the end likely this huge patch would need to be split into smaller chunks. Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] removal and so on. But for testing a current snapshot would be great, then I can run it through my testbed to see how it fares there. Thanks! Bye, Oleg From arnd at arndb.de Thu Sep 24 20:15:51 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Thu, 24 Sep 2015 22:15:51 +0200 Subject: [lustre-devel] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: <847A8CB9-E040-4149-BE38-6E284AD73D6F@intel.com> References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <1956624.Zv9KJSmuQh@wuerfel> <847A8CB9-E040-4149-BE38-6E284AD73D6F@intel.com> Message-ID: <3415466.Q2DxJVi5PK@wuerfel> On Thursday 24 September 2015 19:03:12 Drokin, Oleg wrote: > On Sep 24, 2015, at 2:54 PM, Arnd Bergmann wrote: > > On Thursday 24 September 2015 16:01:40 Drokin, Oleg wrote: > >> On Sep 24, 2015, at 11:18 AM, Arnd Bergmann wrote: > >>> On Thursday 24 September 2015 03:55:20 Drokin, Oleg wrote: > >>>> On Sep 23, 2015, at 3:13 PM, Arnd Bergmann wrote: > >> This is only true on the servers so we can replace it with a corresponding LASSERT, > >> I imagine. > > > > Ok, I see. This wasn't clear as I really know nothing about what lustre > > actually does. Just for my information, can you clarify where the server > > code sits? Is that a fork of the same code base running in user space, > > or is there another set of kernel modules on top of the common ones that > > implements the server? > > Lustre server (and out of tree client) live in http://git.whamcloud.com/fs/lustre-release.git/ > > Code in the staging tree is a snapshot from between 2.4 and 2.5 releases > that undergoes cleanups in order to conform to kernel standards. > It's only client too, so all server-side parts are being removed as they are identified. Ok, I see. > >> I have not finished a detailed runthrough yet, but on the surface, why did you remove > >> suppress_pings parameter 0 that is still valid on clients, to let them not ping servers. > >> Also ptlrpc_ping_import_soon and friends - all that code is actually needed. > >> > >> Only "ping evictor" is not needed on the client as it's only servers that are going to > >> kick out clients that are silent for too long. Clients are still expected to > >> send their "keep alive" pings in periodically (unless suppress_pings option is enabled). > >> > >> Hm…. I now see it is not fully implemented, that's why you are removing it as it's really not > >> called from anywhere. > > > > Right, I obviously cannot tell the difference between code that is not needed > > on the client or that has been orphaned in a previous cleanup and code that > > has just been added in order to soon be used. > > This code is not "soon to be used", so it's ok to kill it now and we can > spring it back to life when it actually becomes useful. Makes sense. > >> Anyway this does remove a lot of stuff that we don't really need in the client, > >> I'll try to get it built and tested just to make sure it does not really break anything > >> (unfortunately it does not seem to apply cleanly to the tip of staging-next tree). > > Ok. I based the patches on top of my 37 patch series, and if you want I can > > upload a git branch somewhere to make rebasing easier. > > That would be great. > Though in the end likely this huge patch would need to be split into smaller chunks. > Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] > removal and so on. > But for testing a current snapshot would be great, then I can run it through my testbed > to see how it fares there. Ok, I've pushed out the branch to git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre This contains the latest version of the y2038 series (with the warning fixed that Sudip Mukherjee found) but no other changes, and the big code removal on top. ARnd From oleg.drokin at intel.com Fri Sep 25 01:07:43 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Fri, 25 Sep 2015 01:07:43 +0000 Subject: [lustre-devel] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: <3415466.Q2DxJVi5PK@wuerfel> References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <1956624.Zv9KJSmuQh@wuerfel> <847A8CB9-E040-4149-BE38-6E284AD73D6F@intel.com> <3415466.Q2DxJVi5PK@wuerfel> Message-ID: <989D1FF5-705C-42EA-A41F-6CAD00BF53E4@intel.com> On Sep 24, 2015, at 4:15 PM, Arnd Bergmann wrote: >>>> Anyway this does remove a lot of stuff that we don't really need in the client, >>>> I'll try to get it built and tested just to make sure it does not really break anything >>>> (unfortunately it does not seem to apply cleanly to the tip of staging-next tree). >>> Ok. I based the patches on top of my 37 patch series, and if you want I can >>> upload a git branch somewhere to make rebasing easier. >> >> That would be great. >> Though in the end likely this huge patch would need to be split into smaller chunks. >> Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] >> removal and so on. >> But for testing a current snapshot would be great, then I can run it through my testbed >> to see how it fares there. > > Ok, I've pushed out the branch to > > git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre > > This contains the latest version of the y2038 series (with the warning fixed > that Sudip Mukherjee found) but no other changes, and the big code removal > on top. These do seem to be working fine in my testing. I also noticed we can remove some more stuff in at least fid/ dir so I created some patches on top of your tree: https://github.com/verygreen/linux/tree/fidcleanup Also I've looked a bit into nm and I don't see a straight way of cross referencing which globally visible functions are not really used by anything. Do you have a handy recipe for that? Thanks. Bye, Oleg From oleg.drokin at intel.com Fri Sep 25 01:39:49 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Fri, 25 Sep 2015 01:39:49 +0000 Subject: [lustre-devel] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: <989D1FF5-705C-42EA-A41F-6CAD00BF53E4@intel.com> References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <1956624.Zv9KJSmuQh@wuerfel> <847A8CB9-E040-4149-BE38-6E284AD73D6F@intel.com> <3415466.Q2DxJVi5PK@wuerfel> <989D1FF5-705C-42EA-A41F-6CAD00BF53E4@intel.com> Message-ID: <04B462D5-CB6F-4AA6-8C48-1941E31A9A2F@intel.com> On Sep 24, 2015, at 9:07 PM, Drokin, Oleg wrote: > > On Sep 24, 2015, at 4:15 PM, Arnd Bergmann wrote: >>>>> Anyway this does remove a lot of stuff that we don't really need in the client, >>>>> I'll try to get it built and tested just to make sure it does not really break anything >>>>> (unfortunately it does not seem to apply cleanly to the tip of staging-next tree). >>>> Ok. I based the patches on top of my 37 patch series, and if you want I can >>>> upload a git branch somewhere to make rebasing easier. >>> >>> That would be great. >>> Though in the end likely this huge patch would need to be split into smaller chunks. >>> Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] >>> removal and so on. >>> But for testing a current snapshot would be great, then I can run it through my testbed >>> to see how it fares there. >> >> Ok, I've pushed out the branch to >> >> git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre >> >> This contains the latest version of the y2038 series (with the warning fixed >> that Sudip Mukherjee found) but no other changes, and the big code removal >> on top. > > > These do seem to be working fine in my testing. Ah, and I should mention that just as I suspected, the debug log decoding tool is very unhappy. From arnd at arndb.de Fri Sep 25 09:50:14 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Fri, 25 Sep 2015 11:50:14 +0200 Subject: [lustre-devel] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: <989D1FF5-705C-42EA-A41F-6CAD00BF53E4@intel.com> References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <3415466.Q2DxJVi5PK@wuerfel> <989D1FF5-705C-42EA-A41F-6CAD00BF53E4@intel.com> Message-ID: <2907593.hTFjyphPBj@wuerfel> On Friday 25 September 2015 01:07:43 Drokin, Oleg wrote: > > These do seem to be working fine in my testing. > > I also noticed we can remove some more stuff in at least fid/ dir so > I created some patches on top of your tree: > https://github.com/verygreen/linux/tree/fidcleanup > > Also I've looked a bit into nm and I don't see a straight way of cross referencing > which globally visible functions are not really used by anything. > Do you have a handy recipe for that? > > I usually use ad-hoc shell commands. This time, my history has these commands: find build/tmp/drivers/staging/lustre/ -name \*.o | grep -v built-in | xargs nm | grep -w U | cut -f 11- -d\ | sort -u > refs find build/tmp/drivers/staging/lustre/lustre/obdclass/ -name \*.o | grep -v built-in | xargs nm | grep -w [A-TV-Z] | grep -v __ksymtab | grep -v __crc | cut -f 3 -d \ | sort -u > defs diff -u defs refs | grep ^- | cut -f 2 -d- | while read i ; do echo ==== $i ==== ; git grep -w $i ; done | less I'm sure this could be done in a more robust and cleaner way, and probably has been done before. If someone has a good way of doing this generically, we could add that to the scripts/ directory and get get more people to analyse the staging drivers (or their own code elsewhere) this way. Note that I only did this for symbols defined in obdclass and ptlrpc, there are plenty more in the other modules. Also, most of the findings are for symbols that should be marked 'static', because they have only users in the file that they are defined in. Doing that would lead to better code generation. Two related things I'd do when cleaning up a code base are to check all the EXPORT_SYMBOL statements and remove the ones that are not used in another module, and to check for global identifiers that are missing a proper prefix and should be renamed (e.g. dirty_cnt, dump_lsm, lock_handle_ops, our_vma, pool_hash_operations, target_send_reply, at_max, dump_exports, ...). Arnd From arnd at arndb.de Fri Sep 25 16:09:13 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Fri, 25 Sep 2015 18:09:13 +0200 Subject: [lustre-devel] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: <04B462D5-CB6F-4AA6-8C48-1941E31A9A2F@intel.com> References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <989D1FF5-705C-42EA-A41F-6CAD00BF53E4@intel.com> <04B462D5-CB6F-4AA6-8C48-1941E31A9A2F@intel.com> Message-ID: <5823166.8kAioJAUND@wuerfel> On Friday 25 September 2015 01:39:49 Drokin, Oleg wrote: > On Sep 24, 2015, at 9:07 PM, Drokin, Oleg wrote: > > > > > On Sep 24, 2015, at 4:15 PM, Arnd Bergmann wrote: > >>>>> Anyway this does remove a lot of stuff that we don't really need in the client, > >>>>> I'll try to get it built and tested just to make sure it does not really break anything > >>>>> (unfortunately it does not seem to apply cleanly to the tip of staging-next tree). > >>>> Ok. I based the patches on top of my 37 patch series, and if you want I can > >>>> upload a git branch somewhere to make rebasing easier. > >>> > >>> That would be great. > >>> Though in the end likely this huge patch would need to be split into smaller chunks. > >>> Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] > >>> removal and so on. > >>> But for testing a current snapshot would be great, then I can run it through my testbed > >>> to see how it fares there. > >> > >> Ok, I've pushed out the branch to > >> > >> git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre > >> > >> This contains the latest version of the y2038 series (with the warning fixed > >> that Sudip Mukherjee found) but no other changes, and the big code removal > >> on top. > > > > > > These do seem to be working fine in my testing. > > Ah, and I should mention that just as I suspected, the debug log decoding tool > is very unhappy. I have updated the branch now to reflect our discussions so far. Can you handle forwarding the patches to Greg from there, or complain if there are still problems with them? I still had problems with removing ptlrpc_update_export_timer(), so I left a small patch for that, which you probably want to do differently, and while I split out the nontrivial parts of the large removal patch, most of it still is in one chunk that contains purely removals of whole lines. Arnd From oleg.drokin at intel.com Fri Sep 25 16:53:14 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Fri, 25 Sep 2015 16:53:14 +0000 Subject: [lustre-devel] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: <5823166.8kAioJAUND@wuerfel> References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <989D1FF5-705C-42EA-A41F-6CAD00BF53E4@intel.com> <04B462D5-CB6F-4AA6-8C48-1941E31A9A2F@intel.com> <5823166.8kAioJAUND@wuerfel> Message-ID: On Sep 25, 2015, at 12:09 PM, Arnd Bergmann wrote: > On Friday 25 September 2015 01:39:49 Drokin, Oleg wrote: >> On Sep 24, 2015, at 9:07 PM, Drokin, Oleg wrote: >> >>> >>> On Sep 24, 2015, at 4:15 PM, Arnd Bergmann wrote: >>>>>>> Anyway this does remove a lot of stuff that we don't really need in the client, >>>>>>> I'll try to get it built and tested just to make sure it does not really break anything >>>>>>> (unfortunately it does not seem to apply cleanly to the tip of staging-next tree). >>>>>> Ok. I based the patches on top of my 37 patch series, and if you want I can >>>>>> upload a git branch somewhere to make rebasing easier. >>>>> >>>>> That would be great. >>>>> Though in the end likely this huge patch would need to be split into smaller chunks. >>>>> Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] >>>>> removal and so on. >>>>> But for testing a current snapshot would be great, then I can run it through my testbed >>>>> to see how it fares there. >>>> >>>> Ok, I've pushed out the branch to >>>> >>>> git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre >>>> >>>> This contains the latest version of the y2038 series (with the warning fixed >>>> that Sudip Mukherjee found) but no other changes, and the big code removal >>>> on top. >>> >>> >>> These do seem to be working fine in my testing. >> >> Ah, and I should mention that just as I suspected, the debug log decoding tool >> is very unhappy. > > I have updated the branch now to reflect our discussions so far. Can you handle > forwarding the patches to Greg from there, or complain if there are still > problems with them? Aha, sure. Do you want me to send the y2038 patches too? > I still had problems with removing ptlrpc_update_export_timer(), so I left > a small patch for that, which you probably want to do differently, and > while I split out the nontrivial parts of the large removal patch, most of > it still is in one chunk that contains purely removals of whole lines. Ok, I'll take care of this as well. Thank you! Bye, Oleg From arnd at arndb.de Fri Sep 25 17:22:31 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Fri, 25 Sep 2015 19:22:31 +0200 Subject: [lustre-devel] [Y2038] [PATCH 32/37] staging/lustre: use 64-bit times for exp_last_request_time In-Reply-To: References: <1443035640-1617003-1-git-send-email-arnd@arndb.de> <5823166.8kAioJAUND@wuerfel> Message-ID: <1630881.hYYUDfogQZ@wuerfel> On Friday 25 September 2015 16:53:14 Drokin, Oleg wrote: > > On Sep 25, 2015, at 12:09 PM, Arnd Bergmann wrote: > > > > I have updated the branch now to reflect our discussions so far. Can you handle > > forwarding the patches to Greg from there, or complain if there are still > > problems with them? > > Aha, sure. > Do you want me to send the y2038 patches too? Yes, I meant both the y2038 patches and the code removal. > > I still had problems with removing ptlrpc_update_export_timer(), so I left > > a small patch for that, which you probably want to do differently, and > > while I split out the nontrivial parts of the large removal patch, most of > > it still is in one chunk that contains purely removals of whole lines. > > Ok, I'll take care of this as well. > > Thank you! Thanks! Arnd From sudipm.mukherjee at gmail.com Sun Sep 27 06:56:38 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Sun, 27 Sep 2015 12:26:38 +0530 Subject: [lustre-devel] [PATCH] Staging: lustre: Fix warning detected by coccicheck In-Reply-To: <20150927054521.GA6985@jay-HP-G62-Notebook-PC> References: <20150927054521.GA6985@jay-HP-G62-Notebook-PC> Message-ID: <20150927065637.GA29432@sudip-pc> On Sun, Sep 27, 2015 at 11:15:21AM +0530, Jayavant Kenjalkar wrote: > From: Jayavant Kenjalkar You do not need this From line here. This is needed only for those who can not configure their corporate mail servers. regards sudip From andreas.dilger at intel.com Mon Sep 28 00:38:37 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Mon, 28 Sep 2015 00:38:37 +0000 Subject: [lustre-devel] [PATCH 04/73] staging/lustre: tracefile: document seconds overflow In-Reply-To: <1443386773-305443-5-git-send-email-green@linuxhacker.ru> References: <1443386773-305443-1-git-send-email-green@linuxhacker.ru> <1443386773-305443-5-git-send-email-green@linuxhacker.ru> Message-ID: On 2015/09/27, 10:45 PM, "green at linuxhacker.ru" wrote: >From: Arnd Bergmann > >The lustre tracefile has a timestamp defined as > > __u32 ph_sec; > __u64 ph_usec; > >which seems completely backwards, as the microsecond portion of >a time stamp will always fit into a __u32 value, while the second >portion will overflow in 2038 or 2106 (in case of unsigned seconds). This is indeed confusing, but the original reason for such a thing is lost in the mists of antiquity. >Changing this would unfortunately change the format in an incompatible >way, breaking all existing user space tools that access the data. It seems that it would be possible to fix this declaration to be compatible with current usage, since these fields are always written in host-endian order: #ifdef(__LITTLE_ENDIAN) __u32 ph_sec; __u32 ph_usec; __u32 ph_sec_hi; #else __u32 ph_sec; __u32 ph_sec_hi; __u32 ph_usec; #endif ph_sec_hi will always be zero today because microseconds don't grow so large, and we have 22 years to ensure existing user tools are updated to handle this in a similar manner. Another option would be to mark in ph_flags whether the ph_sec field is a __u32 or __u64 and that would allow us to migrate over to a "normal" field ordering gradually (these debug logs are only useful for a short time anyway). It would probably also make sense to change to use ph_nsec at this point as well, since that avoids the division (which might be noticeable in itself) and gives us better time resolution. Cheers, Andreas >This uses ktime_get_real_ts64() to replace the insufficient >do_gettimeofday() and then truncates the seconds portion to >an u32 type, along with comments to explain the result. > >A possible alternative would be the use of ktime_get_ts64() to >read a monotonic timestamp that never overflows, but this would >trigger a check in user space 'hdr->ph_sec < (1 << 30)' that >attempts to ensure that the values are within a reasonable range. > >Signed-off-by: Arnd Bergmann >Signed-off-by: Oleg Drokin >--- > drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 1 + > drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 10 >++++++---- > 2 files changed, 7 insertions(+), 4 deletions(-) > >diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h >b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h >index a3aa644..a1787bb 100644 >--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h >+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h >@@ -73,6 +73,7 @@ struct ptldebug_header { > __u32 ph_mask; > __u16 ph_cpu_id; > __u16 ph_type; >+ /* time_t overflow in 2106 */ > __u32 ph_sec; > __u64 ph_usec; > __u32 ph_stack; >diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c >b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c >index 87d8449..64a136c 100644 >--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c >+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c >@@ -191,16 +191,18 @@ cfs_set_ptldebug_header(struct ptldebug_header >*header, > struct libcfs_debug_msg_data *msgdata, > unsigned long stack) > { >- struct timeval tv; >+ struct timespec64 ts; > >- do_gettimeofday(&tv); >+ ktime_get_real_ts64(&ts); > > header->ph_subsys = msgdata->msg_subsys; > header->ph_mask = msgdata->msg_mask; > header->ph_cpu_id = smp_processor_id(); > header->ph_type = cfs_trace_buf_idx_get(); >- header->ph_sec = (__u32)tv.tv_sec; >- header->ph_usec = tv.tv_usec; >+ /* y2038 safe since all user space treats this as unsigned, but >+ * will overflow in 2106 */ >+ header->ph_sec = (u32)ts.tv_sec; >+ header->ph_usec = ts.tv_nsec / NSEC_PER_USEC; > header->ph_stack = stack; > header->ph_pid = current->pid; > header->ph_line_num = msgdata->msg_line; >-- >2.1.0 > > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From oleg.drokin at intel.com Mon Sep 28 01:02:07 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Mon, 28 Sep 2015 01:02:07 +0000 Subject: [lustre-devel] [PATCH 04/73] staging/lustre: tracefile: document seconds overflow In-Reply-To: References: <1443386773-305443-1-git-send-email-green@linuxhacker.ru> <1443386773-305443-5-git-send-email-green@linuxhacker.ru> Message-ID: <76975028-45A4-4527-B214-33D2389E034F@intel.com> On Sep 27, 2015, at 8:38 PM, Dilger, Andreas wrote: > On 2015/09/27, 10:45 PM, "green at linuxhacker.ru" > wrote: > >> From: Arnd Bergmann >> >> The lustre tracefile has a timestamp defined as >> >> __u32 ph_sec; >> __u64 ph_usec; >> >> which seems completely backwards, as the microsecond portion of >> a time stamp will always fit into a __u32 value, while the second >> portion will overflow in 2038 or 2106 (in case of unsigned seconds). > > This is indeed confusing, but the original reason for such a thing is > lost in the mists of antiquity. > >> Changing this would unfortunately change the format in an incompatible >> way, breaking all existing user space tools that access the data. > > It seems that it would be possible to fix this declaration to be > compatible with current usage, since these fields are always written > in host-endian order: > > > #ifdef(__LITTLE_ENDIAN) > __u32 ph_sec; > __u32 ph_usec; > __u32 ph_sec_hi; > #else > __u32 ph_sec; > __u32 ph_sec_hi; > __u32 ph_usec; > #endif > > ph_sec_hi will always be zero today because microseconds don't grow > so large, and we have 22 years to ensure existing user tools are > updated to handle this in a similar manner. > > Another option would be to mark in ph_flags whether the ph_sec field > is a __u32 or __u64 and that would allow us to migrate over to a > "normal" field ordering gradually (these debug logs are only useful > for a short time anyway). > > It would probably also make sense to change to use ph_nsec at this point > as well, since that avoids the division (which might be noticeable in > itself) and gives us better time resolution. I suggest we start with tools first. Once we do have the tools that understand this greatly deployed, then we can change the kernel code, as otherwise it's going to be quite a mess. And we still do have quite a bit of time until year 2104, so I don't feel there's a big rush here. Bye, Oleg From andreas.dilger at intel.com Mon Sep 28 01:09:18 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Mon, 28 Sep 2015 01:09:18 +0000 Subject: [lustre-devel] [PATCH 30/73] staging/lustre: use 64-bit times for request times In-Reply-To: <1443386773-305443-31-git-send-email-green@linuxhacker.ru> References: <1443386773-305443-1-git-send-email-green@linuxhacker.ru> <1443386773-305443-31-git-send-email-green@linuxhacker.ru> Message-ID: On 2015/09/27, 10:45 PM, "green at linuxhacker.ru" wrote: >From: Arnd Bergmann > >All request timestamps and deadlines in lustre are recorded in time_t >and timeval units, which overflow in 2038 on 32-bit systems. > >In this patch, I'm converting them to time64_t and timespec64, >respectively. Unfortunately, this makes a relatively large patch, >but I could not find an obvious way to split it up some more without >breaking atomicity of the change. > >Also unfortunately, this introduces two instances of div_u64_rem() >in the request path, which can be slow on 32-bit architectures. This >can probably be avoided by a larger restructuring of the code, but >it is unlikely that lustre is used in performance critical setups >on 32-bit architectures, so it seems better to optimize for correctness >rather than speed here. > >Signed-off-by: Arnd Bergmann >Signed-off-by: Oleg Drokin >--- > .../staging/lustre/lustre/include/lustre_import.h | 2 +- > drivers/staging/lustre/lustre/include/lustre_net.h | 22 ++-- > 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 | 4 +- > drivers/staging/lustre/lustre/ptlrpc/client.c | 48 ++++----- > drivers/staging/lustre/lustre/ptlrpc/events.c | 6 +- > drivers/staging/lustre/lustre/ptlrpc/import.c | 4 +- > .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 8 +- > drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 10 +- > .../staging/lustre/lustre/ptlrpc/pack_generic.c | 6 +- > drivers/staging/lustre/lustre/ptlrpc/service.c | 115 >+++++++++++---------- > 12 files changed, 118 insertions(+), 111 deletions(-) [snip] >diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c >b/drivers/staging/lustre/lustre/ptlrpc/events.c >index 53f6b62..afd869b 100644 >--- a/drivers/staging/lustre/lustre/ptlrpc/events.c >+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c >@@ -246,7 +246,7 @@ static void ptlrpc_req_add_history(struct >ptlrpc_service_part *svcpt, > struct ptlrpc_request *req) > { > __u64 sec = req->rq_arrival_time.tv_sec; >- __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */ >+ __u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /* usec >/ 16 */ This could just be written like: __u32 usec = req->rq_arrival_time.tv_nsec >> 14 /* nsec / 16384 */; since the main point of this calculation is to get a number that fits into a 16-bit field to provide ordering for items in a trace log. It doesn't have to be exactly "nsec / 16000", and it avoids the division. >diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c >b/drivers/staging/lustre/lustre/ptlrpc/service.c >index 40de622..28f57d7 100644 >--- a/drivers/staging/lustre/lustre/ptlrpc/service.c >+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c >@@ -1191,7 +1191,7 @@ static int ptlrpc_at_add_timed(struct >ptlrpc_request *req) > spin_lock(&svcpt->scp_at_lock); > LASSERT(list_empty(&req->rq_timed_list)); > >- index = (unsigned long)req->rq_deadline % array->paa_size; >+ div_u64_rem(req->rq_deadline, array->paa_size, &index); Since this is just a round-robin index that advances once per second, it doesn't matter at all whether the calculation is computed on the 64-bit seconds or on the 32-bit seconds, so there isn't any need for the more expensive div_u64_rem() call here at all. It is fine to just truncate the seconds and then do the modulus on the 32-bit value. >@@ -1421,7 +1421,7 @@ static int ptlrpc_at_check_timed(struct >ptlrpc_service_part *svcpt) > server will take. Send early replies to everyone expiring soon. */ > INIT_LIST_HEAD(&work_list); > deadline = -1; >- index = (unsigned long)array->paa_deadline % array->paa_size; >+ div_u64_rem(array->paa_deadline, array->paa_size, &index); Same here. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From arnd at arndb.de Mon Sep 28 08:02:52 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Mon, 28 Sep 2015 10:02:52 +0200 Subject: [lustre-devel] [PATCH 04/73] staging/lustre: tracefile: document seconds overflow In-Reply-To: References: <1443386773-305443-1-git-send-email-green@linuxhacker.ru> <1443386773-305443-5-git-send-email-green@linuxhacker.ru> Message-ID: <10314017.Ku9U9j04Cs@wuerfel> On Monday 28 September 2015 00:38:37 Dilger, Andreas wrote: > >Changing this would unfortunately change the format in an incompatible > >way, breaking all existing user space tools that access the data. > > It seems that it would be possible to fix this declaration to be > compatible with current usage, since these fields are always written > in host-endian order: > > > #ifdef(__LITTLE_ENDIAN) > __u32 ph_sec; > __u32 ph_usec; > __u32 ph_sec_hi; > #else > __u32 ph_sec; > __u32 ph_sec_hi; > __u32 ph_usec; > #endif > > ph_sec_hi will always be zero today because microseconds don't grow > so large, and we have 22 years to ensure existing user tools are > updated to handle this in a similar manner. > > Another option would be to mark in ph_flags whether the ph_sec field > is a __u32 or __u64 and that would allow us to migrate over to a > "normal" field ordering gradually (these debug logs are only useful > for a short time anyway). > > It would probably also make sense to change to use ph_nsec at this point > as well, since that avoids the division (which might be noticeable in > itself) and gives us better time resolution. See the discussion for the previous version I sent. Unfortunately, there is no generic __LITTLE_ENDIAN macro that we can use in both kernel and user space, so we'd either have to introduce that for all architectures first, or use the approach I described earlier: ph_usec = (now.tv_nsec / NSEC_PER_SEC) | (now.tv_sec & 0xffffffff00000000ull); which Oleg said was a bit too ugly. Arnd From arnd at arndb.de Mon Sep 28 08:19:02 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Mon, 28 Sep 2015 10:19:02 +0200 Subject: [lustre-devel] [PATCH 30/73] staging/lustre: use 64-bit times for request times In-Reply-To: References: <1443386773-305443-1-git-send-email-green@linuxhacker.ru> <1443386773-305443-31-git-send-email-green@linuxhacker.ru> Message-ID: <1670598.hVGksRcUem@wuerfel> On Monday 28 September 2015 01:09:18 Dilger, Andreas wrote: > On 2015/09/27, 10:45 PM, "green at linuxhacker.ru" > wrote: > >diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c > >b/drivers/staging/lustre/lustre/ptlrpc/events.c > >index 53f6b62..afd869b 100644 > >--- a/drivers/staging/lustre/lustre/ptlrpc/events.c > >+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c > >@@ -246,7 +246,7 @@ static void ptlrpc_req_add_history(struct > >ptlrpc_service_part *svcpt, > > struct ptlrpc_request *req) > > { > > __u64 sec = req->rq_arrival_time.tv_sec; > >- __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */ > >+ __u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /* usec > >/ 16 */ > > This could just be written like: > > __u32 usec = req->rq_arrival_time.tv_nsec >> 14 /* nsec / 16384 */; > > since the main point of this calculation is to get a number that fits > into a 16-bit field to provide ordering for items in a trace log. It > doesn't have to be exactly "nsec / 16000", and it avoids the division. Ok, that wasn't clear from the original code, so I just moved the division from the do_gettimeofday() here to keep the data unchanged. With your change, the new_seq = (sec << REQS_SEC_SHIFT) | (usec << REQS_USEC_SHIFT) | (svcpt->scp_cpt < 0 ? 0 : svcpt->scp_cpt); calculation will get forward jumps once a second, but I guess that doesn't matter if it's only used for sequencing. The part that I had not noticed here is the y2106 overflow in the sequence number. If we change the logic, we should probably give a few more bits to the seconds, as well, or use monotonic time. > >diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c > >b/drivers/staging/lustre/lustre/ptlrpc/service.c > >index 40de622..28f57d7 100644 > >--- a/drivers/staging/lustre/lustre/ptlrpc/service.c > >+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c > >@@ -1191,7 +1191,7 @@ static int ptlrpc_at_add_timed(struct > >ptlrpc_request *req) > > spin_lock(&svcpt->scp_at_lock); > > LASSERT(list_empty(&req->rq_timed_list)); > > > >- index = (unsigned long)req->rq_deadline % array->paa_size; > >+ div_u64_rem(req->rq_deadline, array->paa_size, &index); > > Since this is just a round-robin index that advances once per second, > it doesn't matter at all whether the calculation is computed on the > 64-bit seconds or on the 32-bit seconds, so there isn't any need for > the more expensive div_u64_rem() call here at all. It is fine to > just truncate the seconds and then do the modulus on the 32-bit value. > > >@@ -1421,7 +1421,7 @@ static int ptlrpc_at_check_timed(struct > >ptlrpc_service_part *svcpt) > > server will take. Send early replies to everyone expiring soon. */ > > INIT_LIST_HEAD(&work_list); > > deadline = -1; > >- index = (unsigned long)array->paa_deadline % array->paa_size; > >+ div_u64_rem(array->paa_deadline, array->paa_size, &index); > > Same here. I went back and forth on these. Initially I did just what you suggest here and added a (u32) cast on the deadline fields, but I could not convince myself that the backwards jump in 2038 is harmless. For all I can tell, array->paa_size is not normally a power-of-two number, so (0xffffffff % array->paa_size) and (0 % array->paa_size) are not neighboring indices. If you are sure that the index can be allowed to jump in 2038, we should do the simpler math and add a comment. Arnd From dhowells at redhat.com Mon Sep 21 13:42:25 2015 From: dhowells at redhat.com (David Howells) Date: Mon, 21 Sep 2015 14:42:25 +0100 Subject: [lustre-devel] [PATCH 00/38] Fixes related to incorrect usage of unsigned types In-Reply-To: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> Message-ID: <17571.1442842945@warthog.procyon.org.uk> Andrzej Hajda wrote: > Semantic patch finds comparisons of types: > unsigned < 0 > unsigned >= 0 > The former is always false, the latter is always true. > Such comparisons are useless, so theoretically they could be > safely removed, but their presence quite often indicates bugs. Or someone has left them in because they don't matter and there's the possibility that the type being tested might be or become signed under some circumstances. If the comparison is useless, I'd expect the compiler to just discard it - for such cases your patch is pointless. If I have, for example: unsigned x; if (x == 0 || x > 27) give_a_range_error(); I will write this as: unsigned x; if (x <= 0 || x > 27) give_a_range_error(); because it that gives a way to handle x being changed to signed at some point in the future for no cost. In which case, your changing the <= to an == "because the < part of the case is useless" is arguably wrong. David From a.hajda at samsung.com Tue Sep 22 09:13:29 2015 From: a.hajda at samsung.com (Andrzej Hajda) Date: Tue, 22 Sep 2015 11:13:29 +0200 Subject: [lustre-devel] [PATCH 00/38] Fixes related to incorrect usage of unsigned types In-Reply-To: <17571.1442842945@warthog.procyon.org.uk> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> <17571.1442842945@warthog.procyon.org.uk> Message-ID: <56011BB9.5030004@samsung.com> On 09/21/2015 03:42 PM, David Howells wrote: > Andrzej Hajda wrote: > >> Semantic patch finds comparisons of types: >> unsigned < 0 >> unsigned >= 0 >> The former is always false, the latter is always true. >> Such comparisons are useless, so theoretically they could be >> safely removed, but their presence quite often indicates bugs. > > Or someone has left them in because they don't matter and there's the > possibility that the type being tested might be or become signed under some > circumstances. If the comparison is useless, I'd expect the compiler to just > discard it - for such cases your patch is pointless. > > If I have, for example: > > unsigned x; > > if (x == 0 || x > 27) > give_a_range_error(); > > I will write this as: > > unsigned x; > > if (x <= 0 || x > 27) > give_a_range_error(); > > because it that gives a way to handle x being changed to signed at some point > in the future for no cost. In which case, your changing the <= to an == > "because the < part of the case is useless" is arguably wrong. This is why I have not checked for such cases - I have skipped checks of type unsigned <= 0 exactly for the reasons above. However I have left two other checks as they seems to me more suspicious - they are always true or false. But as Dmitry and Andrew pointed out Linus have quite strong opinion against removing range checks in such cases as he finds it clearer. I think it applies to patches 29-36. I am not sure about patches 26-28,37. Regards Andrzej > > David > -- > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA at public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > From a.hajda at samsung.com Mon Sep 21 13:33:58 2015 From: a.hajda at samsung.com (Andrzej Hajda) Date: Mon, 21 Sep 2015 15:33:58 +0200 Subject: [lustre-devel] [PATCH 26/38] staging: lustre: remove invalid check In-Reply-To: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> Message-ID: <1442842450-29769-27-git-send-email-a.hajda@samsung.com> Unsigned cannot be negative. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index c504d15..f3eb39f 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -451,9 +451,6 @@ static ssize_t resend_count_store(struct kobject *kobj, if (rc) return rc; - if (val < 0) - return -EINVAL; - atomic_set(&obd->u.cli.cl_resends, val); return count; -- 1.9.1 From a.hajda at samsung.com Mon Sep 21 13:33:32 2015 From: a.hajda at samsung.com (Andrzej Hajda) Date: Mon, 21 Sep 2015 15:33:32 +0200 Subject: [lustre-devel] [PATCH 00/38] Fixes related to incorrect usage of unsigned types Message-ID: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> Hi, This is set of independent patches. The only connection between them is that they try to address problems spotted by proposed coccinelle semantic patch unsigned_lesser_than_zero.cocci[1]. Semantic patch finds comparisons of types: unsigned < 0 unsigned >= 0 The former is always false, the latter is always true. Such comparisons are useless, so theoretically they could be safely removed, but their presence quite often indicates bugs. This patchset contains mainly real bug fixes(patches 01-25), usually type fixes. Patches 26-37 removes unnecessary checks. Semantic patch found much more such places (more than 80), but since every case needs some analysis I have decided to leave them for antoher patchset. The last patch should be probably replaced with something better, I guess it should be treated rather as bug report. The patches are based on linux-next (20150918). Patches were only compile tested, so please look at them carefully. I have sent all patches to linux-kernel mailing list. Individual patches + cover letter went also to apropriate addresses, according to get_maintainers.pl script. One more thing. To fullfill different maintaner/subsystem requirements I have decided to prefix patch subjects with prefixes present in last 10 commits for affected files. I am not sure if this is the best solution, if there are any better solutions please let me know :) [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Regards Andrzej Andrzej Hajda (38): arm-cci: fix handling cpumask_any_but return value bus: arm-ccn: fix handling cpumask_any_but return value drm/i915: fix handling gen8_emit_flush_coherentl3_wa result IB/ehca: fix handling idr_alloc result staging: lustre: fix handling lustre_posix_acl_xattr_filter result tty: serial: lpc32xx_hs: fix handling platform_get_irq result usb: host: ehci-msm: fix handling platform_get_irq result openvswitch: fix handling result of ipv6_skip_exthdr selftests/timers: fix write return value handlng hwrng: fix handling platform_get_irq HSI: omap_ssi: fix handling ida_simple_get result HSI: omap_ssi_port: fix handling of_get_named_gpio result ARM: shmobile: apmu: correct type of CPU id clk: vt8500: fix sign of possible PLL values drm/layerscape: fix handling fsl_dcu_drm_plane_index result gpu: ipu-v3: fix div_ratio type isdn: hisax: fix frame calculation net/ibm/emac: fix type of phy_mode net: stmmac: fix type of entry variable net: brcm80211: fix range check mwifiex: fix comparison expression orinoco: fix checking for default value rndis_wlan: fix checking for default value rtc: opal: fix type of token staging: media: davinci_vpfe: fix ipipe_mode type staging: lustre: remove invalid check usbnet: remove invalid check video/omap: remove invalid check Input: touchscreen: atmel: remove invalid check leds: flash: remove invalid check leds: tca6507: remove invalid check fs/cachefiles: remove invalid checks mm/memblock.c: remove invalid check perf: remove invalid check ptrace: remove invalid check MIPS: remove invalid check zlib_deflate/deftree: change always true condition to 1 drm/radeon: simplify boot level calculation arch/arm/mach-shmobile/platsmp-apmu.c | 2 +- arch/mips/mm/sc-mips.c | 4 ++-- arch/sh/kernel/ptrace_32.c | 3 +-- arch/sh/kernel/ptrace_64.c | 4 ++-- drivers/bus/arm-cci.c | 2 +- drivers/bus/arm-ccn.c | 2 +- drivers/char/hw_random/xgene-rng.c | 7 ++++--- drivers/clk/clk-vt8500.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 11 +---------- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 3 ++- drivers/gpu/drm/i915/intel_lrc.c | 7 ++++--- drivers/gpu/drm/radeon/kv_dpm.c | 11 +---------- drivers/gpu/ipu-v3/ipu-csi.c | 2 +- drivers/hsi/controllers/omap_ssi.c | 7 +++---- drivers/hsi/controllers/omap_ssi_port.c | 8 ++++---- drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- drivers/isdn/hisax/hfc4s8s_l1.c | 10 +++++----- drivers/leds/led-class-flash.c | 2 +- drivers/leds/leds-tca6507.c | 2 +- drivers/net/ethernet/ibm/emac/core.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- drivers/net/usb/lan78xx.c | 5 ----- drivers/net/usb/smsc75xx.c | 5 ----- drivers/net/usb/smsc95xx.c | 5 ----- drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +- drivers/net/wireless/mwifiex/11n_rxreorder.c | 4 ++-- drivers/net/wireless/orinoco/cfg.c | 6 +++--- drivers/net/wireless/rndis_wlan.c | 2 +- drivers/rtc/rtc-opal.c | 4 ++-- drivers/staging/lustre/lustre/llite/xattr.c | 7 ++++--- drivers/staging/lustre/lustre/osc/lproc_osc.c | 3 --- drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c | 2 +- drivers/staging/rdma/ehca/ehca_cq.c | 13 +++++++------ drivers/tty/serial/lpc32xx_hs.c | 7 ++++--- drivers/usb/host/ehci-msm.c | 6 +++--- drivers/video/fbdev/omap/omapfb_main.c | 5 ----- fs/cachefiles/bind.c | 9 +++------ fs/cachefiles/daemon.c | 6 +++--- lib/zlib_deflate/deftree.c | 2 +- mm/memblock.c | 2 +- net/openvswitch/conntrack.c | 2 +- tools/testing/selftests/timers/clocksource-switch.c | 2 +- 42 files changed, 79 insertions(+), 119 deletions(-) -- 1.9.1 From j.anaszewski at samsung.com Tue Sep 22 09:46:58 2015 From: j.anaszewski at samsung.com (Jacek Anaszewski) Date: Tue, 22 Sep 2015 11:46:58 +0200 Subject: [lustre-devel] [PATCH 00/38] Fixes related to incorrect usage of unsigned types In-Reply-To: <56011BB9.5030004@samsung.com> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> <17571.1442842945@warthog.procyon.org.uk> <56011BB9.5030004@samsung.com> Message-ID: <56012392.7020807@samsung.com> On 09/22/2015 11:13 AM, Andrzej Hajda wrote: > On 09/21/2015 03:42 PM, David Howells wrote: >> Andrzej Hajda wrote: >> >>> Semantic patch finds comparisons of types: >>> unsigned < 0 >>> unsigned >= 0 >>> The former is always false, the latter is always true. >>> Such comparisons are useless, so theoretically they could be >>> safely removed, but their presence quite often indicates bugs. >> >> Or someone has left them in because they don't matter and there's the >> possibility that the type being tested might be or become signed under some >> circumstances. If the comparison is useless, I'd expect the compiler to just >> discard it - for such cases your patch is pointless. >> >> If I have, for example: >> >> unsigned x; >> >> if (x == 0 || x > 27) >> give_a_range_error(); >> >> I will write this as: >> >> unsigned x; >> >> if (x <= 0 || x > 27) >> give_a_range_error(); >> >> because it that gives a way to handle x being changed to signed at some point >> in the future for no cost. In which case, your changing the <= to an == >> "because the < part of the case is useless" is arguably wrong. > > This is why I have not checked for such cases - I have skipped checks of type > unsigned <= 0 > exactly for the reasons above. > > However I have left two other checks as they seems to me more suspicious - they > are always true or false. But as Dmitry and Andrew pointed out Linus have quite > strong opinion against removing range checks in such cases as he finds it > clearer. I think it applies to patches 29-36. I am not sure about patches 26-28,37. Dropped 30/38 and 31/38 from LED tree then. -- Best Regards, Jacek Anaszewski From a.hajda at samsung.com Mon Sep 21 13:33:37 2015 From: a.hajda at samsung.com (Andrzej Hajda) Date: Mon, 21 Sep 2015 15:33:37 +0200 Subject: [lustre-devel] [PATCH 05/38] staging: lustre: fix handling lustre_posix_acl_xattr_filter result In-Reply-To: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> Message-ID: <1442842450-29769-6-git-send-email-a.hajda@samsung.com> The function can return negative value. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda --- drivers/staging/lustre/lustre/llite/xattr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 362a87d..dddc1ff 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -175,11 +175,12 @@ int ll_setxattr_common(struct inode *inode, const char *name, } ee_free(ee); } else if (rce->rce_ops == RMT_RSETFACL) { - size = lustre_posix_acl_xattr_filter( + rc = lustre_posix_acl_xattr_filter( (posix_acl_xattr_header *)value, size, &new_value); - if (unlikely(size < 0)) - return size; + if (unlikely(rc < 0)) + return rc; + size = rc; pv = (const char *)new_value; } else -- 1.9.1 From jgkenjalkar at gmail.com Sun Sep 27 05:45:21 2015 From: jgkenjalkar at gmail.com (Jayavant Kenjalkar) Date: Sun, 27 Sep 2015 11:15:21 +0530 Subject: [lustre-devel] [PATCH] Staging: lustre: Fix warning detected by coccicheck Message-ID: <20150927054521.GA6985@jay-HP-G62-Notebook-PC> From: Jayavant Kenjalkar Removing redundant semicolon as detected by coccicheck. Signed-off-by: Jayavant Kenjalkar --- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 92c746b..cb10b89 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -601,7 +601,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) /* Manage remote for early replies */ reply_md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MANAGE_REMOTE | - LNET_MD_TRUNCATE; /* allow to make EOVERFLOW error */; + LNET_MD_TRUNCATE; /* allow to make EOVERFLOW error */ reply_md.user_ptr = &request->rq_reply_cbid; reply_md.eq_handle = ptlrpc_eq_h; -- 1.7.9.5 From amir.shehata.whamcloud at gmail.com Mon Sep 28 19:30:01 2015 From: amir.shehata.whamcloud at gmail.com (Amir Shehata) Date: Mon, 28 Sep 2015 12:30:01 -0700 Subject: [lustre-devel] Channel Bonding Debug Information Message-ID: Hello, As a followup on the discussion in the LAD developer summit, regarding ensuring that there is enough debug information provided as part of the Channel Bonding solution, I'm sending this email to ask for ideas on what type of debug information you would like to see. thanks amir -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinatale2 at llnl.gov Mon Sep 28 20:08:48 2015 From: dinatale2 at llnl.gov (Di Natale, Giuseppe) Date: Mon, 28 Sep 2015 20:08:48 +0000 Subject: [lustre-devel] lprocfs Helper Issues Message-ID: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> Greetings, Recently, I've noticed that the lprocfs write frac int and u64 helpers have a few issues. The biggest issue is that neither function handles overflow/wrap. I also noticed very similar code that should be consolidated down and leveraged by both helpers. I was thinking of refactoring the functions in the fashion described below. int lprocfs_write_frac_helper_internal(char *buffer, unsigned long count, __u64 *val, int mult); int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, unsigned long count, __u64 *val, int mult); int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned long count, int *val, int mult); lprocfs_write_frac_helper_internal would handle parsing an unsigned long long from the kernel char buffer passed in. It will be responsible for detecting if a uint wrap occurs. For lprocfs_write_frac_u64_helper_safe, the string "-1" will automatically return ULLONG_MAX. If any other string representing a negative number is passed in, an invalid value error code should be returned. If the multiplier is negative, that would also be treated as invalid. The units and multiplier logic can also be consolidated. It will use lprocfs_write_frac_helper_internal to handle the parsing. lprocfs_write_frac_helper_safe will leverage lprocfs_write_frac_helper_internal. If lprocfs_write_frac_helper_internal indicates a wrap occurred, then we also have an invalid integer. Checks for integer overflow happen after a successful call to the internal helper. This is similar to how the current lprocfs_write_frac_helper functions. It is also worth nothing, I plan to maintain the old helpers and their use can be gradually phased out once we are confident the refactored version is doing what it is supposed to. Also, unrelated to the above, quick question about lctl. Is there a particular reason why the setting to be changed when using lctl set_param is echoed back to the user? I think it can be misleading in cases where the value set is not necessarily what is being reflected to the user (i.e. -1 for max value). That could be confusing to a user and they should be using lctl get_param to confirm their value was set anyways. Also, it would follow convention that unless an error happens, nothing is printed to console. Any disagreements on silencing lctl set_param? Thanks, Giuseppe Di Natale -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.dilger at intel.com Mon Sep 28 22:09:36 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Mon, 28 Sep 2015 22:09:36 +0000 Subject: [lustre-devel] [PATCH 30/73] staging/lustre: use 64-bit times for request times In-Reply-To: <1670598.hVGksRcUem@wuerfel> References: <1443386773-305443-1-git-send-email-green@linuxhacker.ru> <1443386773-305443-31-git-send-email-green@linuxhacker.ru> <1670598.hVGksRcUem@wuerfel> Message-ID: On 2015/09/28, 2:19 AM, "lustre-devel on behalf of Arnd Bergmann" wrote: >On Monday 28 September 2015 01:09:18 Dilger, Andreas wrote: >> On 2015/09/27, 10:45 PM, "green at linuxhacker.ru" >> wrote: >> >diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c >> >b/drivers/staging/lustre/lustre/ptlrpc/events.c >> >index 53f6b62..afd869b 100644 >> >--- a/drivers/staging/lustre/lustre/ptlrpc/events.c >> >+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c >> >@@ -246,7 +246,7 @@ static void ptlrpc_req_add_history(struct >> >ptlrpc_service_part *svcpt, >> > struct ptlrpc_request *req) >> > { >> > __u64 sec = req->rq_arrival_time.tv_sec; >> >- __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */ >> >+ __u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /* >>usec >> >/ 16 */ >> >> This could just be written like: >> >> __u32 usec = req->rq_arrival_time.tv_nsec >> 14 /* nsec / 16384 */; >> >> since the main point of this calculation is to get a number that fits >> into a 16-bit field to provide ordering for items in a trace log. It >> doesn't have to be exactly "nsec / 16000", and it avoids the division. > >Ok, that wasn't clear from the original code, so I just moved the division >from the do_gettimeofday() here to keep the data unchanged. > >With your change, the > >new_seq = (sec << REQS_SEC_SHIFT) | > (usec << REQS_USEC_SHIFT) | > (svcpt->scp_cpt < 0 ? 0 : svcpt->scp_cpt); > >calculation will get forward jumps once a second, but I guess that >doesn't matter if it's only used for sequencing. > >The part that I had not noticed here is the y2106 overflow in the >sequence number. If we change the logic, we should probably give >a few more bits to the seconds, as well, or use monotonic time. > >> >diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c >> >b/drivers/staging/lustre/lustre/ptlrpc/service.c >> >index 40de622..28f57d7 100644 >> >--- a/drivers/staging/lustre/lustre/ptlrpc/service.c >> >+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c >> >@@ -1191,7 +1191,7 @@ static int ptlrpc_at_add_timed(struct >> >ptlrpc_request *req) >> > spin_lock(&svcpt->scp_at_lock); >> > LASSERT(list_empty(&req->rq_timed_list)); >> > >> >- index = (unsigned long)req->rq_deadline % array->paa_size; >> >+ div_u64_rem(req->rq_deadline, array->paa_size, &index); >> >> Since this is just a round-robin index that advances once per second, >> it doesn't matter at all whether the calculation is computed on the >> 64-bit seconds or on the 32-bit seconds, so there isn't any need for >> the more expensive div_u64_rem() call here at all. It is fine to >> just truncate the seconds and then do the modulus on the 32-bit value. >> >> >@@ -1421,7 +1421,7 @@ static int ptlrpc_at_check_timed(struct >> >ptlrpc_service_part *svcpt) >> > server will take. Send early replies to everyone expiring soon. */ >> > INIT_LIST_HEAD(&work_list); >> > deadline = -1; >> >- index = (unsigned long)array->paa_deadline % array->paa_size; >> >+ div_u64_rem(array->paa_deadline, array->paa_size, &index); >> >> Same here. > >I went back and forth on these. Initially I did just what you suggest >here and added a (u32) cast on the deadline fields, but I could not >convince myself that the backwards jump in 2038 is harmless. For all >I can tell, array->paa_size is not normally a power-of-two number, so >(0xffffffff % array->paa_size) and (0 % array->paa_size) are not >neighboring indices. If you are sure that the index can be allowed to >jump in 2038, we should do the simpler math and add a comment. The jump should be largely harmless. This array is tracking the maximum RPC service time over the past paa_size interval to avoid sending spurious RPC retries if the server is already heavily loaded. If these values are not expired in 100% accurate order the worst thing that can happen is that some clients may resend their RPCs unnecessarily under heavy load. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From green at linuxhacker.ru Tue Sep 29 03:43:45 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:45 -0400 Subject: [lustre-devel] [PATCH 02/29] staging/lustre: Remove unused lustre_acl_xattr_merge2posix() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-3-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Apparently this is only used only on the metadata server. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/include/lustre_eacl.h | 4 - drivers/staging/lustre/lustre/obdclass/acl.c | 119 --------------------- 2 files changed, 123 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_eacl.h b/drivers/staging/lustre/lustre/include/lustre_eacl.h index 0f8f76c..499f9c8 100644 --- a/drivers/staging/lustre/lustre/include/lustre_eacl.h +++ b/drivers/staging/lustre/lustre/include/lustre_eacl.h @@ -80,10 +80,6 @@ extern void lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size); extern void lustre_ext_acl_xattr_free(ext_acl_xattr_header *header); -extern int -lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size, - ext_acl_xattr_header *ext_header, - posix_acl_xattr_header **out); extern ext_acl_xattr_header * lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size, ext_acl_xattr_header *ext_header); diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c b/drivers/staging/lustre/lustre/obdclass/acl.c index 933456c..1dace14 100644 --- a/drivers/staging/lustre/lustre/obdclass/acl.c +++ b/drivers/staging/lustre/lustre/obdclass/acl.c @@ -287,125 +287,6 @@ again: } /* - * Merge the posix ACL and the extended ACL into new posix ACL. - */ -int lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size, - ext_acl_xattr_header *ext_header, - posix_acl_xattr_header **out) -{ - int posix_count, posix_size, i, j; - int ext_count = le32_to_cpu(ext_header->a_count), pos = 0, rc = 0; - posix_acl_xattr_entry pe = {ACL_MASK, 0, ACL_UNDEFINED_ID}; - posix_acl_xattr_header *new; - ext_acl_xattr_entry *ee, ae; - - lustre_posix_acl_cpu_to_le(&pe, &pe); - ee = lustre_ext_acl_xattr_search(ext_header, &pe, &pos); - if (ee == NULL || le32_to_cpu(ee->e_stat) == ES_DEL) { - /* there are only base ACL entries at most. */ - posix_count = 3; - posix_size = CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr); - new = kzalloc(posix_size, GFP_NOFS); - if (unlikely(new == NULL)) - return -ENOMEM; - - new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION); - for (i = 0, j = 0; i < ext_count; i++) { - lustre_ext_acl_le_to_cpu(&ae, - &ext_header->a_entries[i]); - switch (ae.e_tag) { - case ACL_USER_OBJ: - case ACL_GROUP_OBJ: - case ACL_OTHER: - if (ae.e_id != ACL_UNDEFINED_ID) { - rc = -EIO; - goto _out; - } - - if (ae.e_stat != ES_DEL) { - new->a_entries[j].e_tag = - ext_header->a_entries[i].e_tag; - new->a_entries[j].e_perm = - ext_header->a_entries[i].e_perm; - new->a_entries[j++].e_id = - ext_header->a_entries[i].e_id; - } - break; - case ACL_MASK: - case ACL_USER: - case ACL_GROUP: - if (ae.e_stat == ES_DEL) - break; - default: - rc = -EIO; - goto _out; - } - } - } else { - /* maybe there are valid ACL_USER or ACL_GROUP entries in the - * original server-side ACL, they are regarded as ES_UNC stat.*/ - int ori_posix_count; - - if (unlikely(size < 0)) - return -EINVAL; - else if (!size) - ori_posix_count = 0; - else - ori_posix_count = - CFS_ACL_XATTR_COUNT(size, posix_acl_xattr); - posix_count = ori_posix_count + ext_count; - posix_size = - CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr); - new = kzalloc(posix_size, GFP_NOFS); - if (unlikely(new == NULL)) - return -ENOMEM; - - new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION); - /* 1. process the unchanged ACL entries - * in the original server-side ACL. */ - pos = 0; - for (i = 0, j = 0; i < ori_posix_count; i++) { - ee = lustre_ext_acl_xattr_search(ext_header, - &posix_header->a_entries[i], &pos); - if (ee == NULL) - memcpy(&new->a_entries[j++], - &posix_header->a_entries[i], - sizeof(posix_acl_xattr_entry)); - } - - /* 2. process the non-deleted entries - * from client-side extended ACL. */ - for (i = 0; i < ext_count; i++) { - if (le16_to_cpu(ext_header->a_entries[i].e_stat) != - ES_DEL) { - new->a_entries[j].e_tag = - ext_header->a_entries[i].e_tag; - new->a_entries[j].e_perm = - ext_header->a_entries[i].e_perm; - new->a_entries[j++].e_id = - ext_header->a_entries[i].e_id; - } - } - } - - /* free unused space. */ - rc = lustre_posix_acl_xattr_reduce_space(&new, posix_count, j); - if (rc >= 0) { - posix_size = rc; - *out = new; - rc = 0; - } - -_out: - if (rc) { - kfree(new); - posix_size = rc; - } - return posix_size; -} -EXPORT_SYMBOL(lustre_acl_xattr_merge2posix); - -/* * Merge the posix ACL and the extended ACL into new extended ACL. */ ext_acl_xattr_header * -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:48 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:48 -0400 Subject: [lustre-devel] [PATCH 05/29] staging/lustre: Remove unused reply state batches code In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-6-git-send-email-green@linuxhacker.ru> From: Oleg Drokin rs_batch is used on the server only. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_net.h | 6 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 145 --------------------- 2 files changed, 1 insertion(+), 150 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index a928631..e7faf0e 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -429,8 +429,7 @@ struct ptlrpc_reply_state { unsigned long rs_on_net:1; /* reply_out_callback pending? */ unsigned long rs_prealloc:1; /* rs from prealloc list */ unsigned long rs_committed:1;/* the transaction was committed - and the rs was dispatched - by ptlrpc_commit_replies */ + * and the rs was dispatched */ /** Size of the state */ int rs_size; /** opcode */ @@ -2525,9 +2524,6 @@ struct ptlrpc_service_conf { * * @{ */ -void ptlrpc_save_lock(struct ptlrpc_request *req, - struct lustre_handle *lock, int mode, int no_ack); -void ptlrpc_commit_replies(struct obd_export *exp); void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs); void ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs); int ptlrpc_hpreq_handler(struct ptlrpc_request *req); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index cdc7e62..506fc36 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -179,33 +179,6 @@ ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int post) return rc; } -/** - * Part of Rep-Ack logic. - * Puts a lock and its mode into reply state associated to request reply. - */ -void -ptlrpc_save_lock(struct ptlrpc_request *req, - struct lustre_handle *lock, int mode, int no_ack) -{ - struct ptlrpc_reply_state *rs = req->rq_reply_state; - int idx; - - LASSERT(rs != NULL); - LASSERT(rs->rs_nlocks < RS_MAX_LOCKS); - - if (req->rq_export->exp_disconnected) { - ldlm_lock_decref(lock, mode); - } else { - idx = rs->rs_nlocks++; - rs->rs_locks[idx] = *lock; - rs->rs_modes[idx] = mode; - rs->rs_difficult = 1; - rs->rs_no_ack = !!no_ack; - } -} -EXPORT_SYMBOL(ptlrpc_save_lock); - - struct ptlrpc_hr_partition; struct ptlrpc_hr_thread { @@ -246,32 +219,10 @@ struct ptlrpc_hr_service { struct ptlrpc_hr_partition **hr_partitions; }; -struct rs_batch { - struct list_head rsb_replies; - unsigned int rsb_n_replies; - struct ptlrpc_service_part *rsb_svcpt; -}; - /** reply handling service. */ static struct ptlrpc_hr_service ptlrpc_hr; /** - * maximum number of replies scheduled in one batch - */ -#define MAX_SCHEDULED 256 - -/** - * Initialize a reply batch. - * - * \param b batch - */ -static void rs_batch_init(struct rs_batch *b) -{ - memset(b, 0, sizeof(*b)); - INIT_LIST_HEAD(&b->rsb_replies); -} - -/** * Choose an hr thread to dispatch requests to. */ static struct ptlrpc_hr_thread * @@ -297,76 +248,6 @@ ptlrpc_hr_select(struct ptlrpc_service_part *svcpt) } /** - * Dispatch all replies accumulated in the batch to one from - * dedicated reply handling threads. - * - * \param b batch - */ -static void rs_batch_dispatch(struct rs_batch *b) -{ - if (b->rsb_n_replies != 0) { - struct ptlrpc_hr_thread *hrt; - - hrt = ptlrpc_hr_select(b->rsb_svcpt); - - spin_lock(&hrt->hrt_lock); - list_splice_init(&b->rsb_replies, &hrt->hrt_queue); - spin_unlock(&hrt->hrt_lock); - - wake_up(&hrt->hrt_waitq); - b->rsb_n_replies = 0; - } -} - -/** - * Add a reply to a batch. - * Add one reply object to a batch, schedule batched replies if overload. - * - * \param b batch - * \param rs reply - */ -static void rs_batch_add(struct rs_batch *b, struct ptlrpc_reply_state *rs) -{ - struct ptlrpc_service_part *svcpt = rs->rs_svcpt; - - if (svcpt != b->rsb_svcpt || b->rsb_n_replies >= MAX_SCHEDULED) { - if (b->rsb_svcpt != NULL) { - rs_batch_dispatch(b); - spin_unlock(&b->rsb_svcpt->scp_rep_lock); - } - spin_lock(&svcpt->scp_rep_lock); - b->rsb_svcpt = svcpt; - } - spin_lock(&rs->rs_lock); - rs->rs_scheduled_ever = 1; - if (rs->rs_scheduled == 0) { - list_move(&rs->rs_list, &b->rsb_replies); - rs->rs_scheduled = 1; - b->rsb_n_replies++; - } - rs->rs_committed = 1; - spin_unlock(&rs->rs_lock); -} - -/** - * Reply batch finalization. - * Dispatch remaining replies from the batch - * and release remaining spinlock. - * - * \param b batch - */ -static void rs_batch_fini(struct rs_batch *b) -{ - if (b->rsb_svcpt != NULL) { - rs_batch_dispatch(b); - spin_unlock(&b->rsb_svcpt->scp_rep_lock); - } -} - -#define DECLARE_RS_BATCH(b) struct rs_batch b - - -/** * Put reply state into a queue for processing because we received * ACK from the client */ @@ -403,32 +284,6 @@ ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs) } EXPORT_SYMBOL(ptlrpc_schedule_difficult_reply); -void ptlrpc_commit_replies(struct obd_export *exp) -{ - struct ptlrpc_reply_state *rs, *nxt; - DECLARE_RS_BATCH(batch); - - rs_batch_init(&batch); - /* Find any replies that have been committed and get their service - * to attend to complete them. */ - - /* CAVEAT EMPTOR: spinlock ordering!!! */ - spin_lock(&exp->exp_uncommitted_replies_lock); - list_for_each_entry_safe(rs, nxt, &exp->exp_uncommitted_replies, - rs_obd_list) { - LASSERT(rs->rs_difficult); - /* VBR: per-export last_committed */ - LASSERT(rs->rs_export); - if (rs->rs_transno <= exp->exp_last_committed) { - list_del_init(&rs->rs_obd_list); - rs_batch_add(&batch, rs); - } - } - spin_unlock(&exp->exp_uncommitted_replies_lock); - rs_batch_fini(&batch); -} -EXPORT_SYMBOL(ptlrpc_commit_replies); - static int ptlrpc_server_post_idle_rqbds(struct ptlrpc_service_part *svcpt) { -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:49 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:49 -0400 Subject: [lustre-devel] [PATCH 06/29] staging/lustre: Remove high-priority request callbacks In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-7-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This function is only used on the server where real high-priority requests actually exist. This deletes ptlrpc_hpreq_handler() and ptlrpc_request_change_export() Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_net.h | 3 -- drivers/staging/lustre/lustre/ptlrpc/service.c | 53 ---------------------- 2 files changed, 56 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index e7faf0e..090484b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -2526,7 +2526,6 @@ struct ptlrpc_service_conf { */ void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs); void ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs); -int ptlrpc_hpreq_handler(struct ptlrpc_request *req); struct ptlrpc_service *ptlrpc_register_service( struct ptlrpc_service_conf *conf, struct kset *parent, @@ -2538,8 +2537,6 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service); int liblustre_check_services(void *arg); void ptlrpc_daemonize(char *name); void ptlrpc_server_drop_request(struct ptlrpc_request *req); -void ptlrpc_request_change_export(struct ptlrpc_request *req, - struct obd_export *export); int ptlrpc_hr_init(void); void ptlrpc_hr_fini(void); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 506fc36..353ac22 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -819,35 +819,6 @@ void ptlrpc_server_drop_request(struct ptlrpc_request *req) } } -/** Change request export and move hp request from old export to new */ -void ptlrpc_request_change_export(struct ptlrpc_request *req, - struct obd_export *export) -{ - if (req->rq_export != NULL) { - if (!list_empty(&req->rq_exp_list)) { - /* remove rq_exp_list from last export */ - spin_lock_bh(&req->rq_export->exp_rpc_lock); - list_del_init(&req->rq_exp_list); - spin_unlock_bh(&req->rq_export->exp_rpc_lock); - - /* export has one reference already, so it`s safe to - * add req to export queue here and get another - * reference for request later */ - spin_lock_bh(&export->exp_rpc_lock); - list_add(&req->rq_exp_list, &export->exp_hp_rpcs); - spin_unlock_bh(&export->exp_rpc_lock); - } - class_export_rpc_dec(req->rq_export); - class_export_put(req->rq_export); - } - - /* request takes one export refcount */ - req->rq_export = class_export_get(export); - class_export_rpc_inc(export); - - return; -} - /** * to finish a request: stop sending more early replies, and release * the request. @@ -1329,30 +1300,6 @@ static void ptlrpc_server_hpreq_fini(struct ptlrpc_request *req) } } -static int ptlrpc_hpreq_check(struct ptlrpc_request *req) -{ - return 1; -} - -static struct ptlrpc_hpreq_ops ptlrpc_hpreq_common = { - .hpreq_check = ptlrpc_hpreq_check, -}; - -/* Hi-Priority RPC check by RPC operation code. */ -int ptlrpc_hpreq_handler(struct ptlrpc_request *req) -{ - int opc = lustre_msg_get_opc(req->rq_reqmsg); - - /* Check for export to let only reconnects for not yet evicted - * export to become a HP rpc. */ - if ((req->rq_export != NULL) && - (opc == OBD_PING || opc == MDS_CONNECT || opc == OST_CONNECT)) - req->rq_ops = &ptlrpc_hpreq_common; - - return 0; -} -EXPORT_SYMBOL(ptlrpc_hpreq_handler); - static int ptlrpc_server_request_add(struct ptlrpc_service_part *svcpt, struct ptlrpc_request *req) { -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:44 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:44 -0400 Subject: [lustre-devel] [PATCH 01/29] staging/lustre: Remove unused target_print_req() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-2-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This is a server-side request printing function, so we don't really need it on the client. Signed-off-by: Oleg Drokin Reported-by: Arnd Bergmann --- .../staging/lustre/lustre/include/lprocfs_status.h | 4 --- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 30 ---------------------- 2 files changed, 34 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 5262b4f..22f3777 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -720,10 +720,6 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr, extern const struct sysfs_ops lustre_sysfs_ops; -/* lproc_ptlrpc.c */ -struct ptlrpc_request; -void target_print_req(void *seq_file, struct ptlrpc_request *req); - /* all quota proc functions */ int lprocfs_quota_rd_bunit(char *page, char **start, loff_t off, int count, diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index d66a7b8..3a212b4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -890,36 +890,6 @@ ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s, return NULL; } -/* common ost/mdt so_req_printer */ -void target_print_req(void *seq_file, struct ptlrpc_request *req) -{ - /* Called holding srv_lock with irqs disabled. - * Print specific req contents and a newline. - * CAVEAT EMPTOR: check request message length before printing!!! - * You might have received any old crap so you must be just as - * careful here as the service's request parser!!! */ - struct seq_file *sf = seq_file; - - switch (req->rq_phase) { - case RQ_PHASE_NEW: - /* still awaiting a service thread's attention, or rejected - * because the generic request message didn't unpack */ - seq_printf(sf, "\n"); - break; - case RQ_PHASE_INTERPRET: - /* being handled, so basic msg swabbed, and opc is valid - * but racing with mds_handle() */ - case RQ_PHASE_COMPLETE: - /* been handled by mds_handle() reply state possibly still - * volatile */ - seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg)); - break; - default: - DEBUG_REQ(D_ERROR, req, "bad phase %d", req->rq_phase); - } -} -EXPORT_SYMBOL(target_print_req); - static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) { struct ptlrpc_service *svc = s->private; -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:43 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:43 -0400 Subject: [lustre-devel] [PATCH 00/29] Removal of unused Lustre code Message-ID: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This set removes a bunch of lustre code that is no lonver relevant, is server specific or is otherwise unused. Please consider. More to come later. Arnd Bergmann (1): staging/lustre: remove lots of dead code Oleg Drokin (28): staging/lustre: Remove unused target_print_req() staging/lustre: Remove unused lustre_acl_xattr_merge2posix() staging/lustre/ptlrpc: Remove server-specific health checks staging/lustre: Remove unused req_capsule_server_grow staging/lustre: Remove unused reply state batches code staging/lustre: Remove high-priority request callbacks staging/lustre: Remove unused statfs_pack() staging/lustre: Remove unused ptlrpcd_add_rqset() staging/lustre: Remove unused functions and definitions from cl_object staging/lustre: Remove unused lu_object functions. staging/lustre/ldlm: Remove unused round_timeout function staging/lustre/obdclass: Remove unused functions from genops.c staging/lustre: Remove unused function class_handle_hash_back() staging/lustre: Remove unused function server_name2svname() staging/lustre/obdclass: Drop unused code from obdo.c staging/lustre/ptlrpc: Drop unused client code staging/lustre/ptlrpc: secure wrapping code cleanup staging/lustre: Drop unused obdo_from_la() and la_from_obdo() staging/lustre/fid: Remove server fid function declarations staging/lustre/fid: seq_client_init/fini don't need to be exported staging/lustre/fid: Remove unused seq_client_get_seq function staging/lustre/fid: Get rid of lcs_srv in lu_client_seq staging/lustre/fid: Remove unused struct lu_server_seq staging/lustre/obdclass: Remove unused nid_hash staging/lustre: Remove server-only recovery-related bits staging/lustre: Remove ccc_attr/conf_set() staging/lustre: Remove unused ccc_io_fini() staging/lustre: Remove ccc_transient_page_* methods drivers/staging/lustre/lustre/fid/fid_request.c | 132 ++------ drivers/staging/lustre/lustre/fid/lproc_fid.c | 2 - drivers/staging/lustre/lustre/include/cl_object.h | 26 -- drivers/staging/lustre/lustre/include/lclient.h | 24 -- .../staging/lustre/lustre/include/lprocfs_status.h | 4 - drivers/staging/lustre/lustre/include/lu_object.h | 27 -- .../lustre/lustre/include/lustre/lustre_idl.h | 8 - .../lustre/lustre/include/lustre/lustre_user.h | 2 - .../staging/lustre/lustre/include/lustre_debug.h | 1 - .../staging/lustre/lustre/include/lustre_disk.h | 2 - .../staging/lustre/lustre/include/lustre_eacl.h | 4 - .../staging/lustre/lustre/include/lustre_export.h | 19 +- drivers/staging/lustre/lustre/include/lustre_fid.h | 91 ------ .../staging/lustre/lustre/include/lustre_handles.h | 1 - .../staging/lustre/lustre/include/lustre_import.h | 1 - drivers/staging/lustre/lustre/include/lustre_lib.h | 1 - drivers/staging/lustre/lustre/include/lustre_net.h | 42 +-- .../staging/lustre/lustre/include/lustre_param.h | 6 - .../lustre/lustre/include/lustre_req_layout.h | 7 - drivers/staging/lustre/lustre/include/lustre_sec.h | 20 -- drivers/staging/lustre/lustre/include/obd.h | 29 -- drivers/staging/lustre/lustre/include/obd_class.h | 28 -- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 70 ---- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 5 - drivers/staging/lustre/lustre/obdclass/acl.c | 119 ------- drivers/staging/lustre/lustre/obdclass/cl_io.c | 65 ---- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 26 -- drivers/staging/lustre/lustre/obdclass/cl_object.c | 41 --- drivers/staging/lustre/lustre/obdclass/debug.c | 10 - drivers/staging/lustre/lustre/obdclass/genops.c | 249 +------------- .../lustre/lustre/obdclass/linux/linux-obdo.c | 137 -------- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 4 - drivers/staging/lustre/lustre/obdclass/lu_object.c | 241 -------------- .../lustre/lustre/obdclass/lustre_handles.c | 13 - .../staging/lustre/lustre/obdclass/obd_config.c | 358 --------------------- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 27 -- drivers/staging/lustre/lustre/obdclass/obdo.c | 170 ---------- .../staging/lustre/lustre/obdclass/statfs_pack.c | 14 - drivers/staging/lustre/lustre/ptlrpc/client.c | 95 ------ drivers/staging/lustre/lustre/ptlrpc/import.c | 11 - drivers/staging/lustre/lustre/ptlrpc/layout.c | 126 -------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 30 -- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 123 ------- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 197 ------------ drivers/staging/lustre/lustre/ptlrpc/pinger.c | 18 -- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 8 - drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 42 --- drivers/staging/lustre/lustre/ptlrpc/sec.c | 116 ------- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 329 ------------------- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 48 --- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 15 - drivers/staging/lustre/lustre/ptlrpc/service.c | 320 ++---------------- 53 files changed, 62 insertions(+), 3445 deletions(-) -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:46 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:46 -0400 Subject: [lustre-devel] [PATCH 03/29] staging/lustre/ptlrpc: Remove server-specific health checks In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-4-git-send-email-green@linuxhacker.ru> From: Oleg Drokin ptlrpc_service_health_check is only used on a service, so it makes no point to retain it in the client code. Also removing it's helpers: ptlrpc_svcpt_health_check and ptlrpc_nrs_req_peek_nolock Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_net.h | 1 - .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 --- drivers/staging/lustre/lustre/ptlrpc/service.c | 58 ---------------------- 3 files changed, 65 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index e929c93..a928631 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -2541,7 +2541,6 @@ int ptlrpc_start_threads(struct ptlrpc_service *svc); int ptlrpc_unregister_service(struct ptlrpc_service *service); int liblustre_check_services(void *arg); void ptlrpc_daemonize(char *name); -int ptlrpc_service_health_check(struct ptlrpc_service *); void ptlrpc_server_drop_request(struct ptlrpc_request *req); void ptlrpc_request_change_export(struct ptlrpc_request *req, struct obd_export *export); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 059ad96b..a3608a9 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -137,12 +137,6 @@ ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, return ptlrpc_nrs_req_get_nolock0(svcpt, hp, false, force); } -static inline struct ptlrpc_request * -ptlrpc_nrs_req_peek_nolock(struct ptlrpc_service_part *svcpt, bool hp) -{ - return ptlrpc_nrs_req_get_nolock0(svcpt, hp, true, false); -} - void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req); bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 326f89e..cdc7e62 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -2977,61 +2977,3 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) return 0; } EXPORT_SYMBOL(ptlrpc_unregister_service); - -/** - * Returns 0 if the service is healthy. - * - * Right now, it just checks to make sure that requests aren't languishing - * in the queue. We'll use this health check to govern whether a node needs - * to be shot, so it's intentionally non-aggressive. */ -static int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt) -{ - struct ptlrpc_request *request = NULL; - struct timespec64 right_now; - struct timespec64 timediff; - - ktime_get_real_ts64(&right_now); - - spin_lock(&svcpt->scp_req_lock); - /* How long has the next entry been waiting? */ - if (ptlrpc_server_high_pending(svcpt, true)) - request = ptlrpc_nrs_req_peek_nolock(svcpt, true); - else if (ptlrpc_server_normal_pending(svcpt, true)) - request = ptlrpc_nrs_req_peek_nolock(svcpt, false); - - if (request == NULL) { - spin_unlock(&svcpt->scp_req_lock); - return 0; - } - - timediff = timespec64_sub(right_now, request->rq_arrival_time); - spin_unlock(&svcpt->scp_req_lock); - - if ((timediff.tv_sec) > - (AT_OFF ? obd_timeout * 3 / 2 : at_max)) { - CERROR("%s: unhealthy - request has been waiting %llds\n", - svcpt->scp_service->srv_name, (s64)timediff.tv_sec); - return -1; - } - - return 0; -} - -int -ptlrpc_service_health_check(struct ptlrpc_service *svc) -{ - struct ptlrpc_service_part *svcpt; - int i; - - if (svc == NULL) - return 0; - - ptlrpc_service_for_each_part(svcpt, i, svc) { - int rc = ptlrpc_svcpt_health_check(svcpt); - - if (rc != 0) - return rc; - } - return 0; -} -EXPORT_SYMBOL(ptlrpc_service_health_check); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:47 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:47 -0400 Subject: [lustre-devel] [PATCH 04/29] staging/lustre: Remove unused req_capsule_server_grow In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-5-git-send-email-green@linuxhacker.ru> From: Oleg Drokin It's only used on the server Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre_req_layout.h | 3 -- drivers/staging/lustre/lustre/ptlrpc/layout.c | 62 ---------------------- 2 files changed, 65 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index c6457b2..04c0076 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -129,9 +129,6 @@ void req_capsule_shrink(struct req_capsule *pill, const struct req_msg_field *field, unsigned int newlen, enum req_location loc); -int req_capsule_server_grow(struct req_capsule *pill, - const struct req_msg_field *field, - unsigned int newlen); int req_layout_init(void); void req_layout_fini(void); diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 5d19cfc..4ddbe0d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -2376,67 +2376,5 @@ void req_capsule_shrink(struct req_capsule *pill, } EXPORT_SYMBOL(req_capsule_shrink); -int req_capsule_server_grow(struct req_capsule *pill, - const struct req_msg_field *field, - unsigned int newlen) -{ - struct ptlrpc_reply_state *rs = pill->rc_req->rq_reply_state, *nrs; - char *from, *to; - int offset, len, rc; - - LASSERT(pill->rc_fmt != NULL); - LASSERT(__req_format_is_sane(pill->rc_fmt)); - LASSERT(req_capsule_has_field(pill, field, RCL_SERVER)); - LASSERT(req_capsule_field_present(pill, field, RCL_SERVER)); - - len = req_capsule_get_size(pill, field, RCL_SERVER); - offset = __req_capsule_offset(pill, field, RCL_SERVER); - if (pill->rc_req->rq_repbuf_len >= - lustre_packed_msg_size(pill->rc_req->rq_repmsg) - len + newlen) - CERROR("Inplace repack might be done\n"); - - pill->rc_req->rq_reply_state = NULL; - req_capsule_set_size(pill, field, RCL_SERVER, newlen); - rc = req_capsule_server_pack(pill); - if (rc) { - /* put old rs back, the caller will decide what to do */ - pill->rc_req->rq_reply_state = rs; - return rc; - } - nrs = pill->rc_req->rq_reply_state; - /* Now we need only buffers, copy first chunk */ - to = lustre_msg_buf(nrs->rs_msg, 0, 0); - from = lustre_msg_buf(rs->rs_msg, 0, 0); - len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) - from; - memcpy(to, from, len); - /* check if we have tail and copy it too */ - if (rs->rs_msg->lm_bufcount > offset + 1) { - to = lustre_msg_buf(nrs->rs_msg, offset + 1, 0); - from = lustre_msg_buf(rs->rs_msg, offset + 1, 0); - offset = rs->rs_msg->lm_bufcount - 1; - len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) + - cfs_size_round(rs->rs_msg->lm_buflens[offset]) - from; - memcpy(to, from, len); - } - /* drop old reply if everything is fine */ - if (rs->rs_difficult) { - /* copy rs data */ - int i; - - nrs->rs_difficult = 1; - nrs->rs_no_ack = rs->rs_no_ack; - for (i = 0; i < rs->rs_nlocks; i++) { - nrs->rs_locks[i] = rs->rs_locks[i]; - nrs->rs_modes[i] = rs->rs_modes[i]; - nrs->rs_nlocks++; - } - rs->rs_nlocks = 0; - rs->rs_difficult = 0; - rs->rs_no_ack = 0; - } - ptlrpc_rs_decref(rs); - return 0; -} -EXPORT_SYMBOL(req_capsule_server_grow); /* __REQ_LAYOUT_USER__ */ #endif -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:54 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:54 -0400 Subject: [lustre-devel] [PATCH 11/29] staging/lustre/ldlm: Remove unused round_timeout function In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-12-git-send-email-green@linuxhacker.ru> From: Oleg Drokin It's not referenced anywhere anymore. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index ac79db9..a78c4a4 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -71,11 +71,6 @@ struct ldlm_cb_async_args { static struct ldlm_state *ldlm_state; -inline unsigned long round_timeout(unsigned long timeout) -{ - return cfs_time_seconds((int)cfs_duration_sec(cfs_time_sub(timeout, 0)) + 1); -} - #define ELT_STOPPED 0 #define ELT_READY 1 #define ELT_TERMINATE 2 -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:55 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:55 -0400 Subject: [lustre-devel] [PATCH 12/29] staging/lustre/obdclass: Remove unused functions from genops.c In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-13-git-send-email-green@linuxhacker.ru> From: Oleg Drokin These functions are mostly used on the server. class_uuid2obd, get_devices_count, class_obd_list, class_conn2obd, class_conn2cliimp, class_connected_export, obd_exports_barrier, kuc_* (kernel-userspace communications). Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/include/lustre_import.h | 1 - drivers/staging/lustre/lustre/include/obd_class.h | 11 -- drivers/staging/lustre/lustre/obdclass/genops.c | 189 --------------------- 3 files changed, 201 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index 079db52..660d290 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -374,7 +374,6 @@ extern unsigned int at_max; /* genops.c */ struct obd_export; struct obd_import *class_exp2cliimp(struct obd_export *); -struct obd_import *class_conn2cliimp(struct lustre_handle *); /** @} import */ diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 8bfdc97..b323403 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -64,7 +64,6 @@ extern struct obd_device *obd_devs[MAX_OBD_DEVICES]; extern rwlock_t obd_dev_lock; /* OBD Operations Declarations */ -struct obd_device *class_conn2obd(struct lustre_handle *); struct obd_device *class_exp2obd(struct obd_export *); int class_handle_ioctl(unsigned int cmd, unsigned long arg); int lustre_get_jobid(char *jobid); @@ -84,15 +83,12 @@ void class_release_dev(struct obd_device *obd); int class_name2dev(const char *name); struct obd_device *class_name2obd(const char *name); int class_uuid2dev(struct obd_uuid *uuid); -struct obd_device *class_uuid2obd(struct obd_uuid *uuid); -void class_obd_list(void); struct obd_device *class_find_client_obd(struct obd_uuid *tgt_uuid, const char *typ_name, struct obd_uuid *grp_uuid); struct obd_device *class_devices_in_group(struct obd_uuid *grp_uuid, int *next); struct obd_device *class_num2obd(int num); -int get_devices_count(void); int class_notify_sptlrpc_conf(const char *fsname, int namelen); @@ -104,12 +100,6 @@ int obd_zombie_impexp_init(void); void obd_zombie_impexp_stop(void); void obd_zombie_impexp_cull(void); void obd_zombie_barrier(void); -void obd_exports_barrier(struct obd_device *obd); -int kuc_len(int payload_len); -struct kuc_hdr *kuc_ptr(void *p); -int kuc_ispayload(void *p); -void *kuc_alloc(int payload_len, int transport, int type); -void kuc_free(void *p, int payload_len); struct llog_handle; struct llog_rec_hdr; @@ -283,7 +273,6 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid); int class_disconnect(struct obd_export *exp); void class_fail_export(struct obd_export *exp); -int class_connected_export(struct obd_export *exp); int class_manual_cleanup(struct obd_device *obd); static inline enum obd_option exp_flags_from_obd(struct obd_device *obd) { diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 059611b..4467baa 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -439,16 +439,6 @@ int class_uuid2dev(struct obd_uuid *uuid) } EXPORT_SYMBOL(class_uuid2dev); -struct obd_device *class_uuid2obd(struct obd_uuid *uuid) -{ - int dev = class_uuid2dev(uuid); - - if (dev < 0) - return NULL; - return class_num2obd(dev); -} -EXPORT_SYMBOL(class_uuid2obd); - /** * Get obd device from ::obd_devs[] * @@ -478,55 +468,6 @@ struct obd_device *class_num2obd(int num) } EXPORT_SYMBOL(class_num2obd); -/** - * Get obd devices count. Device in any - * state are counted - * \retval obd device count - */ -int get_devices_count(void) -{ - int index, max_index = class_devno_max(), dev_count = 0; - - read_lock(&obd_dev_lock); - for (index = 0; index <= max_index; index++) { - struct obd_device *obd = class_num2obd(index); - - if (obd != NULL) - dev_count++; - } - read_unlock(&obd_dev_lock); - - return dev_count; -} -EXPORT_SYMBOL(get_devices_count); - -void class_obd_list(void) -{ - char *status; - int i; - - read_lock(&obd_dev_lock); - for (i = 0; i < class_devno_max(); i++) { - struct obd_device *obd = class_num2obd(i); - - if (!obd) - continue; - if (obd->obd_stopping) - status = "ST"; - else if (obd->obd_set_up) - status = "UP"; - else if (obd->obd_attached) - status = "AT"; - else - status = "--"; - LCONSOLE(D_CONFIG, "%3d %s %s %s %s %d\n", - i, status, obd->obd_type->typ_name, - obd->obd_name, obd->obd_uuid.uuid, - atomic_read(&obd->obd_refcount)); - } - read_unlock(&obd_dev_lock); -} - /* Search for a client OBD connected to tgt_uuid. If grp_uuid is specified, then only the client with that uuid is returned, otherwise any client connected to the tgt is returned. */ @@ -705,21 +646,6 @@ struct obd_device *class_exp2obd(struct obd_export *exp) } EXPORT_SYMBOL(class_exp2obd); -struct obd_device *class_conn2obd(struct lustre_handle *conn) -{ - struct obd_export *export; - - export = class_conn2export(conn); - if (export) { - struct obd_device *obd = export->exp_obd; - - class_export_put(export); - return obd; - } - return NULL; -} -EXPORT_SYMBOL(class_conn2obd); - struct obd_import *class_exp2cliimp(struct obd_export *exp) { struct obd_device *obd = exp->exp_obd; @@ -730,16 +656,6 @@ struct obd_import *class_exp2cliimp(struct obd_export *exp) } EXPORT_SYMBOL(class_exp2cliimp); -struct obd_import *class_conn2cliimp(struct lustre_handle *conn) -{ - struct obd_device *obd = class_conn2obd(conn); - - if (!obd) - return NULL; - return obd->u.cli.cl_import; -} -EXPORT_SYMBOL(class_conn2cliimp); - /* Export management functions */ static void class_export_destroy(struct obd_export *exp) { @@ -1208,21 +1124,6 @@ no_disconn: } EXPORT_SYMBOL(class_disconnect); -/* Return non-zero for a fully connected export */ -int class_connected_export(struct obd_export *exp) -{ - if (exp) { - int connected; - - spin_lock(&exp->exp_lock); - connected = exp->exp_conn_cnt > 0; - spin_unlock(&exp->exp_lock); - return connected; - } - return 0; -} -EXPORT_SYMBOL(class_connected_export); - void class_fail_export(struct obd_export *exp) { int rc, already_failed; @@ -1325,29 +1226,6 @@ void dump_exports(struct obd_device *obd, int locks) } EXPORT_SYMBOL(dump_exports); -void obd_exports_barrier(struct obd_device *obd) -{ - int waited = 2; - - LASSERT(list_empty(&obd->obd_exports)); - spin_lock(&obd->obd_dev_lock); - while (!list_empty(&obd->obd_unlinked_exports)) { - spin_unlock(&obd->obd_dev_lock); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(cfs_time_seconds(waited)); - if (waited > 5 && IS_PO2(waited)) { - LCONSOLE_WARN("%s is waiting for obd_unlinked_exports more than %d seconds. The obd refcount = %d. Is it stuck?\n", - obd->obd_name, waited, - atomic_read(&obd->obd_refcount)); - dump_exports(obd, 1); - } - waited *= 2; - spin_lock(&obd->obd_dev_lock); - } - spin_unlock(&obd->obd_dev_lock); -} -EXPORT_SYMBOL(obd_exports_barrier); - /* Total amount of zombies to be destroyed */ static int zombies_count; @@ -1558,70 +1436,3 @@ void obd_zombie_impexp_stop(void) obd_zombie_impexp_notify(); wait_for_completion(&obd_zombie_stop); } - -/***** Kernel-userspace comm helpers *******/ - -/* Get length of entire message, including header */ -int kuc_len(int payload_len) -{ - return sizeof(struct kuc_hdr) + payload_len; -} -EXPORT_SYMBOL(kuc_len); - -/* Get a pointer to kuc header, given a ptr to the payload - * @param p Pointer to payload area - * @returns Pointer to kuc header - */ -struct kuc_hdr *kuc_ptr(void *p) -{ - struct kuc_hdr *lh = ((struct kuc_hdr *)p) - 1; - - LASSERT(lh->kuc_magic == KUC_MAGIC); - return lh; -} -EXPORT_SYMBOL(kuc_ptr); - -/* Test if payload is part of kuc message - * @param p Pointer to payload area - * @returns boolean - */ -int kuc_ispayload(void *p) -{ - struct kuc_hdr *kh = ((struct kuc_hdr *)p) - 1; - - if (kh->kuc_magic == KUC_MAGIC) - return 1; - else - return 0; -} -EXPORT_SYMBOL(kuc_ispayload); - -/* Alloc space for a message, and fill in header - * @return Pointer to payload area - */ -void *kuc_alloc(int payload_len, int transport, int type) -{ - struct kuc_hdr *lh; - int len = kuc_len(payload_len); - - lh = kzalloc(len, GFP_NOFS); - if (!lh) - return ERR_PTR(-ENOMEM); - - lh->kuc_magic = KUC_MAGIC; - lh->kuc_transport = transport; - lh->kuc_msgtype = type; - lh->kuc_msglen = len; - - return (void *)(lh + 1); -} -EXPORT_SYMBOL(kuc_alloc); - -/* Takes pointer to payload area */ -inline void kuc_free(void *p, int payload_len) -{ - struct kuc_hdr *lh = kuc_ptr(p); - - kfree(lh); -} -EXPORT_SYMBOL(kuc_free); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:56 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:56 -0400 Subject: [lustre-devel] [PATCH 13/29] staging/lustre: Remove unused function class_handle_hash_back() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-14-git-send-email-green@linuxhacker.ru> From: Oleg Drokin No callers left. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_handles.h | 1 - drivers/staging/lustre/lustre/obdclass/lustre_handles.c | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_handles.h b/drivers/staging/lustre/lustre/include/lustre_handles.h index 726bbd3..4d51c8a 100644 --- a/drivers/staging/lustre/lustre/include/lustre_handles.h +++ b/drivers/staging/lustre/lustre/include/lustre_handles.h @@ -86,7 +86,6 @@ struct portals_handle { void class_handle_hash(struct portals_handle *, struct portals_handle_ops *ops); void class_handle_unhash(struct portals_handle *); -void class_handle_hash_back(struct portals_handle *); void *class_handle2object(__u64 cookie); void class_handle_free_cb(struct rcu_head *rcu); int class_handle_init(void); diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c index 97d79da..d19ec15 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c @@ -134,19 +134,6 @@ void class_handle_unhash(struct portals_handle *h) } EXPORT_SYMBOL(class_handle_unhash); -void class_handle_hash_back(struct portals_handle *h) -{ - struct handle_bucket *bucket; - - bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK); - - spin_lock(&bucket->lock); - list_add_rcu(&h->h_link, &bucket->head); - h->h_in = 1; - spin_unlock(&bucket->lock); -} -EXPORT_SYMBOL(class_handle_hash_back); - void *class_handle2object(__u64 cookie) { struct handle_bucket *bucket; -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:03 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:03 -0400 Subject: [lustre-devel] [PATCH 20/29] staging/lustre/fid: Remove server fid function declarations In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-21-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Those functions are not present anywhere in the client code. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_fid.h | 24 ---------------------- 1 file changed, 24 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index abc9345..1b50e66 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -425,30 +425,6 @@ struct lu_server_seq { struct seq_server_site *lss_site; }; -/* Server methods */ - -int seq_server_init(struct lu_server_seq *seq, - struct dt_device *dev, - const char *prefix, - enum lu_mgr_type type, - struct seq_server_site *ss, - const struct lu_env *env); - -void seq_server_fini(struct lu_server_seq *seq, - const struct lu_env *env); - -int seq_server_alloc_super(struct lu_server_seq *seq, - struct lu_seq_range *out, - const struct lu_env *env); - -int seq_server_alloc_meta(struct lu_server_seq *seq, - struct lu_seq_range *out, - const struct lu_env *env); - -int seq_server_set_cli(struct lu_server_seq *seq, - struct lu_client_seq *cli, - const struct lu_env *env); - /* Client methods */ int seq_client_init(struct lu_client_seq *seq, struct obd_export *exp, -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:00 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:00 -0400 Subject: [lustre-devel] [PATCH 17/29] staging/lustre/ptlrpc: secure wrapping code cleanup In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-18-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Drop unused functions. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_sec.h | 20 -- drivers/staging/lustre/lustre/ptlrpc/sec.c | 116 -------- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 329 --------------------- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 48 --- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 15 - 5 files changed, 528 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index 871185c..1d2c572 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -295,7 +295,6 @@ enum lustre_sec_part { LUSTRE_SP_ANY = 0xFF }; -const char *sptlrpc_part2name(enum lustre_sec_part sp); enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd); /** @@ -339,7 +338,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset, enum lustre_sec_part to, lnet_nid_t nid, struct sptlrpc_flavor *sf); -void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *set); int sptlrpc_process_config(struct lustre_cfg *lcfg); void sptlrpc_conf_log_start(const char *logname); @@ -347,10 +345,6 @@ void sptlrpc_conf_log_stop(const char *logname); void sptlrpc_conf_log_update_begin(const char *logname); void sptlrpc_conf_log_update_end(const char *logname); void sptlrpc_conf_client_adapt(struct obd_device *obd); -void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset, - enum lustre_sec_part from, - lnet_nid_t nid, - struct sptlrpc_flavor *flavor); /* The maximum length of security payload. 1024 is enough for Kerberos 5, * and should be enough for other future mechanisms but not sure. @@ -1002,16 +996,12 @@ void sptlrpc_sec_put(struct ptlrpc_sec *sec); * internal apis which only used by policy implementation */ int sptlrpc_get_next_secid(void); -void sptlrpc_sec_destroy(struct ptlrpc_sec *sec); /* * exported client context api */ struct ptlrpc_cli_ctx *sptlrpc_cli_ctx_get(struct ptlrpc_cli_ctx *ctx); void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync); -void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx); -void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx); -int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize); /* * exported client context wrap/buffers @@ -1054,7 +1044,6 @@ int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule); /* gc */ void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec); void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec); -void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx); /* misc */ const char *sec2target_str(struct ptlrpc_sec *sec); @@ -1078,25 +1067,16 @@ int sptlrpc_svc_wrap_reply(struct ptlrpc_request *req); void sptlrpc_svc_free_rs(struct ptlrpc_reply_state *rs); void sptlrpc_svc_ctx_addref(struct ptlrpc_request *req); void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req); -void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req); int sptlrpc_target_export_check(struct obd_export *exp, struct ptlrpc_request *req); -void sptlrpc_target_update_exp_flavor(struct obd_device *obd, - struct sptlrpc_rule_set *rset); - /* * reverse context */ int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp, struct ptlrpc_svc_ctx *ctx); -int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp, - struct ptlrpc_cli_ctx *ctx); /* bulk security api */ -int sptlrpc_enc_pool_add_user(void); -int sptlrpc_enc_pool_del_user(void); -int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc); void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc); int sptlrpc_cli_wrap_bulk(struct ptlrpc_request *req, diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 5ee6641..67604b5 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -297,46 +297,6 @@ void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync) } EXPORT_SYMBOL(sptlrpc_cli_ctx_put); -/** - * Expire the client context immediately. - * - * \pre Caller must hold at least 1 reference on the \a ctx. - */ -void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx) -{ - LASSERT(ctx->cc_ops->force_die); - ctx->cc_ops->force_die(ctx, 0); -} -EXPORT_SYMBOL(sptlrpc_cli_ctx_expire); - -/** - * To wake up the threads who are waiting for this client context. Called - * after some status change happened on \a ctx. - */ -void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx) -{ - struct ptlrpc_request *req, *next; - - spin_lock(&ctx->cc_lock); - list_for_each_entry_safe(req, next, &ctx->cc_req_list, - rq_ctx_chain) { - list_del_init(&req->rq_ctx_chain); - ptlrpc_client_wake_req(req); - } - spin_unlock(&ctx->cc_lock); -} -EXPORT_SYMBOL(sptlrpc_cli_ctx_wakeup); - -int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize) -{ - LASSERT(ctx->cc_ops); - - if (ctx->cc_ops->display == NULL) - return 0; - - return ctx->cc_ops->display(ctx, buf, bufsize); -} - static int import_sec_check_expire(struct obd_import *imp) { int adapt = 0; @@ -1229,12 +1189,6 @@ static void sec_cop_destroy_sec(struct ptlrpc_sec *sec) sptlrpc_policy_put(policy); } -void sptlrpc_sec_destroy(struct ptlrpc_sec *sec) -{ - sec_cop_destroy_sec(sec); -} -EXPORT_SYMBOL(sptlrpc_sec_destroy); - static void sptlrpc_sec_kill(struct ptlrpc_sec *sec) { LASSERT_ATOMIC_POS(&sec->ps_refcount); @@ -1507,13 +1461,6 @@ static void import_flush_ctx_common(struct obd_import *imp, sptlrpc_sec_put(sec); } -void sptlrpc_import_flush_root_ctx(struct obd_import *imp) -{ - /* it's important to use grace mode, see explain in - * sptlrpc_req_refresh_ctx() */ - import_flush_ctx_common(imp, 0, 1, 1); -} - void sptlrpc_import_flush_my_ctx(struct obd_import *imp) { import_flush_ctx_common(imp, from_kuid(&init_user_ns, current_uid()), @@ -1697,16 +1644,6 @@ void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req) req->rq_repmsg = NULL; } -int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp, - struct ptlrpc_cli_ctx *ctx) -{ - struct ptlrpc_sec_policy *policy = ctx->cc_sec->ps_policy; - - if (!policy->sp_cops->install_rctx) - return 0; - return policy->sp_cops->install_rctx(imp, ctx->cc_sec, ctx); -} - int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp, struct ptlrpc_svc_ctx *ctx) { @@ -1921,46 +1858,6 @@ int sptlrpc_target_export_check(struct obd_export *exp, } EXPORT_SYMBOL(sptlrpc_target_export_check); -void sptlrpc_target_update_exp_flavor(struct obd_device *obd, - struct sptlrpc_rule_set *rset) -{ - struct obd_export *exp; - struct sptlrpc_flavor new_flvr; - - LASSERT(obd); - - spin_lock(&obd->obd_dev_lock); - - list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) { - if (exp->exp_connection == NULL) - continue; - - /* note if this export had just been updated flavor - * (exp_flvr_changed == 1), this will override the - * previous one. */ - spin_lock(&exp->exp_lock); - sptlrpc_target_choose_flavor(rset, exp->exp_sp_peer, - exp->exp_connection->c_peer.nid, - &new_flvr); - if (exp->exp_flvr_changed || - !flavor_equal(&new_flvr, &exp->exp_flvr)) { - exp->exp_flvr_old[1] = new_flvr; - exp->exp_flvr_expire[1] = 0; - exp->exp_flvr_changed = 1; - exp->exp_flvr_adapt = 1; - - CDEBUG(D_SEC, "exp %p (%s): updated flavor %x->%x\n", - exp, sptlrpc_part2name(exp->exp_sp_peer), - exp->exp_flvr.sf_rpc, - exp->exp_flvr_old[1].sf_rpc); - } - spin_unlock(&exp->exp_lock); - } - - spin_unlock(&obd->obd_dev_lock); -} -EXPORT_SYMBOL(sptlrpc_target_update_exp_flavor); - static int sptlrpc_svc_check_from(struct ptlrpc_request *req, int svc_rc) { /* peer's claim is unreliable unless gss is being used */ @@ -2183,19 +2080,6 @@ void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req) req->rq_svc_ctx = NULL; } -void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req) -{ - struct ptlrpc_svc_ctx *ctx = req->rq_svc_ctx; - - if (ctx == NULL) - return; - - LASSERT_ATOMIC_POS(&ctx->sc_refcount); - if (ctx->sc_policy->sp_sops->invalidate_ctx) - ctx->sc_policy->sp_sops->invalidate_ctx(ctx); -} -EXPORT_SYMBOL(sptlrpc_svc_ctx_invalidate); - /**************************************** * bulk security * ****************************************/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index c18b71c..c89973c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -302,150 +302,6 @@ static unsigned long enc_pools_cleanup(struct page ***pools, int npools) return cleaned; } -/* - * merge @npools pointed by @pools which contains @npages new pages - * into current pools. - * - * we have options to avoid most memory copy with some tricks. but we choose - * the simplest way to avoid complexity. It's not frequently called. - */ -static void enc_pools_insert(struct page ***pools, int npools, int npages) -{ - int freeslot; - int op_idx, np_idx, og_idx, ng_idx; - int cur_npools, end_npools; - - LASSERT(npages > 0); - LASSERT(page_pools.epp_total_pages+npages <= page_pools.epp_max_pages); - LASSERT(npages_to_npools(npages) == npools); - LASSERT(page_pools.epp_growing); - - spin_lock(&page_pools.epp_lock); - - /* - * (1) fill all the free slots of current pools. - */ - /* free slots are those left by rent pages, and the extra ones with - * index >= total_pages, locate at the tail of last pool. */ - freeslot = page_pools.epp_total_pages % PAGES_PER_POOL; - if (freeslot != 0) - freeslot = PAGES_PER_POOL - freeslot; - freeslot += page_pools.epp_total_pages - page_pools.epp_free_pages; - - op_idx = page_pools.epp_free_pages / PAGES_PER_POOL; - og_idx = page_pools.epp_free_pages % PAGES_PER_POOL; - np_idx = npools - 1; - ng_idx = (npages - 1) % PAGES_PER_POOL; - - while (freeslot) { - LASSERT(page_pools.epp_pools[op_idx][og_idx] == NULL); - LASSERT(pools[np_idx][ng_idx] != NULL); - - page_pools.epp_pools[op_idx][og_idx] = pools[np_idx][ng_idx]; - pools[np_idx][ng_idx] = NULL; - - freeslot--; - - if (++og_idx == PAGES_PER_POOL) { - op_idx++; - og_idx = 0; - } - if (--ng_idx < 0) { - if (np_idx == 0) - break; - np_idx--; - ng_idx = PAGES_PER_POOL - 1; - } - } - - /* - * (2) add pools if needed. - */ - cur_npools = (page_pools.epp_total_pages + PAGES_PER_POOL - 1) / - PAGES_PER_POOL; - end_npools = (page_pools.epp_total_pages + npages + PAGES_PER_POOL - 1) - / PAGES_PER_POOL; - LASSERT(end_npools <= page_pools.epp_max_pools); - - np_idx = 0; - while (cur_npools < end_npools) { - LASSERT(page_pools.epp_pools[cur_npools] == NULL); - LASSERT(np_idx < npools); - LASSERT(pools[np_idx] != NULL); - - page_pools.epp_pools[cur_npools++] = pools[np_idx]; - pools[np_idx++] = NULL; - } - - page_pools.epp_total_pages += npages; - page_pools.epp_free_pages += npages; - page_pools.epp_st_lowfree = page_pools.epp_free_pages; - - if (page_pools.epp_total_pages > page_pools.epp_st_max_pages) - page_pools.epp_st_max_pages = page_pools.epp_total_pages; - - CDEBUG(D_SEC, "add %d pages to total %lu\n", npages, - page_pools.epp_total_pages); - - spin_unlock(&page_pools.epp_lock); -} - -static int enc_pools_add_pages(int npages) -{ - static DEFINE_MUTEX(add_pages_mutex); - struct page ***pools; - int npools, alloced = 0; - int i, j, rc = -ENOMEM; - - if (npages < PTLRPC_MAX_BRW_PAGES) - npages = PTLRPC_MAX_BRW_PAGES; - - mutex_lock(&add_pages_mutex); - - if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages) - npages = page_pools.epp_max_pages - page_pools.epp_total_pages; - LASSERT(npages > 0); - - page_pools.epp_st_grows++; - - npools = npages_to_npools(npages); - pools = kcalloc(npools, sizeof(*pools), GFP_NOFS); - if (pools == NULL) - goto out; - - for (i = 0; i < npools; i++) { - pools[i] = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS); - if (!pools[i]) - goto out_pools; - - for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) { - pools[i][j] = alloc_page(GFP_NOFS | - __GFP_HIGHMEM); - if (pools[i][j] == NULL) - goto out_pools; - - alloced++; - } - } - LASSERT(alloced == npages); - - enc_pools_insert(pools, npools, npages); - CDEBUG(D_SEC, "added %d pages into pools\n", npages); - rc = 0; - -out_pools: - enc_pools_cleanup(pools, npools); - kfree(pools); -out: - if (rc) { - page_pools.epp_st_grow_fails++; - CERROR("Failed to allocate %d enc pages\n", npages); - } - - mutex_unlock(&add_pages_mutex); - return rc; -} - static inline void enc_pools_wakeup(void) { assert_spin_locked(&page_pools.epp_lock); @@ -457,156 +313,6 @@ static inline void enc_pools_wakeup(void) } } -static int enc_pools_should_grow(int page_needed, time64_t now) -{ - /* don't grow if someone else is growing the pools right now, - * or the pools has reached its full capacity - */ - if (page_pools.epp_growing || - page_pools.epp_total_pages == page_pools.epp_max_pages) - return 0; - - /* if total pages is not enough, we need to grow */ - if (page_pools.epp_total_pages < page_needed) - return 1; - - /* - * we wanted to return 0 here if there was a shrink just happened - * moment ago, but this may cause deadlock if both client and ost - * live on single node. - */ -#if 0 - if (now - page_pools.epp_last_shrink < 2) - return 0; -#endif - - /* - * here we perhaps need consider other factors like wait queue - * length, idle index, etc. ? - */ - - /* grow the pools in any other cases */ - return 1; -} - -/* - * we allocate the requested pages atomically. - */ -int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc) -{ - wait_queue_t waitlink; - unsigned long this_idle = -1; - unsigned long tick = 0; - long now; - int p_idx, g_idx; - int i; - - LASSERT(desc->bd_iov_count > 0); - LASSERT(desc->bd_iov_count <= page_pools.epp_max_pages); - - /* resent bulk, enc iov might have been allocated previously */ - if (desc->bd_enc_iov != NULL) - return 0; - - desc->bd_enc_iov = kcalloc(desc->bd_iov_count, - sizeof(*desc->bd_enc_iov), GFP_NOFS); - if (desc->bd_enc_iov == NULL) - return -ENOMEM; - - spin_lock(&page_pools.epp_lock); - - page_pools.epp_st_access++; -again: - if (unlikely(page_pools.epp_free_pages < desc->bd_iov_count)) { - if (tick == 0) - tick = cfs_time_current(); - - now = ktime_get_seconds(); - - page_pools.epp_st_missings++; - page_pools.epp_pages_short += desc->bd_iov_count; - - if (enc_pools_should_grow(desc->bd_iov_count, now)) { - page_pools.epp_growing = 1; - - spin_unlock(&page_pools.epp_lock); - enc_pools_add_pages(page_pools.epp_pages_short / 2); - spin_lock(&page_pools.epp_lock); - - page_pools.epp_growing = 0; - - enc_pools_wakeup(); - } else { - if (++page_pools.epp_waitqlen > - page_pools.epp_st_max_wqlen) - page_pools.epp_st_max_wqlen = - page_pools.epp_waitqlen; - - set_current_state(TASK_UNINTERRUPTIBLE); - init_waitqueue_entry(&waitlink, current); - add_wait_queue(&page_pools.epp_waitq, &waitlink); - - spin_unlock(&page_pools.epp_lock); - schedule(); - remove_wait_queue(&page_pools.epp_waitq, &waitlink); - LASSERT(page_pools.epp_waitqlen > 0); - spin_lock(&page_pools.epp_lock); - page_pools.epp_waitqlen--; - } - - LASSERT(page_pools.epp_pages_short >= desc->bd_iov_count); - page_pools.epp_pages_short -= desc->bd_iov_count; - - this_idle = 0; - goto again; - } - - /* record max wait time */ - if (unlikely(tick != 0)) { - tick = cfs_time_current() - tick; - if (tick > page_pools.epp_st_max_wait) - page_pools.epp_st_max_wait = tick; - } - - /* proceed with rest of allocation */ - page_pools.epp_free_pages -= desc->bd_iov_count; - - p_idx = page_pools.epp_free_pages / PAGES_PER_POOL; - g_idx = page_pools.epp_free_pages % PAGES_PER_POOL; - - for (i = 0; i < desc->bd_iov_count; i++) { - LASSERT(page_pools.epp_pools[p_idx][g_idx] != NULL); - desc->bd_enc_iov[i].kiov_page = - page_pools.epp_pools[p_idx][g_idx]; - page_pools.epp_pools[p_idx][g_idx] = NULL; - - if (++g_idx == PAGES_PER_POOL) { - p_idx++; - g_idx = 0; - } - } - - if (page_pools.epp_free_pages < page_pools.epp_st_lowfree) - page_pools.epp_st_lowfree = page_pools.epp_free_pages; - - /* - * new idle index = (old * weight + new) / (weight + 1) - */ - if (this_idle == -1) { - this_idle = page_pools.epp_free_pages * IDLE_IDX_MAX / - page_pools.epp_total_pages; - } - page_pools.epp_idle_idx = (page_pools.epp_idle_idx * IDLE_IDX_WEIGHT + - this_idle) / - (IDLE_IDX_WEIGHT + 1); - - page_pools.epp_last_access = ktime_get_seconds(); - - spin_unlock(&page_pools.epp_lock); - return 0; -} -EXPORT_SYMBOL(sptlrpc_enc_pool_get_pages); - void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc) { int p_idx, g_idx; @@ -651,41 +357,6 @@ void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc) } EXPORT_SYMBOL(sptlrpc_enc_pool_put_pages); -/* - * we don't do much stuff for add_user/del_user anymore, except adding some - * initial pages in add_user() if current pools are empty, rest would be - * handled by the pools's self-adaption. - */ -int sptlrpc_enc_pool_add_user(void) -{ - int need_grow = 0; - - spin_lock(&page_pools.epp_lock); - if (page_pools.epp_growing == 0 && page_pools.epp_total_pages == 0) { - page_pools.epp_growing = 1; - need_grow = 1; - } - spin_unlock(&page_pools.epp_lock); - - if (need_grow) { - enc_pools_add_pages(PTLRPC_MAX_BRW_PAGES + - PTLRPC_MAX_BRW_PAGES); - - spin_lock(&page_pools.epp_lock); - page_pools.epp_growing = 0; - enc_pools_wakeup(); - spin_unlock(&page_pools.epp_lock); - } - return 0; -} -EXPORT_SYMBOL(sptlrpc_enc_pool_add_user); - -int sptlrpc_enc_pool_del_user(void) -{ - return 0; -} -EXPORT_SYMBOL(sptlrpc_enc_pool_del_user); - static inline void enc_pools_alloc(void) { LASSERT(page_pools.epp_max_pools); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c index 7769ab2..0d29b87 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c @@ -48,27 +48,6 @@ #include "ptlrpc_internal.h" -const char *sptlrpc_part2name(enum lustre_sec_part part) -{ - switch (part) { - case LUSTRE_SP_CLI: - return "cli"; - case LUSTRE_SP_MDT: - return "mdt"; - case LUSTRE_SP_OST: - return "ost"; - case LUSTRE_SP_MGC: - return "mgc"; - case LUSTRE_SP_MGS: - return "mgs"; - case LUSTRE_SP_ANY: - return "any"; - default: - return "err"; - } -} -EXPORT_SYMBOL(sptlrpc_part2name); - enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd) { const char *type = obd->obd_type->typ_name; @@ -430,19 +409,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset, } EXPORT_SYMBOL(sptlrpc_rule_set_choose); -void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset) -{ - struct sptlrpc_rule *r; - int n; - - for (n = 0; n < rset->srs_nrule; n++) { - r = &rset->srs_rules[n]; - CDEBUG(D_SEC, "<%02d> from %x to %x, net %x, rpc %x\n", n, - r->sr_from, r->sr_to, r->sr_netid, r->sr_flvr.sf_rpc); - } -} -EXPORT_SYMBOL(sptlrpc_rule_set_dump); - /********************************** * sptlrpc configuration support * **********************************/ @@ -836,20 +802,6 @@ out: flavor_set_flags(sf, from, to, 1); } -/** - * called by target devices, determine the expected flavor from - * certain peer (from, nid). - */ -void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset, - enum lustre_sec_part from, - lnet_nid_t nid, - struct sptlrpc_flavor *sf) -{ - if (sptlrpc_rule_set_choose(rset, from, LUSTRE_SP_ANY, nid, sf) == 0) - get_default_flavor(sf); -} -EXPORT_SYMBOL(sptlrpc_target_choose_flavor); - #define SEC_ADAPT_DELAY (10) /** diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c index c3ad1da..520329f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c @@ -103,21 +103,6 @@ void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec) } EXPORT_SYMBOL(sptlrpc_gc_del_sec); -void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx) -{ - LASSERT(list_empty(&ctx->cc_gc_chain)); - - CDEBUG(D_SEC, "hand over ctx %p(%u->%s)\n", - ctx, ctx->cc_vcred.vc_uid, sec2target_str(ctx->cc_sec)); - spin_lock(&sec_gc_ctx_list_lock); - list_add(&ctx->cc_gc_chain, &sec_gc_ctx_list); - spin_unlock(&sec_gc_ctx_list_lock); - - thread_add_flags(&sec_gc_thread, SVC_SIGNAL); - wake_up(&sec_gc_thread.t_ctl_waitq); -} -EXPORT_SYMBOL(sptlrpc_gc_add_ctx); - static void sec_process_ctx_list(void) { struct ptlrpc_cli_ctx *ctx; -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:50 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:50 -0400 Subject: [lustre-devel] [PATCH 07/29] staging/lustre: Remove unused statfs_pack() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-8-git-send-email-green@linuxhacker.ru> From: Oleg Drokin It's only used on the server. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_lib.h | 1 - drivers/staging/lustre/lustre/obdclass/statfs_pack.c | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h index b380359..35175fd 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lib.h +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h @@ -100,7 +100,6 @@ struct obd_client_handle { #define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed /* statfs_pack.c */ -void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs); void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs); /* diff --git a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c index cc785ab..fb4e3ae 100644 --- a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c +++ b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c @@ -46,20 +46,6 @@ #include "../include/obd_support.h" #include "../include/obd_class.h" -void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs) -{ - memset(osfs, 0, sizeof(*osfs)); - osfs->os_type = sfs->f_type; - osfs->os_blocks = sfs->f_blocks; - osfs->os_bfree = sfs->f_bfree; - osfs->os_bavail = sfs->f_bavail; - osfs->os_files = sfs->f_files; - osfs->os_ffree = sfs->f_ffree; - osfs->os_bsize = sfs->f_bsize; - osfs->os_namelen = sfs->f_namelen; -} -EXPORT_SYMBOL(statfs_pack); - void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs) { memset(sfs, 0, sizeof(*sfs)); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:53 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:53 -0400 Subject: [lustre-devel] [PATCH 10/29] staging/lustre: Remove unused lu_object functions. In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-11-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Quite a bunch of them are only used on the server. lu_object_put_nocache, lu_object_invariant, lu_dev_del_linkage, lu_context_tags_update, lu_context_tags_clear, lu_session_tags_update, lu_session_tags_clear, lu_env_refill_by_tags, lu_printk_printer, lu_object_assign_fid, lu_object_anon, lu_buf_free, lu_buf_alloc, lu_buf_realloc, lu_buf_check_and_alloc, lu_buf_check_and_grow Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lu_object.h | 27 --- drivers/staging/lustre/lustre/obdclass/lu_object.c | 241 --------------------- 2 files changed, 268 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 7756008..e2199c2 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -672,7 +672,6 @@ void lu_object_add_top (struct lu_object_header *h, struct lu_object *o); void lu_object_add (struct lu_object *before, struct lu_object *o); void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d); -void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d); /** * Helpers to initialize and finalize device types. @@ -710,7 +709,6 @@ static inline int lu_object_is_dying(const struct lu_object_header *h) } void lu_object_put(const struct lu_env *env, struct lu_object *o); -void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o); void lu_object_unhash(const struct lu_env *env, struct lu_object *o); int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr); @@ -1241,14 +1239,6 @@ void lu_context_key_degister_many(struct lu_context_key *k, ...); void lu_context_key_revive_many (struct lu_context_key *k, ...); void lu_context_key_quiesce_many (struct lu_context_key *k, ...); -/* - * update/clear ctx/ses tags. - */ -void lu_context_tags_update(__u32 tags); -void lu_context_tags_clear(__u32 tags); -void lu_session_tags_update(__u32 tags); -void lu_session_tags_clear(__u32 tags); - /** * Environment. */ @@ -1266,7 +1256,6 @@ struct lu_env { int lu_env_init (struct lu_env *env, __u32 tags); void lu_env_fini (struct lu_env *env); int lu_env_refill(struct lu_env *env); -int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags); /** @} lu_context */ @@ -1319,21 +1308,5 @@ struct lu_kmem_descr { int lu_kmem_init(struct lu_kmem_descr *caches); void lu_kmem_fini(struct lu_kmem_descr *caches); -void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o, - const struct lu_fid *fid); -struct lu_object *lu_object_anon(const struct lu_env *env, - struct lu_device *dev, - const struct lu_object_conf *conf); - -/** null buffer */ -extern struct lu_buf LU_BUF_NULL; - -void lu_buf_free(struct lu_buf *buf); -void lu_buf_alloc(struct lu_buf *buf, int size); -void lu_buf_realloc(struct lu_buf *buf, int size); - -int lu_buf_check_and_grow(struct lu_buf *buf, int len); -struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, int len); - /** @} lu */ #endif /* __LUSTRE_LU_OBJECT_H */ diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index c892e82..01d70f0 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -157,17 +157,6 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o) EXPORT_SYMBOL(lu_object_put); /** - * Put object and don't keep in cache. This is temporary solution for - * multi-site objects when its layering is not constant. - */ -void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o) -{ - set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags); - return lu_object_put(env, o); -} -EXPORT_SYMBOL(lu_object_put_nocache); - -/** * Kill the object and take it out of LRU cache. * Currently used by client code for layout change. */ @@ -529,23 +518,6 @@ void lu_object_print(const struct lu_env *env, void *cookie, } EXPORT_SYMBOL(lu_object_print); -/** - * Check object consistency. - */ -int lu_object_invariant(const struct lu_object *o) -{ - struct lu_object_header *top; - - top = o->lo_header; - list_for_each_entry(o, &top->loh_layers, lo_linkage) { - if (o->lo_ops->loo_object_invariant != NULL && - !o->lo_ops->loo_object_invariant(o)) - return 0; - } - return 1; -} -EXPORT_SYMBOL(lu_object_invariant); - static struct lu_object *htable_lookup(struct lu_site *s, struct cfs_hash_bd *bd, const struct lu_fid *f, @@ -962,14 +934,6 @@ void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d) } EXPORT_SYMBOL(lu_dev_add_linkage); -void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d) -{ - spin_lock(&s->ls_ld_lock); - list_del_init(&d->ld_linkage); - spin_unlock(&s->ls_ld_lock); -} -EXPORT_SYMBOL(lu_dev_del_linkage); - /** * Initialize site \a s, with \a d as the top level device. */ @@ -1701,42 +1665,6 @@ EXPORT_SYMBOL(lu_context_refill); __u32 lu_context_tags_default; __u32 lu_session_tags_default; -void lu_context_tags_update(__u32 tags) -{ - spin_lock(&lu_keys_guard); - lu_context_tags_default |= tags; - key_set_version++; - spin_unlock(&lu_keys_guard); -} -EXPORT_SYMBOL(lu_context_tags_update); - -void lu_context_tags_clear(__u32 tags) -{ - spin_lock(&lu_keys_guard); - lu_context_tags_default &= ~tags; - key_set_version++; - spin_unlock(&lu_keys_guard); -} -EXPORT_SYMBOL(lu_context_tags_clear); - -void lu_session_tags_update(__u32 tags) -{ - spin_lock(&lu_keys_guard); - lu_session_tags_default |= tags; - key_set_version++; - spin_unlock(&lu_keys_guard); -} -EXPORT_SYMBOL(lu_session_tags_update); - -void lu_session_tags_clear(__u32 tags) -{ - spin_lock(&lu_keys_guard); - lu_session_tags_default &= ~tags; - key_set_version++; - spin_unlock(&lu_keys_guard); -} -EXPORT_SYMBOL(lu_session_tags_clear); - int lu_env_init(struct lu_env *env, __u32 tags) { int result; @@ -1768,31 +1696,6 @@ int lu_env_refill(struct lu_env *env) } EXPORT_SYMBOL(lu_env_refill); -/** - * Currently, this API will only be used by echo client. - * Because echo client and normal lustre client will share - * same cl_env cache. So echo client needs to refresh - * the env context after it get one from the cache, especially - * when normal client and echo client co-exist in the same client. - */ -int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, - __u32 stags) -{ - if ((env->le_ctx.lc_tags & ctags) != ctags) { - env->le_ctx.lc_version = 0; - env->le_ctx.lc_tags |= ctags; - } - - if (env->le_ses && (env->le_ses->lc_tags & stags) != stags) { - env->le_ses->lc_version = 0; - env->le_ses->lc_tags |= stags; - } - - return lu_env_refill(env); -} -EXPORT_SYMBOL(lu_env_refill_by_tags); - - struct lu_site_stats { unsigned lss_populated; unsigned lss_max_search; @@ -1904,29 +1807,9 @@ static unsigned long lu_cache_shrink_scan(struct shrinker *sk, return sc->nr_to_scan - remain; } -/* - * Debugging stuff. - */ - -/** - * Environment to be used in debugger, contains all tags. - */ -struct lu_env lu_debugging_env; - /** * Debugging printer function using printk(). */ -int lu_printk_printer(const struct lu_env *env, - void *unused, const char *format, ...) -{ - va_list args; - - va_start(args, format); - vprintk(format, args); - va_end(args); - return 0; -} - static struct shrinker lu_site_shrinker = { .count_objects = lu_cache_shrink_count, .scan_objects = lu_cache_shrink_scan, @@ -2069,127 +1952,3 @@ void lu_kmem_fini(struct lu_kmem_descr *caches) } } EXPORT_SYMBOL(lu_kmem_fini); - -/** - * Temporary solution to be able to assign fid in ->do_create() - * till we have fully-functional OST fids - */ -void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o, - const struct lu_fid *fid) -{ - struct lu_site *s = o->lo_dev->ld_site; - struct lu_fid *old = &o->lo_header->loh_fid; - struct lu_object *shadow; - wait_queue_t waiter; - struct cfs_hash *hs; - struct cfs_hash_bd bd; - __u64 version = 0; - - LASSERT(fid_is_zero(old)); - - hs = s->ls_obj_hash; - cfs_hash_bd_get_and_lock(hs, (void *)fid, &bd, 1); - shadow = htable_lookup(s, &bd, fid, &waiter, &version); - /* supposed to be unique */ - LASSERT(IS_ERR(shadow) && PTR_ERR(shadow) == -ENOENT); - *old = *fid; - cfs_hash_bd_add_locked(hs, &bd, &o->lo_header->loh_hash); - cfs_hash_bd_unlock(hs, &bd, 1); -} -EXPORT_SYMBOL(lu_object_assign_fid); - -/** - * allocates object with 0 (non-assigned) fid - * XXX: temporary solution to be able to assign fid in ->do_create() - * till we have fully-functional OST fids - */ -struct lu_object *lu_object_anon(const struct lu_env *env, - struct lu_device *dev, - const struct lu_object_conf *conf) -{ - struct lu_fid fid; - struct lu_object *o; - - fid_zero(&fid); - o = lu_object_alloc(env, dev, &fid, conf); - - return o; -} -EXPORT_SYMBOL(lu_object_anon); - -struct lu_buf LU_BUF_NULL = { - .lb_buf = NULL, - .lb_len = 0 -}; -EXPORT_SYMBOL(LU_BUF_NULL); - -void lu_buf_free(struct lu_buf *buf) -{ - LASSERT(buf); - if (buf->lb_buf) { - LASSERT(buf->lb_len > 0); - kvfree(buf->lb_buf); - buf->lb_buf = NULL; - buf->lb_len = 0; - } -} -EXPORT_SYMBOL(lu_buf_free); - -void lu_buf_alloc(struct lu_buf *buf, int size) -{ - LASSERT(buf); - LASSERT(buf->lb_buf == NULL); - LASSERT(buf->lb_len == 0); - buf->lb_buf = libcfs_kvzalloc(size, GFP_NOFS); - if (likely(buf->lb_buf)) - buf->lb_len = size; -} -EXPORT_SYMBOL(lu_buf_alloc); - -void lu_buf_realloc(struct lu_buf *buf, int size) -{ - lu_buf_free(buf); - lu_buf_alloc(buf, size); -} -EXPORT_SYMBOL(lu_buf_realloc); - -struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, int len) -{ - if (buf->lb_buf == NULL && buf->lb_len == 0) - lu_buf_alloc(buf, len); - - if ((len > buf->lb_len) && (buf->lb_buf != NULL)) - lu_buf_realloc(buf, len); - - return buf; -} -EXPORT_SYMBOL(lu_buf_check_and_alloc); - -/** - * Increase the size of the \a buf. - * preserves old data in buffer - * old buffer remains unchanged on error - * \retval 0 or -ENOMEM - */ -int lu_buf_check_and_grow(struct lu_buf *buf, int len) -{ - char *ptr; - - if (len <= buf->lb_len) - return 0; - - ptr = libcfs_kvzalloc(len, GFP_NOFS); - if (ptr == NULL) - return -ENOMEM; - - /* Free the old buf */ - if (buf->lb_buf != NULL) { - memcpy(ptr, buf->lb_buf, buf->lb_len); - kvfree(buf->lb_buf); - } - - buf->lb_buf = ptr; - buf->lb_len = len; - return 0; -} -EXPORT_SYMBOL(lu_buf_check_and_grow); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:58 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:58 -0400 Subject: [lustre-devel] [PATCH 15/29] staging/lustre/obdclass: Drop unused code from obdo.c In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-16-git-send-email-green@linuxhacker.ru> From: Oleg Drokin These functions are not even referenced in any header files anymore. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/obdclass/obdo.c | 170 -------------------------- 1 file changed, 170 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c index 307ffe3..1a950fb 100644 --- a/drivers/staging/lustre/lustre/obdclass/obdo.c +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c @@ -115,90 +115,6 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid) } EXPORT_SYMBOL(obdo_from_inode); -void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid) -{ - CDEBUG(D_INODE, "src obdo "DOSTID" valid %#llx, dst obdo "DOSTID"\n", - POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi)); - if (valid & OBD_MD_FLATIME) - dst->o_atime = src->o_atime; - if (valid & OBD_MD_FLMTIME) - dst->o_mtime = src->o_mtime; - if (valid & OBD_MD_FLCTIME) - dst->o_ctime = src->o_ctime; - if (valid & OBD_MD_FLSIZE) - dst->o_size = src->o_size; - if (valid & OBD_MD_FLBLOCKS) /* allocation of space */ - dst->o_blocks = src->o_blocks; - if (valid & OBD_MD_FLBLKSZ) - dst->o_blksize = src->o_blksize; - if (valid & OBD_MD_FLTYPE) - dst->o_mode = (dst->o_mode & ~S_IFMT) | (src->o_mode & S_IFMT); - if (valid & OBD_MD_FLMODE) - dst->o_mode = (dst->o_mode & S_IFMT) | (src->o_mode & ~S_IFMT); - if (valid & OBD_MD_FLUID) - dst->o_uid = src->o_uid; - if (valid & OBD_MD_FLGID) - dst->o_gid = src->o_gid; - if (valid & OBD_MD_FLFLAGS) - dst->o_flags = src->o_flags; - if (valid & OBD_MD_FLFID) { - dst->o_parent_seq = src->o_parent_seq; - dst->o_parent_ver = src->o_parent_ver; - } - if (valid & OBD_MD_FLGENER) - dst->o_parent_oid = src->o_parent_oid; - if (valid & OBD_MD_FLHANDLE) - dst->o_handle = src->o_handle; - if (valid & OBD_MD_FLCOOKIE) - dst->o_lcookie = src->o_lcookie; - - dst->o_valid |= valid; -} -EXPORT_SYMBOL(obdo_cpy_md); - -/* returns FALSE if comparison (by flags) is same, TRUE if changed */ -int obdo_cmp_md(struct obdo *dst, struct obdo *src, u32 compare) -{ - int res = 0; - - if (compare & OBD_MD_FLATIME) - res |= dst->o_atime != src->o_atime; - if (compare & OBD_MD_FLMTIME) - res |= dst->o_mtime != src->o_mtime; - if (compare & OBD_MD_FLCTIME) - res |= dst->o_ctime != src->o_ctime; - if (compare & OBD_MD_FLSIZE) - res |= dst->o_size != src->o_size; - if (compare & OBD_MD_FLBLOCKS) /* allocation of space */ - res |= dst->o_blocks != src->o_blocks; - if (compare & OBD_MD_FLBLKSZ) - res |= dst->o_blksize != src->o_blksize; - if (compare & OBD_MD_FLTYPE) - res |= ((dst->o_mode ^ src->o_mode) & S_IFMT) != 0; - if (compare & OBD_MD_FLMODE) - res |= ((dst->o_mode ^ src->o_mode) & ~S_IFMT) != 0; - if (compare & OBD_MD_FLUID) - res |= dst->o_uid != src->o_uid; - if (compare & OBD_MD_FLGID) - res |= dst->o_gid != src->o_gid; - if (compare & OBD_MD_FLFLAGS) - res |= dst->o_flags != src->o_flags; - if (compare & OBD_MD_FLNLINK) - res |= dst->o_nlink != src->o_nlink; - if (compare & OBD_MD_FLFID) { - res |= dst->o_parent_seq != src->o_parent_seq; - res |= dst->o_parent_ver != src->o_parent_ver; - } - if (compare & OBD_MD_FLGENER) - res |= dst->o_parent_oid != src->o_parent_oid; - /* XXX Don't know if these should be included here - wasn't previously - if ( compare & OBD_MD_FLINLINE ) - res |= memcmp(dst->o_inline, src->o_inline); - */ - return res; -} -EXPORT_SYMBOL(obdo_cmp_md); - void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj) { ioobj->ioo_oid = oa->o_oi; @@ -211,42 +127,6 @@ void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj) } EXPORT_SYMBOL(obdo_to_ioobj); -void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int ia_valid) -{ - if (ia_valid & ATTR_ATIME) { - oa->o_atime = LTIME_S(attr->ia_atime); - oa->o_valid |= OBD_MD_FLATIME; - } - if (ia_valid & ATTR_MTIME) { - oa->o_mtime = LTIME_S(attr->ia_mtime); - oa->o_valid |= OBD_MD_FLMTIME; - } - if (ia_valid & ATTR_CTIME) { - oa->o_ctime = LTIME_S(attr->ia_ctime); - oa->o_valid |= OBD_MD_FLCTIME; - } - if (ia_valid & ATTR_SIZE) { - oa->o_size = attr->ia_size; - oa->o_valid |= OBD_MD_FLSIZE; - } - if (ia_valid & ATTR_MODE) { - oa->o_mode = attr->ia_mode; - oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE; - if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) && - !capable(CFS_CAP_FSETID)) - oa->o_mode &= ~S_ISGID; - } - if (ia_valid & ATTR_UID) { - oa->o_uid = from_kuid(&init_user_ns, attr->ia_uid); - oa->o_valid |= OBD_MD_FLUID; - } - if (ia_valid & ATTR_GID) { - oa->o_gid = from_kgid(&init_user_ns, attr->ia_gid); - oa->o_valid |= OBD_MD_FLGID; - } -} -EXPORT_SYMBOL(obdo_from_iattr); - void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid) { valid &= oa->o_valid; @@ -310,53 +190,3 @@ void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid) } } EXPORT_SYMBOL(md_from_obdo); - -void obdo_from_md(struct obdo *oa, struct md_op_data *op_data, - unsigned int valid) -{ - obdo_from_iattr(oa, &op_data->op_attr, valid); - if (valid & ATTR_BLOCKS) { - oa->o_blocks = op_data->op_attr_blocks; - oa->o_valid |= OBD_MD_FLBLOCKS; - } - if (valid & ATTR_ATTR_FLAG) { - oa->o_flags = - ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags; - oa->o_valid |= OBD_MD_FLFLAGS; - } -} -EXPORT_SYMBOL(obdo_from_md); - -void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo) -{ - dobdo->o_size = cpu_to_le64(sobdo->o_size); - dobdo->o_mtime = cpu_to_le64(sobdo->o_mtime); - dobdo->o_atime = cpu_to_le64(sobdo->o_atime); - dobdo->o_ctime = cpu_to_le64(sobdo->o_ctime); - dobdo->o_blocks = cpu_to_le64(sobdo->o_blocks); - dobdo->o_mode = cpu_to_le32(sobdo->o_mode); - dobdo->o_uid = cpu_to_le32(sobdo->o_uid); - dobdo->o_gid = cpu_to_le32(sobdo->o_gid); - dobdo->o_flags = cpu_to_le32(sobdo->o_flags); - dobdo->o_nlink = cpu_to_le32(sobdo->o_nlink); - dobdo->o_blksize = cpu_to_le32(sobdo->o_blksize); - dobdo->o_valid = cpu_to_le64(sobdo->o_valid); -} -EXPORT_SYMBOL(obdo_cpu_to_le); - -void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo) -{ - dobdo->o_size = le64_to_cpu(sobdo->o_size); - dobdo->o_mtime = le64_to_cpu(sobdo->o_mtime); - dobdo->o_atime = le64_to_cpu(sobdo->o_atime); - dobdo->o_ctime = le64_to_cpu(sobdo->o_ctime); - dobdo->o_blocks = le64_to_cpu(sobdo->o_blocks); - dobdo->o_mode = le32_to_cpu(sobdo->o_mode); - dobdo->o_uid = le32_to_cpu(sobdo->o_uid); - dobdo->o_gid = le32_to_cpu(sobdo->o_gid); - dobdo->o_flags = le32_to_cpu(sobdo->o_flags); - dobdo->o_nlink = le32_to_cpu(sobdo->o_nlink); - dobdo->o_blksize = le32_to_cpu(sobdo->o_blksize); - dobdo->o_valid = le64_to_cpu(sobdo->o_valid); -} -EXPORT_SYMBOL(obdo_le_to_cpu); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:01 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:01 -0400 Subject: [lustre-devel] [PATCH 18/29] staging/lustre: Drop unused obdo_from_la() and la_from_obdo() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-19-git-send-email-green@linuxhacker.ru> From: Oleg Drokin They are no longer used anywhere. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- .../lustre/lustre/obdclass/linux/linux-obdo.c | 137 --------------------- 1 file changed, 137 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c index 62ed706..9496c09 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c @@ -49,102 +49,6 @@ #include #include /* for PAGE_CACHE_SIZE */ -/*FIXME: Just copy from obdo_from_inode*/ -void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid) -{ - u32 newvalid = 0; - - if (valid & LA_ATIME) { - dst->o_atime = la->la_atime; - newvalid |= OBD_MD_FLATIME; - } - if (valid & LA_MTIME) { - dst->o_mtime = la->la_mtime; - newvalid |= OBD_MD_FLMTIME; - } - if (valid & LA_CTIME) { - dst->o_ctime = la->la_ctime; - newvalid |= OBD_MD_FLCTIME; - } - if (valid & LA_SIZE) { - dst->o_size = la->la_size; - newvalid |= OBD_MD_FLSIZE; - } - if (valid & LA_BLOCKS) { /* allocation of space (x512 bytes) */ - dst->o_blocks = la->la_blocks; - newvalid |= OBD_MD_FLBLOCKS; - } - if (valid & LA_TYPE) { - dst->o_mode = (dst->o_mode & S_IALLUGO) | - (la->la_mode & S_IFMT); - newvalid |= OBD_MD_FLTYPE; - } - if (valid & LA_MODE) { - dst->o_mode = (dst->o_mode & S_IFMT) | - (la->la_mode & S_IALLUGO); - newvalid |= OBD_MD_FLMODE; - } - if (valid & LA_UID) { - dst->o_uid = la->la_uid; - newvalid |= OBD_MD_FLUID; - } - if (valid & LA_GID) { - dst->o_gid = la->la_gid; - newvalid |= OBD_MD_FLGID; - } - dst->o_valid |= newvalid; -} -EXPORT_SYMBOL(obdo_from_la); - -/*FIXME: Just copy from obdo_from_inode*/ -void la_from_obdo(struct lu_attr *dst, struct obdo *obdo, u32 valid) -{ - __u64 newvalid = 0; - - valid &= obdo->o_valid; - - if (valid & OBD_MD_FLATIME) { - dst->la_atime = obdo->o_atime; - newvalid |= LA_ATIME; - } - if (valid & OBD_MD_FLMTIME) { - dst->la_mtime = obdo->o_mtime; - newvalid |= LA_MTIME; - } - if (valid & OBD_MD_FLCTIME) { - dst->la_ctime = obdo->o_ctime; - newvalid |= LA_CTIME; - } - if (valid & OBD_MD_FLSIZE) { - dst->la_size = obdo->o_size; - newvalid |= LA_SIZE; - } - if (valid & OBD_MD_FLBLOCKS) { - dst->la_blocks = obdo->o_blocks; - newvalid |= LA_BLOCKS; - } - if (valid & OBD_MD_FLTYPE) { - dst->la_mode = (dst->la_mode & S_IALLUGO) | - (obdo->o_mode & S_IFMT); - newvalid |= LA_TYPE; - } - if (valid & OBD_MD_FLMODE) { - dst->la_mode = (dst->la_mode & S_IFMT) | - (obdo->o_mode & S_IALLUGO); - newvalid |= LA_MODE; - } - if (valid & OBD_MD_FLUID) { - dst->la_uid = obdo->o_uid; - newvalid |= LA_UID; - } - if (valid & OBD_MD_FLGID) { - dst->la_gid = obdo->o_gid; - newvalid |= LA_GID; - } - dst->la_valid = newvalid; -} -EXPORT_SYMBOL(la_from_obdo); - void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid) { valid &= src->o_valid; @@ -179,44 +83,3 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid) dst->i_blocks = src->o_blocks; } EXPORT_SYMBOL(obdo_refresh_inode); - -void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid) -{ - valid &= src->o_valid; - - LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID | - OBD_MD_FLID | OBD_MD_FLGROUP)), - "object "DOSTID", valid %x\n", POSTID(&src->o_oi), valid); - - if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME)) - CDEBUG(D_INODE, - "valid %#llx, cur time %lu/%lu, new %llu/%llu\n", - src->o_valid, LTIME_S(dst->i_mtime), - LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime); - - if (valid & OBD_MD_FLATIME) - LTIME_S(dst->i_atime) = src->o_atime; - if (valid & OBD_MD_FLMTIME) - LTIME_S(dst->i_mtime) = src->o_mtime; - if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(dst->i_ctime)) - LTIME_S(dst->i_ctime) = src->o_ctime; - if (valid & OBD_MD_FLSIZE) - i_size_write(dst, src->o_size); - if (valid & OBD_MD_FLBLOCKS) { /* allocation of space */ - dst->i_blocks = src->o_blocks; - if (dst->i_blocks < src->o_blocks) /* overflow */ - dst->i_blocks = -1; - - } - if (valid & OBD_MD_FLBLKSZ) - dst->i_blkbits = ffs(src->o_blksize)-1; - if (valid & OBD_MD_FLMODE) - dst->i_mode = (dst->i_mode & S_IFMT) | (src->o_mode & ~S_IFMT); - if (valid & OBD_MD_FLUID) - dst->i_uid = make_kuid(&init_user_ns, src->o_uid); - if (valid & OBD_MD_FLGID) - dst->i_gid = make_kgid(&init_user_ns, src->o_gid); - if (valid & OBD_MD_FLFLAGS) - dst->i_flags = src->o_flags; -} -EXPORT_SYMBOL(obdo_to_inode); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:06 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:06 -0400 Subject: [lustre-devel] [PATCH 23/29] staging/lustre/fid: Get rid of lcs_srv in lu_client_seq In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-24-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Since we know lcs_srv is always NULL, just get rid of it completely and fix up all the code to assumee it was never there. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/fid/fid_request.c | 48 ++++++++-------------- drivers/staging/lustre/lustre/fid/lproc_fid.c | 2 - drivers/staging/lustre/lustre/include/lustre_fid.h | 5 --- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index ce55340..7c45e74 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -150,19 +150,15 @@ int seq_client_alloc_super(struct lu_client_seq *seq, mutex_lock(&seq->lcs_mutex); - if (seq->lcs_srv) { - rc = 0; - } else { - /* Check whether the connection to seq controller has been - * setup (lcs_exp != NULL) */ - if (seq->lcs_exp == NULL) { - mutex_unlock(&seq->lcs_mutex); - return -EINPROGRESS; - } - - rc = seq_client_rpc(seq, &seq->lcs_space, - SEQ_ALLOC_SUPER, "super"); + /* Check whether the connection to seq controller has been + * setup (lcs_exp != NULL) */ + if (!seq->lcs_exp) { + mutex_unlock(&seq->lcs_mutex); + return -EINPROGRESS; } + + rc = seq_client_rpc(seq, &seq->lcs_space, + SEQ_ALLOC_SUPER, "super"); mutex_unlock(&seq->lcs_mutex); return rc; } @@ -173,18 +169,14 @@ static int seq_client_alloc_meta(const struct lu_env *env, { int rc; - if (seq->lcs_srv) { - rc = 0; - } else { - do { - /* If meta server return -EINPROGRESS or EAGAIN, - * it means meta server might not be ready to - * allocate super sequence from sequence controller - * (MDT0)yet */ - rc = seq_client_rpc(seq, &seq->lcs_space, - SEQ_ALLOC_META, "meta"); - } while (rc == -EINPROGRESS || rc == -EAGAIN); - } + do { + /* If meta server return -EINPROGRESS or EAGAIN, + * it means meta server might not be ready to + * allocate super sequence from sequence controller + * (MDT0)yet */ + rc = seq_client_rpc(seq, &seq->lcs_space, + SEQ_ALLOC_META, "meta"); + } while (rc == -EINPROGRESS || rc == -EAGAIN); return rc; } @@ -395,8 +387,6 @@ static void seq_client_fini(struct lu_client_seq *seq) class_export_put(seq->lcs_exp); seq->lcs_exp = NULL; } - - seq->lcs_srv = NULL; } static int seq_client_init(struct lu_client_seq *seq, @@ -409,7 +399,6 @@ static int seq_client_init(struct lu_client_seq *seq, LASSERT(seq != NULL); LASSERT(prefix != NULL); - seq->lcs_srv = NULL; seq->lcs_type = type; mutex_init(&seq->lcs_mutex); @@ -422,10 +411,7 @@ static int seq_client_init(struct lu_client_seq *seq, /* Make sure that things are clear before work is started. */ seq_client_flush(seq); - if (exp != NULL) - seq->lcs_exp = class_export_get(exp); - else if (type == LUSTRE_SEQ_METADATA) - LASSERT(seq->lcs_srv != NULL); + seq->lcs_exp = class_export_get(exp); snprintf(seq->lcs_name, sizeof(seq->lcs_name), "cli-%s", prefix); diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index bf12723..ce90c1c 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -204,8 +204,6 @@ ldebugfs_fid_server_seq_show(struct seq_file *m, void *unused) if (seq->lcs_exp != NULL) { cli = &seq->lcs_exp->exp_obd->u.cli; seq_printf(m, "%s\n", cli->cl_target_uuid.uuid); - } else { - seq_printf(m, "%s\n", seq->lcs_srv->lss_name); } return 0; diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index 22fc96e..bbe3ff8 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -330,8 +330,6 @@ enum lu_mgr_type { LUSTRE_SEQ_CONTROLLER }; -struct lu_server_seq; - /* Client sequence manager interface. */ struct lu_client_seq { /* Sequence-controller export. */ @@ -366,9 +364,6 @@ struct lu_client_seq { */ __u64 lcs_width; - /* Seq-server for direct talking */ - struct lu_server_seq *lcs_srv; - /* wait queue for fid allocation and update indicator */ wait_queue_head_t lcs_waitq; int lcs_update; -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:57 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:57 -0400 Subject: [lustre-devel] [PATCH 14/29] staging/lustre: Remove unused function server_name2svname() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-15-git-send-email-green@linuxhacker.ru> From: Oleg Drokin All users are only in the server code Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/include/lustre_disk.h | 2 -- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 27 ---------------------- 2 files changed, 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h index ec33259..4178c85 100644 --- a/drivers/staging/lustre/lustre/include/lustre_disk.h +++ b/drivers/staging/lustre/lustre/include/lustre_disk.h @@ -385,8 +385,6 @@ struct lustre_mount_info { /* obd_mount.c */ int server_name2fsname(const char *svname, char *fsname, const char **endptr); int server_name2index(const char *svname, __u32 *idx, const char **endptr); -int server_name2svname(const char *label, char *svname, const char **endptr, - size_t svsize); int lustre_put_lsi(struct super_block *sb); int lustre_start_simple(char *obdname, char *type, char *uuid, diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 16009a6..bc15e15 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -599,33 +599,6 @@ int server_name2fsname(const char *svname, char *fsname, const char **endptr) } EXPORT_SYMBOL(server_name2fsname); -/** - * Get service name (svname) from string - * rc < 0 on error - * if endptr isn't NULL it is set to end of fsname * - */ -int server_name2svname(const char *label, char *svname, const char **endptr, - size_t svsize) -{ - int rc; - const char *dash; - - /* We use server_name2fsname() just for parsing */ - rc = server_name2fsname(label, NULL, &dash); - if (rc != 0) - return rc; - - if (endptr != NULL) - *endptr = dash; - - if (strlcpy(svname, dash + 1, svsize) >= svsize) - return -E2BIG; - - return 0; -} -EXPORT_SYMBOL(server_name2svname); - - /* Get the index from the obd name. rc = server type, or rc < 0 on error -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:59 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:59 -0400 Subject: [lustre-devel] [PATCH 16/29] staging/lustre/ptlrpc: Drop unused client code In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-17-git-send-email-green@linuxhacker.ru> From: Oleg Drokin These client request/import functions are not used anywhere, so drop them. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_net.h | 13 --- drivers/staging/lustre/lustre/ptlrpc/client.c | 95 ---------------------- drivers/staging/lustre/lustre/ptlrpc/import.c | 11 --- 3 files changed, 119 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 6df3e70..a486c1d 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -2356,22 +2356,17 @@ void ptlrpc_request_committed(struct ptlrpc_request *req, int force); void ptlrpc_init_client(int req_portal, int rep_portal, char *name, struct ptlrpc_client *); -void ptlrpc_cleanup_client(struct obd_import *imp); struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid); int ptlrpc_queue_wait(struct ptlrpc_request *req); int ptlrpc_replay_req(struct ptlrpc_request *req); int ptlrpc_unregister_reply(struct ptlrpc_request *req, int async); -void ptlrpc_restart_req(struct ptlrpc_request *req); void ptlrpc_abort_inflight(struct obd_import *imp); -void ptlrpc_cleanup_imp(struct obd_import *imp); void ptlrpc_abort_set(struct ptlrpc_request_set *set); struct ptlrpc_request_set *ptlrpc_prep_set(void); struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func, void *arg); -int ptlrpc_set_add_cb(struct ptlrpc_request_set *set, - set_interpreter_func fn, void *data); int ptlrpc_set_next_timeout(struct ptlrpc_request_set *); int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set); int ptlrpc_set_wait(struct ptlrpc_request_set *); @@ -2405,15 +2400,7 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp, int ptlrpc_request_bufs_pack(struct ptlrpc_request *request, __u32 version, int opcode, char **bufs, struct ptlrpc_cli_ctx *ctx); -struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version, - int opcode, int count, __u32 *lengths, - char **bufs); -struct ptlrpc_request *ptlrpc_prep_req_pool(struct obd_import *imp, - __u32 version, int opcode, - int count, __u32 *lengths, char **bufs, - struct ptlrpc_request_pool *pool); void ptlrpc_req_finished(struct ptlrpc_request *request); -void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request); struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req); struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req, unsigned npages, unsigned max_brw, diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index d013d4b..6aaa5dd 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -802,48 +802,6 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp, EXPORT_SYMBOL(ptlrpc_request_alloc_pack); /** - * Prepare request (fetched from pool \a pool if not NULL) on import \a imp - * for operation \a opcode. Request would contain \a count buffers. - * Sizes of buffers are described in array \a lengths and buffers themselves - * are provided by a pointer \a bufs. - * Returns prepared request structure pointer or NULL on error. - */ -struct ptlrpc_request * -ptlrpc_prep_req_pool(struct obd_import *imp, - __u32 version, int opcode, - int count, __u32 *lengths, char **bufs, - struct ptlrpc_request_pool *pool) -{ - struct ptlrpc_request *request; - int rc; - - request = __ptlrpc_request_alloc(imp, pool); - if (!request) - return NULL; - - rc = __ptlrpc_request_bufs_pack(request, version, opcode, count, - lengths, bufs, NULL); - if (rc) { - ptlrpc_request_free(request); - request = NULL; - } - return request; -} -EXPORT_SYMBOL(ptlrpc_prep_req_pool); - -/** - * Same as ptlrpc_prep_req_pool, but without pool - */ -struct ptlrpc_request * -ptlrpc_prep_req(struct obd_import *imp, __u32 version, int opcode, int count, - __u32 *lengths, char **bufs) -{ - return ptlrpc_prep_req_pool(imp, version, opcode, count, lengths, bufs, - NULL); -} -EXPORT_SYMBOL(ptlrpc_prep_req); - -/** * Allocate and initialize new request set structure on the current CPT. * Returns a pointer to the newly allocated set structure or NULL on error. */ @@ -959,28 +917,6 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set) EXPORT_SYMBOL(ptlrpc_set_destroy); /** - * Add a callback function \a fn to the set. - * This function would be called when all requests on this set are completed. - * The function will be passed \a data argument. - */ -int ptlrpc_set_add_cb(struct ptlrpc_request_set *set, - set_interpreter_func fn, void *data) -{ - struct ptlrpc_set_cbdata *cbdata; - - cbdata = kzalloc(sizeof(*cbdata), GFP_NOFS); - if (!cbdata) - return -ENOMEM; - - cbdata->psc_interpret = fn; - cbdata->psc_data = data; - list_add_tail(&cbdata->psc_item, &set->set_cblist); - - return 0; -} -EXPORT_SYMBOL(ptlrpc_set_add_cb); - -/** * Add a new request to the general purpose request set. * Assumes request reference from the caller. */ @@ -2282,18 +2218,6 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked) ptlrpc_request_cache_free(request); } -static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked); -/** - * Drop one request reference. Must be called with import imp_lock held. - * When reference count drops to zero, request is freed. - */ -void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request) -{ - assert_spin_locked(&request->rq_import->imp_lock); - (void)__ptlrpc_req_finished(request, 1); -} -EXPORT_SYMBOL(ptlrpc_req_finished_with_imp_lock); - /** * Helper function * Drops one reference count for request \a request. @@ -2535,11 +2459,6 @@ free_req: } } -void ptlrpc_cleanup_client(struct obd_import *imp) -{ -} -EXPORT_SYMBOL(ptlrpc_cleanup_client); - /** * Schedule previously sent request for resend. * For bulk requests we assign new xid (to avoid problems with @@ -2578,20 +2497,6 @@ void ptlrpc_resend_req(struct ptlrpc_request *req) } EXPORT_SYMBOL(ptlrpc_resend_req); -/* XXX: this function and rq_status are currently unused */ -void ptlrpc_restart_req(struct ptlrpc_request *req) -{ - DEBUG_REQ(D_HA, req, "restarting (possibly-)completed request"); - req->rq_status = -ERESTARTSYS; - - spin_lock(&req->rq_lock); - req->rq_restart = 1; - req->rq_timedout = 0; - ptlrpc_client_wake_req(req); - spin_unlock(&req->rq_lock); -} -EXPORT_SYMBOL(ptlrpc_restart_req); - /** * Grab additional reference on a request \a req */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 9ff1a22..1ac265d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -142,7 +142,6 @@ void deuuidify(char *uuid, const char *prefix, char **uuid_start, int *uuid_len) UUID_STR, strlen(UUID_STR))) *uuid_len -= strlen(UUID_STR); } -EXPORT_SYMBOL(deuuidify); /** * Returns true if import was FULL, false if import was already not @@ -1503,16 +1502,6 @@ out: } EXPORT_SYMBOL(ptlrpc_disconnect_import); -void ptlrpc_cleanup_imp(struct obd_import *imp) -{ - spin_lock(&imp->imp_lock); - IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_CLOSED); - imp->imp_generation++; - spin_unlock(&imp->imp_lock); - ptlrpc_abort_inflight(imp); -} -EXPORT_SYMBOL(ptlrpc_cleanup_imp); - /* Adaptive Timeout utils */ extern unsigned int at_min, at_max, at_history; -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:52 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:52 -0400 Subject: [lustre-devel] [PATCH 09/29] staging/lustre: Remove unused functions and definitions from cl_object In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-10-git-send-email-green@linuxhacker.ru> From: Oleg Drokin cl_object_header_fini, cl_object_has_locks, cl_attr2lvb, cl_page_list_own, cl_page_list_unmap, cl_2queue_assume, cl_io_print, cl_enqueue, also cleanup extern declarations in cl_object.h Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/cl_object.h | 26 --------- drivers/staging/lustre/lustre/obdclass/cl_io.c | 65 ---------------------- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 26 --------- drivers/staging/lustre/lustre/obdclass/cl_object.c | 41 -------------- 4 files changed, 158 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index b2366ca..b073313 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -2733,7 +2733,6 @@ struct cl_object *cl_object_find(const struct lu_env *env, struct cl_device *cd, const struct cl_object_conf *c); int cl_object_header_init(struct cl_object_header *h); -void cl_object_header_fini(struct cl_object_header *h); void cl_object_put (const struct lu_env *env, struct cl_object *o); void cl_object_get (struct cl_object *o); void cl_object_attr_lock (struct cl_object *o); @@ -2748,7 +2747,6 @@ int cl_conf_set (const struct lu_env *env, struct cl_object *obj, const struct cl_object_conf *conf); void cl_object_prune (const struct lu_env *env, struct cl_object *obj); void cl_object_kill (const struct lu_env *env, struct cl_object *obj); -int cl_object_has_locks (struct cl_object *obj); /** * Returns true, iff \a o0 and \a o1 are slices of the same object. @@ -2935,10 +2933,6 @@ void cl_lock_release (const struct lu_env *env, struct cl_lock *lock, void cl_lock_user_add (const struct lu_env *env, struct cl_lock *lock); void cl_lock_user_del (const struct lu_env *env, struct cl_lock *lock); -enum cl_lock_state cl_lock_intransit(const struct lu_env *env, - struct cl_lock *lock); -void cl_lock_extransit(const struct lu_env *env, struct cl_lock *lock, - enum cl_lock_state state); int cl_lock_is_intransit(struct cl_lock *lock); int cl_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock, @@ -2976,8 +2970,6 @@ int cl_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock, * * @{ */ -int cl_enqueue (const struct lu_env *env, struct cl_lock *lock, - struct cl_io *io, __u32 flags); int cl_wait (const struct lu_env *env, struct cl_lock *lock); void cl_unuse (const struct lu_env *env, struct cl_lock *lock); int cl_enqueue_try(const struct lu_env *env, struct cl_lock *lock, @@ -2996,7 +2988,6 @@ int cl_queue_match (const struct list_head *queue, const struct cl_lock_descr *need); void cl_lock_mutex_get (const struct lu_env *env, struct cl_lock *lock); -int cl_lock_mutex_try (const struct lu_env *env, struct cl_lock *lock); void cl_lock_mutex_put (const struct lu_env *env, struct cl_lock *lock); int cl_lock_is_mutexed (struct cl_lock *lock); int cl_lock_nr_mutexed (const struct lu_env *env); @@ -3062,10 +3053,6 @@ int cl_io_submit_rw (const struct lu_env *env, struct cl_io *io, int cl_io_submit_sync (const struct lu_env *env, struct cl_io *io, enum cl_req_type iot, struct cl_2queue *queue, long timeout); -void cl_io_rw_advance (const struct lu_env *env, struct cl_io *io, - size_t nob); -int cl_io_cancel (const struct lu_env *env, struct cl_io *io, - struct cl_page_list *queue); int cl_io_is_going (const struct lu_env *env); /** @@ -3097,9 +3084,6 @@ static inline int cl_io_is_trunc(const struct cl_io *io) struct cl_io *cl_io_top(struct cl_io *io); -void cl_io_print(const struct lu_env *env, void *cookie, - lu_printer_t printer, const struct cl_io *io); - #define CL_IO_SLICE_CLEAN(foo_io, base) \ do { \ typeof(foo_io) __foo_io = (foo_io); \ @@ -3145,22 +3129,14 @@ void cl_page_list_del (const struct lu_env *env, struct cl_page_list *plist, struct cl_page *page); void cl_page_list_disown (const struct lu_env *env, struct cl_io *io, struct cl_page_list *plist); -int cl_page_list_own (const struct lu_env *env, - struct cl_io *io, struct cl_page_list *plist); -void cl_page_list_assume (const struct lu_env *env, - struct cl_io *io, struct cl_page_list *plist); void cl_page_list_discard(const struct lu_env *env, struct cl_io *io, struct cl_page_list *plist); -int cl_page_list_unmap (const struct lu_env *env, - struct cl_io *io, struct cl_page_list *plist); void cl_page_list_fini (const struct lu_env *env, struct cl_page_list *plist); void cl_2queue_init (struct cl_2queue *queue); void cl_2queue_add (struct cl_2queue *queue, struct cl_page *page); void cl_2queue_disown (const struct lu_env *env, struct cl_io *io, struct cl_2queue *queue); -void cl_2queue_assume (const struct lu_env *env, - struct cl_io *io, struct cl_2queue *queue); void cl_2queue_discard (const struct lu_env *env, struct cl_io *io, struct cl_2queue *queue); void cl_2queue_fini (const struct lu_env *env, struct cl_2queue *queue); @@ -3253,7 +3229,6 @@ struct cl_env_nest { void *cen_cookie; }; -struct lu_env *cl_env_peek (int *refcheck); struct lu_env *cl_env_get (int *refcheck); struct lu_env *cl_env_alloc (int *refcheck, __u32 tags); struct lu_env *cl_env_nested_get (struct cl_env_nest *nest); @@ -3269,7 +3244,6 @@ void cl_env_unplant (struct lu_env *env, int *refcheck); /* * Misc */ -void cl_attr2lvb(struct ost_lvb *lvb, const struct cl_attr *attr); void cl_lvb2attr(struct cl_attr *attr, const struct ost_lvb *lvb); struct cl_device *cl_type_setup(const struct lu_env *env, struct lu_site *site, diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index da0066a..a822a0b 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -1181,32 +1181,6 @@ void cl_page_list_fini(const struct lu_env *env, struct cl_page_list *plist) EXPORT_SYMBOL(cl_page_list_fini); /** - * Owns all pages in a queue. - */ -int cl_page_list_own(const struct lu_env *env, - struct cl_io *io, struct cl_page_list *plist) -{ - struct cl_page *page; - struct cl_page *temp; - pgoff_t index = 0; - int result; - - LINVRNT(plist->pl_owner == current); - - result = 0; - cl_page_list_for_each_safe(page, temp, plist) { - LASSERT(index <= page->cp_index); - index = page->cp_index; - if (cl_page_own(env, io, page) == 0) - result = result ?: page->cp_error; - else - cl_page_list_del(env, plist, page); - } - return result; -} -EXPORT_SYMBOL(cl_page_list_own); - -/** * Assumes all pages in a queue. */ void cl_page_list_assume(const struct lu_env *env, @@ -1236,26 +1210,6 @@ void cl_page_list_discard(const struct lu_env *env, struct cl_io *io, EXPORT_SYMBOL(cl_page_list_discard); /** - * Unmaps all pages in a queue from user virtual memory. - */ -int cl_page_list_unmap(const struct lu_env *env, struct cl_io *io, - struct cl_page_list *plist) -{ - struct cl_page *page; - int result; - - LINVRNT(plist->pl_owner == current); - result = 0; - cl_page_list_for_each(page, plist) { - result = cl_page_unmap(env, io, page); - if (result != 0) - break; - } - return result; -} -EXPORT_SYMBOL(cl_page_list_unmap); - -/** * Initialize dual page queue. */ void cl_2queue_init(struct cl_2queue *queue) @@ -1297,17 +1251,6 @@ void cl_2queue_discard(const struct lu_env *env, EXPORT_SYMBOL(cl_2queue_discard); /** - * Assume to own the pages in cl_2queue - */ -void cl_2queue_assume(const struct lu_env *env, - struct cl_io *io, struct cl_2queue *queue) -{ - cl_page_list_assume(env, io, &queue->c2_qin); - cl_page_list_assume(env, io, &queue->c2_qout); -} -EXPORT_SYMBOL(cl_2queue_assume); - -/** * Finalize both page lists of a 2-queue. */ void cl_2queue_fini(const struct lu_env *env, struct cl_2queue *queue) @@ -1341,14 +1284,6 @@ struct cl_io *cl_io_top(struct cl_io *io) EXPORT_SYMBOL(cl_io_top); /** - * Prints human readable representation of \a io to the \a f. - */ -void cl_io_print(const struct lu_env *env, void *cookie, - lu_printer_t printer, const struct cl_io *io) -{ -} - -/** * Adds request slice to the compound request. * * This is called by cl_device_operations::cdo_req_init() methods to add a diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index 7c6583a..4294ca6 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -1276,32 +1276,6 @@ static int cl_enqueue_locked(const struct lu_env *env, struct cl_lock *lock, } /** - * Enqueues a lock. - * - * \pre current thread or io owns a hold on lock. - * - * \post ergo(result == 0, lock->users increased) - * \post ergo(result == 0, lock->cll_state == CLS_ENQUEUED || - * lock->cll_state == CLS_HELD) - */ -int cl_enqueue(const struct lu_env *env, struct cl_lock *lock, - struct cl_io *io, __u32 enqflags) -{ - int result; - - cl_lock_lockdep_acquire(env, lock, enqflags); - cl_lock_mutex_get(env, lock); - result = cl_enqueue_locked(env, lock, io, enqflags); - cl_lock_mutex_put(env, lock); - if (result != 0) - cl_lock_lockdep_release(env, lock); - LASSERT(ergo(result == 0, lock->cll_state == CLS_ENQUEUED || - lock->cll_state == CLS_HELD)); - return result; -} -EXPORT_SYMBOL(cl_enqueue); - -/** * Tries to unlock a lock. * * This function is called to release underlying resource: diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 05e29f8..89ff7f1 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -98,16 +98,6 @@ int cl_object_header_init(struct cl_object_header *h) EXPORT_SYMBOL(cl_object_header_init); /** - * Finalize cl_object_header. - */ -void cl_object_header_fini(struct cl_object_header *h) -{ - LASSERT(list_empty(&h->coh_locks)); - lu_object_header_fini(&h->coh_lu); -} -EXPORT_SYMBOL(cl_object_header_fini); - -/** * Returns a cl_object with a given \a fid. * * Returns either cached or newly created object. Additional reference on the @@ -363,22 +353,6 @@ void cl_object_prune(const struct lu_env *env, struct cl_object *obj) } EXPORT_SYMBOL(cl_object_prune); -/** - * Check if the object has locks. - */ -int cl_object_has_locks(struct cl_object *obj) -{ - struct cl_object_header *head = cl_object_header(obj); - int has; - - spin_lock(&head->coh_lock_guard); - has = list_empty(&head->coh_locks); - spin_unlock(&head->coh_lock_guard); - - return (has == 0); -} -EXPORT_SYMBOL(cl_object_has_locks); - void cache_stats_init(struct cache_stats *cs, const char *name) { int i; @@ -929,21 +903,6 @@ void cl_env_nested_put(struct cl_env_nest *nest, struct lu_env *env) EXPORT_SYMBOL(cl_env_nested_put); /** - * Converts struct cl_attr to struct ost_lvb. - * - * \see cl_lvb2attr - */ -void cl_attr2lvb(struct ost_lvb *lvb, const struct cl_attr *attr) -{ - lvb->lvb_size = attr->cat_size; - lvb->lvb_mtime = attr->cat_mtime; - lvb->lvb_atime = attr->cat_atime; - lvb->lvb_ctime = attr->cat_ctime; - lvb->lvb_blocks = attr->cat_blocks; -} -EXPORT_SYMBOL(cl_attr2lvb); - -/** * Converts struct ost_lvb to struct cl_attr. * * \see cl_attr2lvb -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:05 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:05 -0400 Subject: [lustre-devel] [PATCH 22/29] staging/lustre/fid: Remove unused seq_client_get_seq function In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-23-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Also while we are at it, remove seq_site_fini forward declaration as there's no such function anymore. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/fid/fid_request.c | 51 ---------------------- drivers/staging/lustre/lustre/include/lustre_fid.h | 3 -- 2 files changed, 54 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 16264bc..ce55340 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -248,57 +248,6 @@ static void seq_fid_alloc_fini(struct lu_client_seq *seq) wake_up(&seq->lcs_waitq); } -/** - * Allocate the whole seq to the caller. - **/ -int seq_client_get_seq(const struct lu_env *env, - struct lu_client_seq *seq, u64 *seqnr) -{ - wait_queue_t link; - int rc; - - LASSERT(seqnr != NULL); - mutex_lock(&seq->lcs_mutex); - init_waitqueue_entry(&link, current); - - while (1) { - rc = seq_fid_alloc_prep(seq, &link); - if (rc == 0) - break; - } - - rc = seq_client_alloc_seq(env, seq, seqnr); - if (rc) { - CERROR("%s: Can't allocate new sequence, rc %d\n", - seq->lcs_name, rc); - seq_fid_alloc_fini(seq); - mutex_unlock(&seq->lcs_mutex); - return rc; - } - - CDEBUG(D_INFO, "%s: allocate sequence [0x%16.16Lx]\n", - seq->lcs_name, *seqnr); - - /* Since the caller require the whole seq, - * so marked this seq to be used */ - if (seq->lcs_type == LUSTRE_SEQ_METADATA) - seq->lcs_fid.f_oid = LUSTRE_METADATA_SEQ_MAX_WIDTH; - else - seq->lcs_fid.f_oid = LUSTRE_DATA_SEQ_MAX_WIDTH; - - seq->lcs_fid.f_seq = *seqnr; - seq->lcs_fid.f_ver = 0; - /* - * Inform caller that sequence switch is performed to allow it - * to setup FLD for it. - */ - seq_fid_alloc_fini(seq); - mutex_unlock(&seq->lcs_mutex); - - return rc; -} -EXPORT_SYMBOL(seq_client_get_seq); - /* Allocate new fid on passed client @seq and save it to @fid. */ int seq_client_alloc_fid(const struct lu_env *env, struct lu_client_seq *seq, struct lu_fid *fid) diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index f60c20a..22fc96e 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -430,9 +430,6 @@ void seq_client_flush(struct lu_client_seq *seq); int seq_client_alloc_fid(const struct lu_env *env, struct lu_client_seq *seq, struct lu_fid *fid); -int seq_client_get_seq(const struct lu_env *env, struct lu_client_seq *seq, - u64 *seqnr); -int seq_site_fini(const struct lu_env *env, struct seq_server_site *ss); /* Fids common stuff */ int fid_is_local(const struct lu_env *env, struct lu_site *site, const struct lu_fid *fid); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:07 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:07 -0400 Subject: [lustre-devel] [PATCH 24/29] staging/lustre/fid: Remove unused struct lu_server_seq In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-25-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_fid.h | 51 ---------------------- 1 file changed, 51 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index bbe3ff8..19d9175 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -369,57 +369,6 @@ struct lu_client_seq { int lcs_update; }; -/* server sequence manager interface */ -struct lu_server_seq { - /* Available sequences space */ - struct lu_seq_range lss_space; - - /* keeps highwater in lsr_end for seq allocation algorithm */ - struct lu_seq_range lss_lowater_set; - struct lu_seq_range lss_hiwater_set; - - /* - * Device for server side seq manager needs (saving sequences to backing - * store). - */ - struct dt_device *lss_dev; - - /* LUSTRE_SEQ_SERVER or LUSTRE_SEQ_CONTROLLER */ - enum lu_mgr_type lss_type; - - /* Client interface to request controller */ - struct lu_client_seq *lss_cli; - - /* Mutex for protecting allocation */ - struct mutex lss_mutex; - - /* - * Service uuid, passed from MDT + seq name to form unique seq name to - * use it with procfs. - */ - char lss_name[LUSTRE_MDT_MAXNAMELEN]; - - /* - * Allocation chunks for super and meta sequences. Default values are - * LUSTRE_SEQ_SUPER_WIDTH and LUSTRE_SEQ_META_WIDTH. - */ - __u64 lss_width; - - /* - * minimum lss_alloc_set size that should be allocated from - * lss_space - */ - __u64 lss_set_width; - - /* sync is needed for update operation */ - __u32 lss_need_sync; - - /** - * Pointer to site object, required to access site fld. - */ - struct seq_server_site *lss_site; -}; - /* Client methods */ void seq_client_flush(struct lu_client_seq *seq); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:43:51 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:43:51 -0400 Subject: [lustre-devel] [PATCH 08/29] staging/lustre: Remove unused ptlrpcd_add_rqset() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-9-git-send-email-green@linuxhacker.ru> From: Oleg Drokin No point in retaining it if it's unused. Reported-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_net.h | 1 - drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 42 ---------------------- 2 files changed, 43 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 090484b..6df3e70 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -2902,7 +2902,6 @@ void ptlrpcd_stop(struct ptlrpcd_ctl *pc, int force); void ptlrpcd_free(struct ptlrpcd_ctl *pc); void ptlrpcd_wake(struct ptlrpc_request *req); void ptlrpcd_add_req(struct ptlrpc_request *req); -void ptlrpcd_add_rqset(struct ptlrpc_request_set *set); int ptlrpcd_addref(void); void ptlrpcd_decref(void); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 00efdbf..ce036a1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -196,48 +196,6 @@ ptlrpcd_select_pc(struct ptlrpc_request *req) } /** - * Move all request from an existing request set to the ptlrpcd queue. - * All requests from the set must be in phase RQ_PHASE_NEW. - */ -void ptlrpcd_add_rqset(struct ptlrpc_request_set *set) -{ - struct list_head *tmp, *pos; - struct ptlrpcd_ctl *pc; - struct ptlrpc_request_set *new; - int count, i; - - pc = ptlrpcd_select_pc(NULL); - new = pc->pc_set; - - list_for_each_safe(pos, tmp, &set->set_requests) { - struct ptlrpc_request *req = - list_entry(pos, struct ptlrpc_request, - rq_set_chain); - - LASSERT(req->rq_phase == RQ_PHASE_NEW); - req->rq_set = new; - req->rq_queued_time = cfs_time_current(); - } - - spin_lock(&new->set_new_req_lock); - list_splice_init(&set->set_requests, &new->set_new_requests); - i = atomic_read(&set->set_remaining); - count = atomic_add_return(i, &new->set_new_count); - atomic_set(&set->set_remaining, 0); - spin_unlock(&new->set_new_req_lock); - if (count == i) { - wake_up(&new->set_waitq); - - /* XXX: It maybe unnecessary to wakeup all the partners. But to - * guarantee the async RPC can be processed ASAP, we have - * no other better choice. It maybe fixed in future. */ - for (i = 0; i < pc->pc_npartners; i++) - wake_up(&pc->pc_partners[i]->pc_set->set_waitq); - } -} -EXPORT_SYMBOL(ptlrpcd_add_rqset); - -/** * Return transferred RPCs count. */ static int ptlrpcd_steal_rqset(struct ptlrpc_request_set *des, -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:04 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:04 -0400 Subject: [lustre-devel] [PATCH 21/29] staging/lustre/fid: seq_client_init/fini don't need to be exported In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-22-git-send-email-green@linuxhacker.ru> From: Oleg Drokin In fact they could be static as they are only used inside this file, so remove EXPORT_SYMBOL and declarations. Also seq_client_init is always called with srv = NULL, so just drop this argument. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/fid/fid_request.c | 39 ++++++++++------------ drivers/staging/lustre/lustre/include/lustre_fid.h | 8 ----- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index a16d577..16264bc 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -438,18 +438,29 @@ out_cleanup: return rc; } -int seq_client_init(struct lu_client_seq *seq, - struct obd_export *exp, - enum lu_cli_type type, - const char *prefix, - struct lu_server_seq *srv) +static void seq_client_fini(struct lu_client_seq *seq) +{ + seq_client_debugfs_fini(seq); + + if (seq->lcs_exp) { + class_export_put(seq->lcs_exp); + seq->lcs_exp = NULL; + } + + seq->lcs_srv = NULL; +} + +static int seq_client_init(struct lu_client_seq *seq, + struct obd_export *exp, + enum lu_cli_type type, + const char *prefix) { int rc; LASSERT(seq != NULL); LASSERT(prefix != NULL); - seq->lcs_srv = srv; + seq->lcs_srv = NULL; seq->lcs_type = type; mutex_init(&seq->lcs_mutex); @@ -475,20 +486,6 @@ int seq_client_init(struct lu_client_seq *seq, seq_client_fini(seq); return rc; } -EXPORT_SYMBOL(seq_client_init); - -void seq_client_fini(struct lu_client_seq *seq) -{ - seq_client_debugfs_fini(seq); - - if (seq->lcs_exp != NULL) { - class_export_put(seq->lcs_exp); - seq->lcs_exp = NULL; - } - - seq->lcs_srv = NULL; -} -EXPORT_SYMBOL(seq_client_fini); int client_fid_init(struct obd_device *obd, struct obd_export *exp, enum lu_cli_type type) @@ -510,7 +507,7 @@ int client_fid_init(struct obd_device *obd, snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name); /* Init client side sequence-manager */ - rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL); + rc = seq_client_init(cli->cl_seq, exp, type, prefix); kfree(prefix); if (rc) goto out_free_seq; diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index 1b50e66..f60c20a 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -426,14 +426,6 @@ struct lu_server_seq { }; /* Client methods */ -int seq_client_init(struct lu_client_seq *seq, - struct obd_export *exp, - enum lu_cli_type type, - const char *prefix, - struct lu_server_seq *srv); - -void seq_client_fini(struct lu_client_seq *seq); - void seq_client_flush(struct lu_client_seq *seq); int seq_client_alloc_fid(const struct lu_env *env, struct lu_client_seq *seq, -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:02 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:02 -0400 Subject: [lustre-devel] [PATCH 19/29] staging/lustre: remove lots of dead code In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-20-git-send-email-green@linuxhacker.ru> From: Arnd Bergmann This is a large patch to remove all dead code from obdclass and ptlrpc, purely removing functions and declarations now, so despite the size should be easy enough to verify. Signed-off-by: Arnd Bergmann Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 8 - .../lustre/lustre/include/lustre/lustre_user.h | 2 - .../staging/lustre/lustre/include/lustre_debug.h | 1 - .../staging/lustre/lustre/include/lustre_export.h | 1 - drivers/staging/lustre/lustre/include/lustre_net.h | 18 -- .../staging/lustre/lustre/include/lustre_param.h | 6 - .../lustre/lustre/include/lustre_req_layout.h | 4 - drivers/staging/lustre/lustre/include/obd_class.h | 16 -- drivers/staging/lustre/lustre/obdclass/debug.c | 10 - .../lustre/lustre/obdclass/linux/linux-sysctl.c | 4 - .../staging/lustre/lustre/obdclass/obd_config.c | 257 --------------------- drivers/staging/lustre/lustre/ptlrpc/layout.c | 64 ----- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 123 ---------- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 197 ---------------- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 18 -- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 2 - 16 files changed, 731 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 3ac1de3..9cc92bb 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2587,8 +2587,6 @@ struct lmv_desc { struct obd_uuid ld_uuid; }; -void lustre_swab_lmv_desc(struct lmv_desc *ld); - /* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */ struct lmv_stripe_md { __u32 mea_magic; @@ -2599,8 +2597,6 @@ struct lmv_stripe_md { struct lu_fid mea_ids[0]; }; -void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea); - /* lmv structures */ #define MEA_MAGIC_LAST_CHAR 0xb2221ca1 #define MEA_MAGIC_ALL_CHARS 0xb222a11c @@ -3442,8 +3438,6 @@ struct lu_idxpage { char lip_entries[0]; }; -void lustre_swab_lip_header(struct lu_idxpage *lip); - #define LIP_HDR_SIZE (offsetof(struct lu_idxpage, lip_entries)) /* Gather all possible type associated with a 4KB container */ @@ -3517,8 +3511,6 @@ struct lustre_capa_key { __u8 lk_key[CAPA_HMAC_KEY_MAX_LEN]; /**< key */ } __attribute__((packed)); -void lustre_swab_lustre_capa_key(struct lustre_capa_key *k); - /** The link ea holds 1 \a link_ea_entry for each hardlink */ #define LINK_EA_MAGIC 0x11EAF1DFUL struct link_ea_header { diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index e9925ef..1a41366 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -406,8 +406,6 @@ 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; diff --git a/drivers/staging/lustre/lustre/include/lustre_debug.h b/drivers/staging/lustre/lustre/include/lustre_debug.h index 6c92d0b..8a08941 100644 --- a/drivers/staging/lustre/lustre/include/lustre_debug.h +++ b/drivers/staging/lustre/lustre/include/lustre_debug.h @@ -46,7 +46,6 @@ #include "obd.h" /* lib/debug.c */ -void dump_lniobuf(struct niobuf_local *lnb); int dump_req(struct ptlrpc_request *req); int block_debug_setup(void *addr, int len, __u64 off, __u64 id); int block_debug_check(char *who, void *addr, int len, __u64 off, __u64 id); diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index c29bfdb..7634dea 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -353,7 +353,6 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp) } struct obd_export *class_conn2export(struct lustre_handle *conn); -struct obd_device *class_conn2obd(struct lustre_handle *conn); /** @} export */ diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index a486c1d..af3bf21 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -642,7 +642,6 @@ struct ptlrpc_nrs_pol_ops { * * \see ptlrpc_nrs_req_initialize() * \see ptlrpc_nrs_hpreq_add_nolock() - * \see ptlrpc_nrs_req_hp_move() */ int (*op_res_get) (struct ptlrpc_nrs_policy *policy, struct ptlrpc_nrs_request *nrq, @@ -658,7 +657,6 @@ struct ptlrpc_nrs_pol_ops { * * \see ptlrpc_nrs_req_finalize() * \see ptlrpc_nrs_hpreq_add_nolock() - * \see ptlrpc_nrs_req_hp_move() */ void (*op_res_put) (struct ptlrpc_nrs_policy *policy, const struct ptlrpc_nrs_resource *res); @@ -703,8 +701,6 @@ struct ptlrpc_nrs_pol_ops { * * \param[in,out] policy The policy the request \a nrq belongs to * \param[in,out] nrq The request to dequeue - * - * \see ptlrpc_nrs_req_del_nolock() */ void (*op_req_dequeue) (struct ptlrpc_nrs_policy *policy, struct ptlrpc_nrs_request *nrq); @@ -1536,10 +1532,6 @@ static inline int ptlrpc_req_interpret(const struct lu_env *env, * @{ */ int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf); -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf); -void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req); -void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, - struct ptlrpc_nrs_pol_info *info); /* * Can the request be moved from the regular NRS head to the high-priority NRS @@ -2522,7 +2514,6 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc); int ptlrpc_start_threads(struct ptlrpc_service *svc); int ptlrpc_unregister_service(struct ptlrpc_service *service); int liblustre_check_services(void *arg); -void ptlrpc_daemonize(char *name); void ptlrpc_server_drop_request(struct ptlrpc_request *req); int ptlrpc_hr_init(void); @@ -2558,7 +2549,6 @@ void ptlrpc_buf_set_swabbed(struct ptlrpc_request *req, const int inout, int ptlrpc_unpack_rep_msg(struct ptlrpc_request *req, int len); int ptlrpc_unpack_req_msg(struct ptlrpc_request *req, int len); -int lustre_msg_check_version(struct lustre_msg *msg, __u32 version); void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens, char **bufs); int lustre_pack_request(struct ptlrpc_request *, __u32 magic, int count, @@ -2582,7 +2572,6 @@ int lustre_msg_early_size(void); void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size); void *lustre_msg_buf(struct lustre_msg *m, int n, int minlen); int lustre_msg_buflen(struct lustre_msg *m, int n); -void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len); int lustre_msg_bufcount(struct lustre_msg *m); char *lustre_msg_string(struct lustre_msg *m, int n, int max_len); __u32 lustre_msghdr_get_flags(struct lustre_msg *msg); @@ -2595,10 +2584,8 @@ __u32 lustre_msg_get_op_flags(struct lustre_msg *msg); void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags); struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg); __u32 lustre_msg_get_type(struct lustre_msg *msg); -__u32 lustre_msg_get_version(struct lustre_msg *msg); void lustre_msg_add_version(struct lustre_msg *msg, int version); __u32 lustre_msg_get_opc(struct lustre_msg *msg); -__u64 lustre_msg_get_last_xid(struct lustre_msg *msg); __u64 lustre_msg_get_last_committed(struct lustre_msg *msg); __u64 *lustre_msg_get_versions(struct lustre_msg *msg); __u64 lustre_msg_get_transno(struct lustre_msg *msg); @@ -2611,21 +2598,16 @@ __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg); __u32 lustre_msg_get_magic(struct lustre_msg *msg); __u32 lustre_msg_get_timeout(struct lustre_msg *msg); __u32 lustre_msg_get_service_time(struct lustre_msg *msg); -char *lustre_msg_get_jobid(struct lustre_msg *msg); __u32 lustre_msg_get_cksum(struct lustre_msg *msg); __u32 lustre_msg_calc_cksum(struct lustre_msg *msg); void lustre_msg_set_handle(struct lustre_msg *msg, struct lustre_handle *handle); void lustre_msg_set_type(struct lustre_msg *msg, __u32 type); void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc); -void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid); -void lustre_msg_set_last_committed(struct lustre_msg *msg, - __u64 last_committed); void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions); void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno); void lustre_msg_set_status(struct lustre_msg *msg, __u32 status); void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt); -void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *sizes); void ptlrpc_request_set_replen(struct ptlrpc_request *req); void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout); void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time); diff --git a/drivers/staging/lustre/lustre/include/lustre_param.h b/drivers/staging/lustre/lustre/include/lustre_param.h index ed65468..de49b41 100644 --- a/drivers/staging/lustre/lustre/include/lustre_param.h +++ b/drivers/staging/lustre/lustre/include/lustre_param.h @@ -56,15 +56,9 @@ struct cfg_interop_param { /* obd_config.c */ int class_find_param(char *buf, char *key, char **valp); -struct cfg_interop_param *class_find_old_param(const char *param, - struct cfg_interop_param *ptr); -int class_get_next_param(char **params, char *copy); int class_match_param(char *buf, char *key, char **valp); int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh); int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh); -int class_parse_net(char *buf, __u32 *net, char **endh); -int class_match_nid(char *buf, char *key, lnet_nid_t nid); -int class_match_net(char *buf, char *key, __u32 net); /* obd_mount.c */ int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd, char *s1, char *s2, char *s3, char *s4); diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index 04c0076..cfcc995 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -80,8 +80,6 @@ void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req, void req_capsule_fini(struct req_capsule *pill); void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt); -void req_capsule_client_dump(struct req_capsule *pill); -void req_capsule_server_dump(struct req_capsule *pill); void req_capsule_init_area(struct req_capsule *pill); int req_capsule_filled_sizes(struct req_capsule *pill, enum req_location loc); int req_capsule_server_pack(struct req_capsule *pill); @@ -105,8 +103,6 @@ void *req_capsule_server_swab_get(struct req_capsule *pill, void *req_capsule_server_sized_swab_get(struct req_capsule *pill, const struct req_msg_field *field, int len, void *swabber); -const void *req_capsule_other_get(struct req_capsule *pill, - const struct req_msg_field *field); void req_capsule_set_size(struct req_capsule *pill, const struct req_msg_field *field, diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index b323403..73fb29f 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -106,8 +106,6 @@ struct llog_rec_hdr; typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *, struct llog_rec_hdr *, void *); /* obd_config.c */ -struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg, - const char *new_name); int class_process_config(struct lustre_cfg *lcfg); int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, struct lustre_cfg *lcfg, void *data); @@ -147,9 +145,6 @@ struct config_llog_instance { }; int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, char *name, struct config_llog_instance *cfg); -int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt, - char *name, struct config_llog_instance *cfg); - enum { CONFIG_T_CONFIG = 0, CONFIG_T_SPTLRPC = 1, @@ -285,22 +280,11 @@ static inline enum obd_option exp_flags_from_obd(struct obd_device *obd) struct inode; struct lu_attr; struct obdo; -void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid); -void la_from_obdo(struct lu_attr *la, struct obdo *dst, u32 valid); void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid); -void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid); -void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid); void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj); -void obdo_from_iattr(struct obdo *oa, struct iattr *attr, - unsigned int ia_valid); void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid); void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid); -void obdo_from_md(struct obdo *oa, struct md_op_data *op_data, - unsigned int valid); - -void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo); -void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo); #define OBT(dev) (dev)->obd_type #define OBP(dev, op) (dev)->obd_type->typ_dt_ops->o_ ## op diff --git a/drivers/staging/lustre/lustre/obdclass/debug.c b/drivers/staging/lustre/lustre/obdclass/debug.c index c61add4..43a7f7a 100644 --- a/drivers/staging/lustre/lustre/obdclass/debug.c +++ b/drivers/staging/lustre/lustre/obdclass/debug.c @@ -46,16 +46,6 @@ #include "../include/lustre_debug.h" #include "../include/lustre_net.h" -void dump_lniobuf(struct niobuf_local *nb) -{ - CDEBUG(D_RPCTRACE, - "niobuf_local: file_offset=%lld, len=%d, page=%p, rc=%d\n", - nb->lnb_file_offset, nb->len, nb->page, nb->rc); - CDEBUG(D_RPCTRACE, "nb->page: index = %ld\n", - nb->page ? page_index(nb->page) : -1); -} -EXPORT_SYMBOL(dump_lniobuf); - #define LPDS sizeof(__u64) int block_debug_setup(void *addr, int len, __u64 off, __u64 id) { diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index 1515163..518288d 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -162,7 +162,3 @@ int obd_sysctl_init(void) { return sysfs_create_group(lustre_kobj, &lustre_attr_group); } - -void obd_sysctl_clean(void) -{ -} diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index d19cbf6..a8a1cb7 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -71,114 +71,6 @@ int class_find_param(char *buf, char *key, char **valp) } EXPORT_SYMBOL(class_find_param); -/** - * Check whether the proc parameter \a param is an old parameter or not from - * the array \a ptr which contains the mapping from old parameters to new ones. - * If it's an old one, then return the pointer to the cfg_interop_param struc- - * ture which contains both the old and new parameters. - * - * \param param proc parameter - * \param ptr an array which contains the mapping from - * old parameters to new ones - * - * \retval valid-pointer pointer to the cfg_interop_param structure - * which contains the old and new parameters - * \retval NULL \a param or \a ptr is NULL, - * or \a param is not an old parameter - */ -struct cfg_interop_param *class_find_old_param(const char *param, - struct cfg_interop_param *ptr) -{ - char *value = NULL; - int name_len = 0; - - if (!param || !ptr) - return NULL; - - value = strchr(param, '='); - if (!value) - name_len = strlen(param); - else - name_len = value - param; - - while (ptr->old_param != NULL) { - if (strncmp(param, ptr->old_param, name_len) == 0 && - name_len == strlen(ptr->old_param)) - return ptr; - ptr++; - } - - return NULL; -} -EXPORT_SYMBOL(class_find_old_param); - -/** - * Finds a parameter in \a params and copies it to \a copy. - * - * Leading spaces are skipped. Next space or end of string is the - * parameter terminator with the exception that spaces inside single or double - * quotes get included into a parameter. The parameter is copied into \a copy - * which has to be allocated big enough by a caller, quotes are stripped in - * the copy and the copy is terminated by 0. - * - * On return \a params is set to next parameter or to NULL if last - * parameter is returned. - * - * \retval 0 if parameter is returned in \a copy - * \retval 1 otherwise - * \retval -EINVAL if unbalanced quota is found - */ -int class_get_next_param(char **params, char *copy) -{ - char *q1, *q2, *str; - int len; - - str = *params; - while (*str == ' ') - str++; - - if (*str == '\0') { - *params = NULL; - return 1; - } - - while (1) { - q1 = strpbrk(str, " '\""); - if (!q1) { - len = strlen(str); - memcpy(copy, str, len); - copy[len] = '\0'; - *params = NULL; - return 0; - } - len = q1 - str; - if (*q1 == ' ') { - memcpy(copy, str, len); - copy[len] = '\0'; - *params = str + len; - return 0; - } - - memcpy(copy, str, len); - copy += len; - - /* search for the matching closing quote */ - str = q1 + 1; - q2 = strchr(str, *q1); - if (!q2) { - CERROR("Unbalanced quota in parameters: \"%s\"\n", - *params); - return -EINVAL; - } - len = q2 - str; - memcpy(copy, str, len); - copy += len; - str = q2 + 1; - } - return 1; -} -EXPORT_SYMBOL(class_get_next_param); - /* returns 0 if this is the first key in the buffer, else 1. valp points to first char after key. */ int class_match_param(char *buf, char *key, char **valp) @@ -278,52 +170,6 @@ int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh) } EXPORT_SYMBOL(class_parse_nid_quiet); -int class_parse_net(char *buf, __u32 *net, char **endh) -{ - return class_parse_value(buf, CLASS_PARSE_NET, (void *)net, endh, 0); -} -EXPORT_SYMBOL(class_parse_net); - -/* 1 param contains key and match - * 0 param contains key and not match - * -1 param does not contain key - */ -int class_match_nid(char *buf, char *key, lnet_nid_t nid) -{ - lnet_nid_t tmp; - int rc = -1; - - while (class_find_param(buf, key, &buf) == 0) { - /* please restrict to the nids pertaining to - * the specified nids */ - while (class_parse_nid(buf, &tmp, &buf) == 0) { - if (tmp == nid) - return 1; - } - rc = 0; - } - return rc; -} -EXPORT_SYMBOL(class_match_nid); - -int class_match_net(char *buf, char *key, __u32 net) -{ - __u32 tmp; - int rc = -1; - - while (class_find_param(buf, key, &buf) == 0) { - /* please restrict to the nids pertaining to - * the specified networks */ - while (class_parse_net(buf, &tmp, &buf) == 0) { - if (tmp == net) - return 1; - } - rc = 0; - } - return rc; -} -EXPORT_SYMBOL(class_match_net); - /********************** class fns **********************/ /** @@ -925,78 +771,6 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg)) } EXPORT_SYMBOL(lustre_register_client_process_config); -/** - * Rename the proc parameter in \a cfg with a new name \a new_name. - * - * \param cfg config structure which contains the proc parameter - * \param new_name new name of the proc parameter - * - * \retval valid-pointer pointer to the newly-allocated config structure - * which contains the renamed proc parameter - * \retval ERR_PTR(-EINVAL) if \a cfg or \a new_name is NULL, or \a cfg does - * not contain a proc parameter - * \retval ERR_PTR(-ENOMEM) if memory allocation failure occurs - */ -struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg, - const char *new_name) -{ - struct lustre_cfg_bufs *bufs = NULL; - struct lustre_cfg *new_cfg = NULL; - char *param = NULL; - char *new_param = NULL; - char *value = NULL; - int name_len = 0; - int new_len = 0; - - if (!cfg || !new_name) - return ERR_PTR(-EINVAL); - - param = lustre_cfg_string(cfg, 1); - if (!param) - return ERR_PTR(-EINVAL); - - value = strchr(param, '='); - if (!value) - name_len = strlen(param); - else - name_len = value - param; - - new_len = LUSTRE_CFG_BUFLEN(cfg, 1) + strlen(new_name) - name_len; - - new_param = kzalloc(new_len, GFP_NOFS); - if (!new_param) - return ERR_PTR(-ENOMEM); - - strcpy(new_param, new_name); - if (value != NULL) - strcat(new_param, value); - - bufs = kzalloc(sizeof(*bufs), GFP_NOFS); - if (!bufs) { - kfree(new_param); - return ERR_PTR(-ENOMEM); - } - - lustre_cfg_bufs_reset(bufs, NULL); - lustre_cfg_bufs_init(bufs, cfg); - lustre_cfg_bufs_set_string(bufs, 1, new_param); - - new_cfg = lustre_cfg_new(cfg->lcfg_command, bufs); - - kfree(new_param); - kfree(bufs); - if (!new_cfg) - return ERR_PTR(-ENOMEM); - - new_cfg->lcfg_num = cfg->lcfg_num; - new_cfg->lcfg_flags = cfg->lcfg_flags; - new_cfg->lcfg_nid = cfg->lcfg_nid; - new_cfg->lcfg_nal = cfg->lcfg_nal; - - return new_cfg; -} -EXPORT_SYMBOL(lustre_cfg_rename); - static int process_param2_config(struct lustre_cfg *lcfg) { char *param = lustre_cfg_string(lcfg, 1); @@ -1037,12 +811,6 @@ static int process_param2_config(struct lustre_cfg *lcfg) return rc; } -void lustre_register_quota_process_config(int (*qpc)(struct lustre_cfg *lcfg)) -{ - quota_process_config = qpc; -} -EXPORT_SYMBOL(lustre_register_quota_process_config); - /** Process configuration commands given in lustre_cfg form. * These may come from direct calls (e.g. class_manual_cleanup) * or processing the config llog, or ioctl from lctl. @@ -1633,31 +1401,6 @@ int class_config_dump_handler(const struct lu_env *env, return rc; } -int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt, - char *name, struct config_llog_instance *cfg) -{ - struct llog_handle *llh; - int rc; - - LCONSOLE_INFO("Dumping config log %s\n", name); - - rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS); - if (rc) - return rc; - - rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL); - if (rc) - goto parse_out; - - rc = llog_process(env, llh, class_config_dump_handler, cfg, NULL); -parse_out: - llog_close(env, llh); - - LCONSOLE_INFO("End config log %s\n", name); - return rc; -} -EXPORT_SYMBOL(class_config_dump_llog); - /** Call class_cleanup and class_detach. * "Manual" only in the sense that we're faking lcfg commands. */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 4ddbe0d..991fb74 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1996,55 +1996,6 @@ static void *__req_capsule_get(struct req_capsule *pill, } /** - * Dump a request and/or reply - */ -static void __req_capsule_dump(struct req_capsule *pill, enum req_location loc) -{ - const struct req_format *fmt; - const struct req_msg_field *field; - int len; - int i; - - fmt = pill->rc_fmt; - - DEBUG_REQ(D_RPCTRACE, pill->rc_req, "BEGIN REQ CAPSULE DUMP\n"); - for (i = 0; i < fmt->rf_fields[loc].nr; ++i) { - field = FMT_FIELD(fmt, loc, i); - if (field->rmf_dumper == NULL) { - /* - * FIXME Add a default hex dumper for fields that don't - * have a specific dumper - */ - len = req_capsule_get_size(pill, field, loc); - CDEBUG(D_RPCTRACE, "Field %s has no dumper function; field size is %d\n", - field->rmf_name, len); - } else { - /* It's the dumping side-effect that we're interested in */ - (void) __req_capsule_get(pill, field, loc, NULL, 1); - } - } - CDEBUG(D_RPCTRACE, "END REQ CAPSULE DUMP\n"); -} - -/** - * Dump a request. - */ -void req_capsule_client_dump(struct req_capsule *pill) -{ - __req_capsule_dump(pill, RCL_CLIENT); -} -EXPORT_SYMBOL(req_capsule_client_dump); - -/** - * Dump a reply - */ -void req_capsule_server_dump(struct req_capsule *pill) -{ - __req_capsule_dump(pill, RCL_SERVER); -} -EXPORT_SYMBOL(req_capsule_server_dump); - -/** * Trivial wrapper around __req_capsule_get(), that returns the PTLRPC request * buffer corresponding to the given RMF (\a field) of a \a pill. */ @@ -2136,21 +2087,6 @@ void *req_capsule_server_sized_swab_get(struct req_capsule *pill, EXPORT_SYMBOL(req_capsule_server_sized_swab_get); /** - * Returns the buffer of a \a pill corresponding to the given \a field from the - * request (if the caller is executing on the server-side) or reply (if the - * caller is executing on the client-side). - * - * This function convenient for use is code that could be executed on the - * client and server alike. - */ -const void *req_capsule_other_get(struct req_capsule *pill, - const struct req_msg_field *field) -{ - return __req_capsule_get(pill, field, pill->rc_loc ^ 1, NULL, 0); -} -EXPORT_SYMBOL(req_capsule_other_get); - -/** * Set the size of the PTLRPC request/reply (\a loc) buffer for the given \a * field of the given \a pill. * diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 40696f3..2476cf2 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -477,7 +477,6 @@ static void nrs_resource_get_safe(struct ptlrpc_nrs *nrs, * * \param resp the resource hierarchy that is being released * - * \see ptlrpc_nrs_req_hp_move() * \see ptlrpc_nrs_req_finalize() */ static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp) @@ -1251,70 +1250,6 @@ fail: EXPORT_SYMBOL(ptlrpc_nrs_policy_register); /** - * Unregisters a previously registered policy with NRS core. All instances of - * the policy on all NRS heads of all supported services are removed. - * - * N.B. This function should only be called from a module's exit() function. - * Although it can be used for policies that ship alongside NRS core, the - * function is primarily intended for policies that register externally, - * from other modules. - * - * \param[in] conf configuration information for the policy to unregister - * - * \retval -ve error - * \retval 0 success - */ -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf) -{ - struct ptlrpc_nrs_pol_desc *desc; - int rc; - - LASSERT(conf != NULL); - - if (conf->nc_flags & PTLRPC_NRS_FL_FALLBACK) { - CERROR("Unable to unregister a fallback policy, unless the PTLRPC service is stopping.\n"); - return -EPERM; - } - - conf->nc_name[NRS_POL_NAME_MAX - 1] = '\0'; - - mutex_lock(&nrs_core.nrs_mutex); - - desc = nrs_policy_find_desc_locked(conf->nc_name); - if (desc == NULL) { - CERROR("Failing to unregister NRS policy %s which has not been registered with NRS core!\n", - conf->nc_name); - rc = -ENOENT; - goto not_exist; - } - - mutex_lock(&ptlrpc_all_services_mutex); - - rc = nrs_policy_unregister_locked(desc); - if (rc < 0) { - if (rc == -EBUSY) - CERROR("Please first stop policy %s on all service partitions and then retry to unregister the policy.\n", - conf->nc_name); - goto fail; - } - - CDEBUG(D_INFO, "Unregistering policy %s from NRS core.\n", - conf->nc_name); - - list_del(&desc->pd_list); - kfree(desc); - -fail: - mutex_unlock(&ptlrpc_all_services_mutex); - -not_exist: - mutex_unlock(&nrs_core.nrs_mutex); - - return rc; -} -EXPORT_SYMBOL(ptlrpc_nrs_policy_unregister); - -/** * Setup NRS heads on all service partitions of service \a svc, and register * all compatible policies on those NRS heads. * @@ -1553,22 +1488,6 @@ ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, } /** - * Dequeues request \a req from the policy it has been enqueued on. - * - * \param[in] req the request - */ -void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req) -{ - struct ptlrpc_nrs_policy *policy = nrs_request_policy(&req->rq_nrq); - - policy->pol_desc->pd_ops->op_req_dequeue(policy, &req->rq_nrq); - - req->rq_nrq.nr_enqueued = 0; - - nrs_request_removed(policy); -} - -/** * Returns whether there are any requests currently enqueued on any of the * policies of service partition's \a svcpt NRS head specified by \a hp. Should * be called while holding ptlrpc_service_part::scp_req_lock to get a reliable @@ -1589,48 +1508,6 @@ bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp) }; /** - * Moves request \a req from the regular to the high-priority NRS head. - * - * \param[in] req the request to move - */ -void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req) -{ - struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; - struct ptlrpc_nrs_request *nrq = &req->rq_nrq; - struct ptlrpc_nrs_resource *res1[NRS_RES_MAX]; - struct ptlrpc_nrs_resource *res2[NRS_RES_MAX]; - - /** - * Obtain the high-priority NRS head resources. - */ - nrs_resource_get_safe(nrs_svcpt2nrs(svcpt, true), nrq, res1, true); - - spin_lock(&svcpt->scp_req_lock); - - if (!ptlrpc_nrs_req_can_move(req)) - goto out; - - ptlrpc_nrs_req_del_nolock(req); - - memcpy(res2, nrq->nr_res_ptrs, NRS_RES_MAX * sizeof(res2[0])); - memcpy(nrq->nr_res_ptrs, res1, NRS_RES_MAX * sizeof(res1[0])); - - ptlrpc_nrs_hpreq_add_nolock(req); - - memcpy(res1, res2, NRS_RES_MAX * sizeof(res1[0])); -out: - spin_unlock(&svcpt->scp_req_lock); - - /** - * Release either the regular NRS head resources if we moved the - * request, or the high-priority NRS head resources if we took a - * reference earlier in this function and ptlrpc_nrs_req_can_move() - * returned false. - */ - nrs_resource_put_safe(res1); -} - -/** * Carries out a control operation \a opc on the policy identified by the * human-readable \a name, on either all partitions, or only on the first * partition of service \a svc. diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 9402fb9..3241b1f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -94,30 +94,6 @@ int ptlrpc_buf_need_swab(struct ptlrpc_request *req, const int inout, } EXPORT_SYMBOL(ptlrpc_buf_need_swab); -static inline int lustre_msg_check_version_v2(struct lustre_msg_v2 *msg, - __u32 version) -{ - __u32 ver = lustre_msg_get_version(msg); - return (ver & LUSTRE_VERSION_MASK) != version; -} - -int lustre_msg_check_version(struct lustre_msg *msg, __u32 version) -{ -#define LUSTRE_MSG_MAGIC_V1 0x0BD00BD0 - switch (msg->lm_magic) { - case LUSTRE_MSG_MAGIC_V1: - CERROR("msg v1 not supported - please upgrade you system\n"); - return -EINVAL; - case LUSTRE_MSG_MAGIC_V2: - return lustre_msg_check_version_v2(msg, version); - default: - CERROR("incorrect message magic: %08x\n", msg->lm_magic); - return 0; - } -#undef LUSTRE_MSG_MAGIC_V1 -} -EXPORT_SYMBOL(lustre_msg_check_version); - /* early reply size */ int lustre_msg_early_size(void) { @@ -695,28 +671,6 @@ int lustre_msg_buflen(struct lustre_msg *m, int n) } EXPORT_SYMBOL(lustre_msg_buflen); -static inline void -lustre_msg_set_buflen_v2(struct lustre_msg_v2 *m, int n, int len) -{ - if (n >= m->lm_bufcount) - LBUG(); - - m->lm_buflens[n] = len; -} - -void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len) -{ - switch (m->lm_magic) { - case LUSTRE_MSG_MAGIC_V2: - lustre_msg_set_buflen_v2(m, n, len); - return; - default: - LASSERTF(0, "incorrect message magic: %08x\n", m->lm_magic); - } -} - -EXPORT_SYMBOL(lustre_msg_set_buflen); - /* NB return the bufcount for lustre_msg_v2 format, so if message is packed * in V1 format, the result is one bigger. (add struct ptlrpc_body). */ int lustre_msg_bufcount(struct lustre_msg *m) @@ -958,24 +912,6 @@ __u32 lustre_msg_get_type(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_type); -__u32 lustre_msg_get_version(struct lustre_msg *msg) -{ - switch (msg->lm_magic) { - case LUSTRE_MSG_MAGIC_V2: { - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg); - if (!pb) { - CERROR("invalid msg %p: no ptlrpc body!\n", msg); - return 0; - } - return pb->pb_version; - } - default: - CERROR("incorrect message magic: %08x\n", msg->lm_magic); - return 0; - } -} -EXPORT_SYMBOL(lustre_msg_get_version); - void lustre_msg_add_version(struct lustre_msg *msg, int version) { switch (msg->lm_magic) { @@ -1010,24 +946,6 @@ __u32 lustre_msg_get_opc(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_opc); -__u64 lustre_msg_get_last_xid(struct lustre_msg *msg) -{ - switch (msg->lm_magic) { - case LUSTRE_MSG_MAGIC_V2: { - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg); - if (!pb) { - CERROR("invalid msg %p: no ptlrpc body!\n", msg); - return 0; - } - return pb->pb_last_xid; - } - default: - CERROR("incorrect message magic: %08x\n", msg->lm_magic); - return 0; - } -} -EXPORT_SYMBOL(lustre_msg_get_last_xid); - __u64 lustre_msg_get_last_committed(struct lustre_msg *msg) { switch (msg->lm_magic) { @@ -1243,25 +1161,6 @@ __u32 lustre_msg_get_service_time(struct lustre_msg *msg) } } -char *lustre_msg_get_jobid(struct lustre_msg *msg) -{ - switch (msg->lm_magic) { - case LUSTRE_MSG_MAGIC_V2: { - struct ptlrpc_body *pb = - lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, - sizeof(struct ptlrpc_body)); - if (!pb) - return NULL; - - return pb->pb_jobid; - } - default: - CERROR("incorrect message magic: %08x\n", msg->lm_magic); - return NULL; - } -} -EXPORT_SYMBOL(lustre_msg_get_jobid); - __u32 lustre_msg_get_cksum(struct lustre_msg *msg) { switch (msg->lm_magic) { @@ -1336,36 +1235,6 @@ void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc) } EXPORT_SYMBOL(lustre_msg_set_opc); -void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid) -{ - switch (msg->lm_magic) { - case LUSTRE_MSG_MAGIC_V2: { - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg); - LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg); - pb->pb_last_xid = last_xid; - return; - } - default: - LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic); - } -} -EXPORT_SYMBOL(lustre_msg_set_last_xid); - -void lustre_msg_set_last_committed(struct lustre_msg *msg, __u64 last_committed) -{ - switch (msg->lm_magic) { - case LUSTRE_MSG_MAGIC_V2: { - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg); - LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg); - pb->pb_last_committed = last_committed; - return; - } - default: - LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic); - } -} -EXPORT_SYMBOL(lustre_msg_set_last_committed); - void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions) { switch (msg->lm_magic) { @@ -1509,14 +1378,6 @@ void ptlrpc_request_set_replen(struct ptlrpc_request *req) } EXPORT_SYMBOL(ptlrpc_request_set_replen); -void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *lens) -{ - req->rq_replen = lustre_msg_size(req->rq_reqmsg->lm_magic, count, lens); - if (req->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V2) - req->rq_reqmsg->lm_repsize = req->rq_replen; -} -EXPORT_SYMBOL(ptlrpc_req_set_repsize); - /** * Send a remote set_info_async. * @@ -1968,15 +1829,6 @@ void lustre_swab_idx_info(struct idx_info *ii) __swab16s(&ii->ii_recsize); } -void lustre_swab_lip_header(struct lu_idxpage *lip) -{ - /* swab header */ - __swab32s(&lip->lip_magic); - __swab16s(&lip->lip_flags); - __swab16s(&lip->lip_nr); -} -EXPORT_SYMBOL(lustre_swab_lip_header); - void lustre_swab_mdt_rec_reint (struct mdt_rec_reint *rr) { __swab32s(&rr->rr_opcode); @@ -2019,46 +1871,6 @@ void lustre_swab_lov_desc(struct lov_desc *ld) } EXPORT_SYMBOL(lustre_swab_lov_desc); -void lustre_swab_lmv_desc(struct lmv_desc *ld) -{ - __swab32s(&ld->ld_tgt_count); - __swab32s(&ld->ld_active_tgt_count); - __swab32s(&ld->ld_default_stripe_count); - __swab32s(&ld->ld_pattern); - __swab64s(&ld->ld_default_hash_size); - __swab32s(&ld->ld_qos_maxage); - /* uuid endian insensitive */ -} - -void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea) -{ - __swab32s(&mea->mea_magic); - __swab32s(&mea->mea_count); - __swab32s(&mea->mea_master); - CLASSERT(offsetof(typeof(*mea), mea_padding) != 0); -} - -void lustre_swab_lmv_user_md(struct lmv_user_md *lum) -{ - int i; - - __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) != 0); - CLASSERT(offsetof(typeof(*lum), lum_padding2) != 0); - CLASSERT(offsetof(typeof(*lum), lum_padding3) != 0); - - for (i = 0; i < lum->lum_stripe_count; i++) { - __swab32s(&lum->lum_objects[i].lum_mds); - lustre_swab_lu_fid(&lum->lum_objects[i].lum_fid); - } - -} -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); @@ -2282,7 +2094,6 @@ void dump_obdo(struct obdo *oa) if (valid & OBD_MD_FLCOOKIE) CDEBUG(D_RPCTRACE, "obdo: o_lcookie = (llog_cookie dumping not yet implemented)\n"); } -EXPORT_SYMBOL(dump_obdo); void dump_ost_body(struct ost_body *ob) { @@ -2381,14 +2192,6 @@ void lustre_swab_lustre_capa(struct lustre_capa *c) } EXPORT_SYMBOL(lustre_swab_lustre_capa); -void lustre_swab_lustre_capa_key(struct lustre_capa_key *k) -{ - __swab64s(&k->lk_seq); - __swab32s(&k->lk_keyid); - CLASSERT(offsetof(typeof(*k), lk_padding) != 0); -} -EXPORT_SYMBOL(lustre_swab_lustre_capa_key); - void lustre_swab_hsm_user_state(struct hsm_user_state *state) { __swab32s(&state->hus_states); diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 4706174..74fab7e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -44,20 +44,10 @@ #include "../include/obd_class.h" #include "ptlrpc_internal.h" -static int suppress_pings; -module_param(suppress_pings, int, 0644); -MODULE_PARM_DESC(suppress_pings, "Suppress pings"); - struct mutex pinger_mutex; static LIST_HEAD(pinger_imports); static struct list_head timeout_list = LIST_HEAD_INIT(timeout_list); -int ptlrpc_pinger_suppress_pings(void) -{ - return suppress_pings; -} -EXPORT_SYMBOL(ptlrpc_pinger_suppress_pings); - struct ptlrpc_request * ptlrpc_prep_ping(struct obd_import *imp) { @@ -122,11 +112,6 @@ static void ptlrpc_update_next_ping(struct obd_import *imp, int soon) imp->imp_next_ping = cfs_time_shift(time); } -void ptlrpc_ping_import_soon(struct obd_import *imp) -{ - imp->imp_next_ping = cfs_time_current(); -} - static inline int imp_is_deactive(struct obd_import *imp) { return (imp->imp_deactive || @@ -325,9 +310,6 @@ int ptlrpc_start_pinger(void) l_wait_event(pinger_thread.t_ctl_waitq, thread_is_running(&pinger_thread), &lwi); - if (suppress_pings) - CWARN("Pings will be suppressed at the request of the administrator. The configuration shall meet the additional requirements described in the manual. (Search for the \"suppress_pings\" kernel module parameter.)\n"); - return 0; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index a3608a9..ab6c458 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -137,7 +137,6 @@ ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, return ptlrpc_nrs_req_get_nolock0(svcpt, hp, false, force); } -void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req); bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp); int ptlrpc_nrs_policy_control(const struct ptlrpc_service *svc, @@ -243,7 +242,6 @@ int ptlrpc_stop_pinger(void); void ptlrpc_pinger_sending_on_import(struct obd_import *imp); void ptlrpc_pinger_commit_expected(struct obd_import *imp); void ptlrpc_pinger_wake_up(void); -void ptlrpc_ping_import_soon(struct obd_import *imp); /* sec_null.c */ int sptlrpc_null_init(void); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:12 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:12 -0400 Subject: [lustre-devel] [PATCH 29/29] staging/lustre: Remove ccc_transient_page_* methods In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-30-git-send-email-green@linuxhacker.ru> From: Oleg Drokin All of them but the ccc_transient_page_prep are unused, so remove the unused ones. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lclient.h | 19 --------- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 48 ---------------------- 2 files changed, 67 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lclient.h b/drivers/staging/lustre/lustre/include/lclient.h index 823be81..be5499c 100644 --- a/drivers/staging/lustre/lustre/include/lclient.h +++ b/drivers/staging/lustre/lustre/include/lclient.h @@ -233,8 +233,6 @@ static inline struct ccc_page *cl2ccc_page(const struct cl_page_slice *slice) return container_of(slice, struct ccc_page, cpg_cl); } -struct cl_page *ccc_vmpage_page_transient(struct page *vmpage); - struct ccc_device { struct cl_device cdv_cl; struct super_block *cdv_sb; @@ -296,22 +294,6 @@ struct page *ccc_page_vmpage(const struct lu_env *env, int ccc_page_is_under_lock(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *io); int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice); -void ccc_transient_page_verify(const struct cl_page *page); -int ccc_transient_page_own(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *io, int nonblock); -void ccc_transient_page_assume(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *io); -void ccc_transient_page_unassume(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *io); -void ccc_transient_page_disown(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *io); -void ccc_transient_page_discard(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *io); int ccc_transient_page_prep(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *io); @@ -368,7 +350,6 @@ struct ccc_object *cl_inode2ccc (struct inode *inode); int cl_setattr_ost(struct inode *inode, const struct iattr *attr); -struct cl_page *ccc_vmpage_page_transient(struct page *vmpage); int ccc_object_invariant(const struct cl_object *obj); int cl_file_inode_init(struct inode *inode, struct lustre_md *md); void cl_inode_fini(struct inode *inode); diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index eb43174..8764df9 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -488,54 +488,6 @@ int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice) return 0; } -void ccc_transient_page_verify(const struct cl_page *page) -{ -} - -int ccc_transient_page_own(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *unused, - int nonblock) -{ - ccc_transient_page_verify(slice->cpl_page); - return 0; -} - -void ccc_transient_page_assume(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *unused) -{ - ccc_transient_page_verify(slice->cpl_page); -} - -void ccc_transient_page_unassume(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *unused) -{ - ccc_transient_page_verify(slice->cpl_page); -} - -void ccc_transient_page_disown(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *unused) -{ - ccc_transient_page_verify(slice->cpl_page); -} - -void ccc_transient_page_discard(const struct lu_env *env, - const struct cl_page_slice *slice, - struct cl_io *unused) -{ - struct cl_page *page = slice->cpl_page; - - ccc_transient_page_verify(slice->cpl_page); - - /* - * For transient pages, remove it from the radix tree. - */ - cl_page_delete(env, page); -} - int ccc_transient_page_prep(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *unused) -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:09 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:09 -0400 Subject: [lustre-devel] [PATCH 26/29] staging/lustre: Remove server-only recovery-related bits In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-27-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This patch is a first stab at trying to remove structure fields from obd_export and obd structures that are only used on the server or make sense on the server. These include tracking requests in recovery, various recovery stages, lists of recovered and not yet recovered clients and so on. Also prune functions that use these fields. Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/include/lustre_export.h | 17 +----- drivers/staging/lustre/lustre/include/obd.h | 27 --------- drivers/staging/lustre/lustre/include/obd_class.h | 1 - drivers/staging/lustre/lustre/obdclass/genops.c | 50 +---------------- .../staging/lustre/lustre/obdclass/obd_config.c | 6 -- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 64 ++++++++-------------- 7 files changed, 28 insertions(+), 140 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 5b8f4e8..1daf4c5 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -183,25 +183,10 @@ struct obd_export { struct obd_connect_data exp_connect_data; enum obd_option exp_flags; unsigned long exp_failed:1, - exp_in_recovery:1, exp_disconnected:1, exp_connecting:1, - /** VBR: export missed recovery */ - exp_delayed:1, - /** VBR: failed version checking */ - exp_vbr_failed:1, - exp_req_replay_needed:1, - exp_lock_replay_needed:1, - exp_need_sync:1, exp_flvr_changed:1, - exp_flvr_adapt:1, - exp_libclient:1, /* liblustre client? */ - /* client timed out and tried to reconnect, - * but couldn't because of active rpcs */ - exp_abort_active_req:1, - /* if to swap nidtbl entries for 2.2 clients. - * Only used by the MGS to fix LU-1644. */ - exp_need_mne_swab:1; + exp_flvr_adapt:1; /* also protected by exp_lock */ enum lustre_sec_part exp_sp_peer; struct sptlrpc_flavor exp_flvr; /* current */ diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 3fb72dc..314f5c7 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -725,8 +725,6 @@ struct obd_device { /* bitfield modification is protected by obd_dev_lock */ unsigned long obd_attached:1, /* finished attach */ obd_set_up:1, /* finished setup */ - obd_recovering:1, /* there are recoverable clients */ - obd_abort_recovery:1,/* recovery expired */ obd_version_recov:1, /* obd uses version checking */ obd_replayable:1, /* recovery is enabled; inform clients */ obd_no_transno:1, /* no committed-transno notification */ @@ -769,31 +767,6 @@ struct obd_device { struct obd_notify_upcall obd_upcall; struct obd_export *obd_self_export; - int obd_max_recoverable_clients; - atomic_t obd_connected_clients; - int obd_stale_clients; - int obd_delayed_clients; - /* this lock protects all recovery list_heads, timer and - * obd_next_recovery_transno value */ - spinlock_t obd_recovery_task_lock; - __u64 obd_next_recovery_transno; - int obd_replayed_requests; - int obd_requests_queued_for_recovery; - wait_queue_head_t obd_next_transno_waitq; - /* protected by obd_recovery_task_lock */ - int obd_recovery_timeout; - - /* new recovery stuff from CMD2 */ - struct target_recovery_data obd_recovery_data; - int obd_replayed_locks; - atomic_t obd_req_replay_clients; - atomic_t obd_lock_replay_clients; - /* all lists are protected by obd_recovery_task_lock */ - struct list_head obd_req_replay_queue; - struct list_head obd_lock_replay_queue; - struct list_head obd_final_req_queue; - int obd_recovery_stage; - union { struct client_obd cli; struct echo_client_obd echo_client; diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 73fb29f..6fb67a6 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -273,7 +273,6 @@ static inline enum obd_option exp_flags_from_obd(struct obd_device *obd) { return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) | (obd->obd_force ? OBD_OPT_FORCE : 0) | - (obd->obd_abort_recovery ? OBD_OPT_ABORT_RECOV : 0) | 0); } diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 681312e..c1bffcd 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -1034,51 +1034,6 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, } EXPORT_SYMBOL(class_connect); -/* if export is involved in recovery then clean up related things */ -static void class_export_recovery_cleanup(struct obd_export *exp) -{ - struct obd_device *obd = exp->exp_obd; - - spin_lock(&obd->obd_recovery_task_lock); - if (exp->exp_delayed) - obd->obd_delayed_clients--; - if (obd->obd_recovering) { - if (exp->exp_in_recovery) { - spin_lock(&exp->exp_lock); - exp->exp_in_recovery = 0; - spin_unlock(&exp->exp_lock); - LASSERT_ATOMIC_POS(&obd->obd_connected_clients); - atomic_dec(&obd->obd_connected_clients); - } - - /* if called during recovery then should update - * obd_stale_clients counter, - * lightweight exports are not counted */ - if (exp->exp_failed && - (exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT) == 0) - exp->exp_obd->obd_stale_clients++; - } - spin_unlock(&obd->obd_recovery_task_lock); - - spin_lock(&exp->exp_lock); - /** Cleanup req replay fields */ - if (exp->exp_req_replay_needed) { - exp->exp_req_replay_needed = 0; - - LASSERT(atomic_read(&obd->obd_req_replay_clients)); - atomic_dec(&obd->obd_req_replay_clients); - } - - /** Cleanup lock replay data */ - if (exp->exp_lock_replay_needed) { - exp->exp_lock_replay_needed = 0; - - LASSERT(atomic_read(&obd->obd_lock_replay_clients)); - atomic_dec(&obd->obd_lock_replay_clients); - } - spin_unlock(&exp->exp_lock); -} - /* This function removes 1-3 references from the export: * 1 - for export pointer passed * and if disconnect really need @@ -1108,7 +1063,6 @@ int class_disconnect(struct obd_export *export) CDEBUG(D_IOCTL, "disconnect: cookie %#llx\n", export->exp_handle.h_cookie); - class_export_recovery_cleanup(export); class_unlink_export(export); no_disconn: class_export_put(export); @@ -1184,13 +1138,13 @@ static void print_export_data(struct obd_export *exp, const char *status, } spin_unlock(&exp->exp_lock); - CDEBUG(D_HA, "%s: %s %p %s %s %d (%d %d %d) %d %d %d %d: %p %s %llu\n", + CDEBUG(D_HA, "%s: %s %p %s %s %d (%d %d %d) %d %d %d: %p %s %llu\n", exp->exp_obd->obd_name, status, exp, exp->exp_client_uuid.uuid, obd_export_nid2str(exp), atomic_read(&exp->exp_refcount), atomic_read(&exp->exp_rpc_count), atomic_read(&exp->exp_cb_count), atomic_read(&exp->exp_locks_count), - exp->exp_disconnected, exp->exp_delayed, exp->exp_failed, + exp->exp_disconnected, exp->exp_failed, nreplies, first_reply, nreplies > 3 ? "..." : "", exp->exp_last_committed); #if LUSTRE_TRACKS_LOCK_EXP_REFS diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 48c712e..66fafd3 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -237,13 +237,7 @@ int class_attach(struct lustre_cfg *lcfg) /* XXX belongs in setup not attach */ init_rwsem(&obd->obd_observer_link_sem); /* recovery data */ - spin_lock_init(&obd->obd_recovery_task_lock); - init_waitqueue_head(&obd->obd_next_transno_waitq); init_waitqueue_head(&obd->obd_evict_inprogress_waitq); - INIT_LIST_HEAD(&obd->obd_req_replay_queue); - INIT_LIST_HEAD(&obd->obd_lock_replay_queue); - INIT_LIST_HEAD(&obd->obd_final_req_queue); - INIT_LIST_HEAD(&obd->obd_evict_list); llog_group_init(&obd->obd_olg, FID_SEQ_LLOG); diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 8db62d0..13632cd 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -328,8 +328,7 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) /* Report service time estimate for future client reqs, but report 0 * (to be ignored by client) if it's a error reply during recovery. * (bz15815) */ - if (req->rq_type == PTL_RPC_MSG_ERR && - (req->rq_export == NULL || req->rq_export->exp_obd->obd_recovering)) + if (req->rq_type == PTL_RPC_MSG_ERR && !req->rq_export) lustre_msg_set_timeout(req->rq_repmsg, 0); else lustre_msg_set_timeout(req->rq_repmsg, diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 353ac22..44fde0b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -880,18 +880,16 @@ static int ptlrpc_check_req(struct ptlrpc_request *req) req, (obd != NULL) ? obd->obd_name : "unknown"); rc = -ENODEV; } else if (lustre_msg_get_flags(req->rq_reqmsg) & - (MSG_REPLAY | MSG_REQ_REPLAY_DONE) && - !obd->obd_recovering) { - DEBUG_REQ(D_ERROR, req, - "Invalid replay without recovery"); - class_fail_export(req->rq_export); - rc = -ENODEV; - } else if (lustre_msg_get_transno(req->rq_reqmsg) != 0 && - !obd->obd_recovering) { - DEBUG_REQ(D_ERROR, req, "Invalid req with transno %llu without recovery", - lustre_msg_get_transno(req->rq_reqmsg)); - class_fail_export(req->rq_export); - rc = -ENODEV; + (MSG_REPLAY | MSG_REQ_REPLAY_DONE)) { + DEBUG_REQ(D_ERROR, req, "Invalid replay without recovery"); + class_fail_export(req->rq_export); + rc = -ENODEV; + } else if (lustre_msg_get_transno(req->rq_reqmsg) != 0) { + DEBUG_REQ(D_ERROR, req, + "Invalid req with transno %llu without recovery", + lustre_msg_get_transno(req->rq_reqmsg)); + class_fail_export(req->rq_export); + rc = -ENODEV; } if (unlikely(rc < 0)) { @@ -1030,34 +1028,20 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) return -ENOSYS; } - if (req->rq_export && - lustre_msg_get_flags(req->rq_reqmsg) & - (MSG_REPLAY | MSG_REQ_REPLAY_DONE | MSG_LOCK_REPLAY_DONE)) { - /* During recovery, we don't want to send too many early - * replies, but on the other hand we want to make sure the - * client has enough time to resend if the rpc is lost. So - * during the recovery period send at least 4 early replies, - * spacing them every at_extra if we can. at_estimate should - * always equal this fixed value during recovery. */ - at_measured(&svcpt->scp_at_estimate, min(at_extra, - req->rq_export->exp_obd->obd_recovery_timeout / 4)); - } else { - /* Fake our processing time into the future to ask the clients - * for some extra amount of time */ - at_measured(&svcpt->scp_at_estimate, at_extra + - ktime_get_real_seconds() - - req->rq_arrival_time.tv_sec); - - /* Check to see if we've actually increased the deadline - - * we may be past adaptive_max */ - if (req->rq_deadline >= req->rq_arrival_time.tv_sec + - at_get(&svcpt->scp_at_estimate)) { - DEBUG_REQ(D_WARNING, req, "Couldn't add any time (%ld/%lld), not sending early reply\n", - olddl, req->rq_arrival_time.tv_sec + - at_get(&svcpt->scp_at_estimate) - - ktime_get_real_seconds()); - return -ETIMEDOUT; - } + /* Fake our processing time into the future to ask the clients + * for some extra amount of time */ + at_measured(&svcpt->scp_at_estimate, at_extra + + ktime_get_real_seconds() - req->rq_arrival_time.tv_sec); + + /* Check to see if we've actually increased the deadline - + * we may be past adaptive_max */ + if (req->rq_deadline >= req->rq_arrival_time.tv_sec + + at_get(&svcpt->scp_at_estimate)) { + DEBUG_REQ(D_WARNING, req, "Couldn't add any time (%ld/%lld), not sending early reply\n", + olddl, req->rq_arrival_time.tv_sec + + at_get(&svcpt->scp_at_estimate) - + ktime_get_real_seconds()); + return -ETIMEDOUT; } newdl = ktime_get_real_seconds() + at_get(&svcpt->scp_at_estimate); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:11 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:11 -0400 Subject: [lustre-devel] [PATCH 28/29] staging/lustre: Remove unused ccc_io_fini() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-29-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Does not appear to be used anywhere. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lclient.h | 1 - drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lclient.h b/drivers/staging/lustre/lustre/include/lclient.h index d09d005..823be81 100644 --- a/drivers/staging/lustre/lustre/include/lclient.h +++ b/drivers/staging/lustre/lustre/include/lclient.h @@ -332,7 +332,6 @@ void ccc_lock_state(const struct lu_env *env, const struct cl_lock_slice *slice, enum cl_lock_state state); -void ccc_io_fini(const struct lu_env *env, const struct cl_io_slice *ios); int ccc_io_one_lock_index(const struct lu_env *env, struct cl_io *io, __u32 enqflags, enum cl_lock_mode mode, pgoff_t start, pgoff_t end); diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 98a2e0e..eb43174 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -675,13 +675,6 @@ void ccc_lock_state(const struct lu_env *env, * */ -void ccc_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) -{ - struct cl_io *io = ios->cis_io; - - CLOBINVRNT(env, io->ci_obj, ccc_object_invariant(io->ci_obj)); -} - int ccc_io_one_lock_index(const struct lu_env *env, struct cl_io *io, __u32 enqflags, enum cl_lock_mode mode, pgoff_t start, pgoff_t end) -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:10 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:10 -0400 Subject: [lustre-devel] [PATCH 27/29] staging/lustre: Remove ccc_attr/conf_set() In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-28-git-send-email-green@linuxhacker.ru> From: Oleg Drokin These seem to be unused. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lclient.h | 4 ---- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 15 --------------- 2 files changed, 19 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lclient.h b/drivers/staging/lustre/lustre/include/lclient.h index 67d41bb..d09d005 100644 --- a/drivers/staging/lustre/lustre/include/lclient.h +++ b/drivers/staging/lustre/lustre/include/lclient.h @@ -289,12 +289,8 @@ void ccc_object_free(const struct lu_env *env, struct lu_object *obj); int ccc_lock_init(const struct lu_env *env, struct cl_object *obj, struct cl_lock *lock, const struct cl_io *io, const struct cl_lock_operations *lkops); -int ccc_attr_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_attr *attr, unsigned valid); int ccc_object_glimpse(const struct lu_env *env, const struct cl_object *obj, struct ost_lvb *lvb); -int ccc_conf_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_object_conf *conf); struct page *ccc_page_vmpage(const struct lu_env *env, const struct cl_page_slice *slice); int ccc_page_is_under_lock(const struct lu_env *env, diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index f049d55..98a2e0e 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -406,12 +406,6 @@ int ccc_lock_init(const struct lu_env *env, return result; } -int ccc_attr_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_attr *attr, unsigned valid) -{ - return 0; -} - int ccc_object_glimpse(const struct lu_env *env, const struct cl_object *obj, struct ost_lvb *lvb) { @@ -430,15 +424,6 @@ int ccc_object_glimpse(const struct lu_env *env, return 0; } - - -int ccc_conf_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_object_conf *conf) -{ - /* TODO: destroy all pages attached to this object. */ - return 0; -} - static void ccc_object_size_lock(struct cl_object *obj) { struct inode *inode = ccc_object_inode(obj); -- 2.1.0 From green at linuxhacker.ru Tue Sep 29 03:44:08 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Mon, 28 Sep 2015 23:44:08 -0400 Subject: [lustre-devel] [PATCH 25/29] staging/lustre/obdclass: Remove unused nid_hash In-Reply-To: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> References: <1443498252-1974801-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443498252-1974801-26-git-send-email-green@linuxhacker.ru> From: Oleg Drokin nid_hash is used on export to faster find clients based on their NID. There's no use for that on the client. Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/include/lustre_export.h | 1 - drivers/staging/lustre/lustre/include/obd.h | 2 - drivers/staging/lustre/lustre/obdclass/genops.c | 10 +-- .../staging/lustre/lustre/obdclass/obd_config.c | 95 ---------------------- 4 files changed, 1 insertion(+), 107 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 7634dea..5b8f4e8 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -147,7 +147,6 @@ struct obd_export { /** To link all exports on an obd device */ struct list_head exp_obd_chain; struct hlist_node exp_uuid_hash; /** uuid-export hash*/ - struct hlist_node exp_nid_hash; /** nid-export hash */ /** Obd device of this export */ struct obd_device *exp_obd; /** diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index e8317b8..3fb72dc 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -746,8 +746,6 @@ struct obd_device { unsigned long obd_recovery_expired:1; /* uuid-export hash body */ struct cfs_hash *obd_uuid_hash; - /* nid-export hash body */ - struct cfs_hash *obd_nid_hash; atomic_t obd_refcount; wait_queue_head_t obd_refcount_waitq; struct list_head obd_exports; diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 4467baa..681312e 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -757,7 +757,6 @@ struct obd_export *class_new_export(struct obd_device *obd, spin_lock_init(&export->exp_lock); spin_lock_init(&export->exp_rpc_lock); INIT_HLIST_NODE(&export->exp_uuid_hash); - INIT_HLIST_NODE(&export->exp_nid_hash); spin_lock_init(&export->exp_bl_list_lock); INIT_LIST_HEAD(&export->exp_bl_list); @@ -1103,19 +1102,12 @@ int class_disconnect(struct obd_export *export) /* class_cleanup(), abort_recovery(), and class_fail_export() * all end up in here, and if any of them race we shouldn't * call extra class_export_puts(). */ - if (already_disconnected) { - LASSERT(hlist_unhashed(&export->exp_nid_hash)); + if (already_disconnected) goto no_disconn; - } CDEBUG(D_IOCTL, "disconnect: cookie %#llx\n", export->exp_handle.h_cookie); - if (!hlist_unhashed(&export->exp_nid_hash)) - cfs_hash_del(export->exp_obd->obd_nid_hash, - &export->exp_connection->c_peer.nid, - &export->exp_nid_hash); - class_export_recovery_cleanup(export); class_unlink_export(export); no_disconn: diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index a8a1cb7..48c712e 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -48,7 +48,6 @@ #include "llog_internal.h" static cfs_hash_ops_t uuid_hash_ops; -static cfs_hash_ops_t nid_hash_ops; /*********** string parsing utils *********/ @@ -327,7 +326,6 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) other fns check that status, and we're not actually set up yet. */ obd->obd_starting = 1; obd->obd_uuid_hash = NULL; - obd->obd_nid_hash = NULL; spin_unlock(&obd->obd_dev_lock); /* create an uuid-export lustre hash */ @@ -343,19 +341,6 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) goto err_hash; } - /* create a nid-export lustre hash */ - obd->obd_nid_hash = cfs_hash_create("NID_HASH", - HASH_NID_CUR_BITS, - HASH_NID_MAX_BITS, - HASH_NID_BKT_BITS, 0, - CFS_HASH_MIN_THETA, - CFS_HASH_MAX_THETA, - &nid_hash_ops, CFS_HASH_DEFAULT); - if (!obd->obd_nid_hash) { - err = -ENOMEM; - goto err_hash; - } - exp = class_new_export(obd, &obd->obd_uuid); if (IS_ERR(exp)) { err = PTR_ERR(exp); @@ -390,10 +375,6 @@ err_hash: cfs_hash_putref(obd->obd_uuid_hash); obd->obd_uuid_hash = NULL; } - if (obd->obd_nid_hash) { - cfs_hash_putref(obd->obd_nid_hash); - obd->obd_nid_hash = NULL; - } obd->obd_starting = 0; CERROR("setup %s failed (%d)\n", obd->obd_name, err); return err; @@ -499,12 +480,6 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) obd->obd_uuid_hash = NULL; } - /* destroy a nid-export hash body */ - if (obd->obd_nid_hash) { - cfs_hash_putref(obd->obd_nid_hash); - obd->obd_nid_hash = NULL; - } - class_decref(obd, "setup", obd); obd->obd_set_up = 0; @@ -1516,73 +1491,3 @@ static cfs_hash_ops_t uuid_hash_ops = { .hs_get = uuid_export_get, .hs_put_locked = uuid_export_put_locked, }; - - -/* - * nid<->export hash operations - */ - -static unsigned -nid_hash(struct cfs_hash *hs, const void *key, unsigned mask) -{ - return cfs_hash_djb2_hash(key, sizeof(lnet_nid_t), mask); -} - -static void * -nid_key(struct hlist_node *hnode) -{ - struct obd_export *exp; - - exp = hlist_entry(hnode, struct obd_export, exp_nid_hash); - - return &exp->exp_connection->c_peer.nid; -} - -/* - * NOTE: It is impossible to find an export that is in failed - * state with this function - */ -static int -nid_kepcmp(const void *key, struct hlist_node *hnode) -{ - struct obd_export *exp; - - LASSERT(key); - exp = hlist_entry(hnode, struct obd_export, exp_nid_hash); - - return exp->exp_connection->c_peer.nid == *(lnet_nid_t *)key && - !exp->exp_failed; -} - -static void * -nid_export_object(struct hlist_node *hnode) -{ - return hlist_entry(hnode, struct obd_export, exp_nid_hash); -} - -static void -nid_export_get(struct cfs_hash *hs, struct hlist_node *hnode) -{ - struct obd_export *exp; - - exp = hlist_entry(hnode, struct obd_export, exp_nid_hash); - class_export_get(exp); -} - -static void -nid_export_put_locked(struct cfs_hash *hs, struct hlist_node *hnode) -{ - struct obd_export *exp; - - exp = hlist_entry(hnode, struct obd_export, exp_nid_hash); - class_export_put(exp); -} - -static cfs_hash_ops_t nid_hash_ops = { - .hs_hash = nid_hash, - .hs_key = nid_key, - .hs_keycmp = nid_kepcmp, - .hs_object = nid_export_object, - .hs_get = nid_export_get, - .hs_put_locked = nid_export_put_locked, -}; -- 2.1.0 From ashish.purkar at seagate.com Tue Sep 29 21:10:23 2015 From: ashish.purkar at seagate.com (Ashish Purkar) Date: Wed, 30 Sep 2015 02:40:23 +0530 Subject: [lustre-devel] Channel Bonding Debug Information In-Reply-To: References: Message-ID: It's useful to have Rx, Tx stats counters available from NIDs participating in channel bonding and SG list usage(Rx,Tx,command/status ring descriptors) to debug performance problems seen with LACP bonding. app√ On Sep 29, 2015 1:00 AM, "Amir Shehata" wrote: > Hello, > > As a followup on the discussion in the LAD developer summit, regarding > ensuring that there is enough debug information provided as part of the > Channel Bonding solution, I'm sending this email to ask for ideas on what > type of debug information you would like to see. > > thanks > amir > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.lustre.org_listinfo.cgi_lustre-2Ddevel-2Dlustre.org&d=BQICAg&c=IGDlg0lD0b-nebmJJ0Kp8A&r=FtYV9f_ig6ynAGsdwsQr2_tmRri3ty7J2xOP7XSVZbg&m=_S5QRz-57VM5yeaQJZCqqS9aJS2rCxpXpxAkqPTLpb4&s=ePZoRO7uPl9fRDKoXdNMzz_YNyHPslWDcMNBx34caJk&e= > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Wed Sep 30 02:25:04 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Tue, 29 Sep 2015 19:25:04 -0700 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> Message-ID: <560B4800.6070103@llnl.gov> I looked through the code a bit, and I think that the even bigger issues are the lack of reasonable naming, lack of comments, and a puzzling semantic inconsistency. Before working on any of the issues I mention below though, we should probably make sure that these functions still have a purpose once /proc goes away. They seem generic enough helpers that they will still be used with the non-/proc methods, but it is worth checking. First, consider this pair of names: lprocfs_write_frac_helper lprocfs_write_frac_u64_helper One might reasonably suspect that the major difference between these two functions is that the latter deails with a u64, and the former does not. But that is already pretty darn clear from the full function prototype, and really the main difference is that lprocfs_write_frac_u64_helper can parse a units character in the string. Maybe the name should be lprocfs_write_frac_units_helper. Also, the semantics surrounding the multiplier are field are different. For lprocfs_write_frac_helper the mult parameter is always enforced, and there is code that replies on that. With lprocfs_write_frac_u64_helper mult is merely a default, and the caller can't rely on it being used. Two functions with similar names but difference semantics (and not in the way implied by the name difference), and no function comments...not a good idea. Next there is the naming difference between these: lprocfs_write_frac_u64_helper lprocfs_write_u64_helper One might reasonably expect that when using the latter function one loses the ability to handle fractional numbers. But no, actually it just sets the multiplier to a default of 1. How does that naming make any sense? I suppose that with lprocfs_write_helper that naming style almost makes sense, because a multiplier of 1 will result in anything after the decimal point being calculated out to 0. So the fractional part is, in effect, ignored. But, strangely enough, fractions are still _accepted_ by the function. This semantic distinction is important to consider. It means that you can't just do a naive combination of the two functions into your proposed lprocfs_write_frac_helper_internal() function. There are callers of lprocfs_write_frac_helper that assume that the multiplier can be only the one specified and would result in incorrect number if there were user-specified units in the string. By the was, I'm not really in favor of duplicating the existing functions with a hope to remove the old ones at some time in the future. I think (despite current evidence to the contrary) that these functions are not so difficult to review that we would need a transition period. We would just need to audit every caller to make sure that any semantic changes are handled. And frankly, there would appear to be code that _already_ gets this wrong, so an audit is really needed already. For instance, ll_max_readahead_mb_seq_write() tries to be too clever by assuming that users can only provide an integer that represents number of MiB, and then passes in a multiplier that will have it convert into number of pages. But the since they used lprocfs_write_frac_u64_helper(), the user can specify their own units, and then the number returned number will be bytes instead of pages. Here are the callers that I found that are doing it wrong: ll_max_readahead_mb_seq_write ll_max_cached_mb_seq_write proc_max_dirty_pages_in_mb osc_cached_mb_seq_write 4 out of 5 are doing it wrong. Not a good track record. And getting back to the point, franctions and units are both accepted and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the name is misleading at best. Why does lprocfs_write_frac_helper do its own handling of negatives and then call the unsigned simple_strtoul function? Why not just use the signed simple_strtol function? As far as I can tell the signed version of the function has been in Linux as long as the unsigned version. Why is mult declared as a signed int? I think it should almost certainly be unsigned. I think it might only be signed because the function author reuses mult as a local variable to stored the negative sign when parsed from the string. If so, that is a poor choice. The function declaration is a contract with the caller. If it makes no sense to pass in a negative multiplier, then the declaration should make that clear by declaring it unsigned. Why do the unsigned versions of the helper functions allow and parse negative numbers? I think that this gets to the heart of your suggestion about special handling for -1. I think that knowing that -1 has special meaning for something things is too specialized for the helper function. I think we are better off letting the caller decided what special handling to do and when. I would suggest that the main helper that does handling of user-specified units should not be casting the number to an unsigned value. Leave the casting to the caller, or perhaps provide a simple wrapper to cast away the sign. I don't think we are going to miss that one extra bit for positive numbers. So maybe we need the most generic function prototype be be something like: int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, unsigned int mult, bool units_allowed); The function comment would explain that if units are allowed, then the multiplier is only a default and will be overridden by the user-specificed unit. Chris On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: > Greetings, > > Recently, I've noticed that the lprocfs write frac int and u64 helpers > have a few issues. The biggest issue is that neither function handles > overflow/wrap. I also noticed very similar code that should be > consolidated down and leveraged by both helpers. > > I was thinking of refactoring the functions in the fashion described below. > > int lprocfs_write_frac_helper_internal(char *buffer, unsigned long > count, __u64 *val, int mult); > int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, > unsigned long count, __u64 *val, int mult); > int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned > long count, int *val, int mult); > > lprocfs_write_frac_helper_internal would handle parsing an unsigned long > long from the kernel char buffer passed in. It will be responsible for > detecting if a uint wrap occurs. > > For lprocfs_write_frac_u64_helper_safe, the string "-1" will > automatically return ULLONG_MAX. If any other string representing a > negative number is passed in, an invalid value error code should be > returned. If the multiplier is negative, that would also be treated as > invalid. The units and multiplier logic can also be consolidated. It > will use lprocfs_write_frac_helper_internal to handle the parsing. > > lprocfs_write_frac_helper_safe will leverage > lprocfs_write_frac_helper_internal. If > lprocfs_write_frac_helper_internal indicates a wrap occurred, then we > also have an invalid integer. Checks for integer overflow happen after a > successful call to the internal helper. This is similar to how the > current lprocfs_write_frac_helper functions. > > It is also worth nothing, I plan to maintain the old helpers and their > use can be gradually phased out once we are confident the refactored > version is doing what it is supposed to. > > Also, unrelated to the above, quick question about lctl. Is there a > particular reason why the setting to be changed when using lctl > set_param is echoed back to the user? I think it can be misleading in > cases where the value set is not necessarily what is being reflected to > the user (i.e. -1 for max value). That could be confusing to a user and > they should be using lctl get_param to confirm their value was set > anyways. Also, it would follow convention that unless an error happens, > nothing is printed to console. Any disagreements on silencing lctl > set_param? > > Thanks, > Giuseppe Di Natale > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From dinatale2 at llnl.gov Wed Sep 30 19:46:03 2015 From: dinatale2 at llnl.gov (Di Natale, Giuseppe) Date: Wed, 30 Sep 2015 19:46:03 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <560B4800.6070103@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> Message-ID: <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> I looked around to see where the helpers are used. It looks to me that they are always used in proc related functions. I agree with the issues you mentioned at the top of the email as well. It also appears that the multiplier is never negative, so making it an unsigned int seems like the right way to go. I also noticed that lprocfs_write_frac_helper calls are always followed by a check if the value produced is greater than 0 and if not an error is thrown. This implies the signed version may not be necessary (and that maybe the unsigned helper should error with strings representing negative numbers?). Also, I think both the unsigned and signed methods parse the numeric portion of the string in a very similar fashion. At the very least, they appear to attempt to do the same thing. That is the portion I was going to consolidate down. You didn't comment on detecting overflow/underflow/wrapping. I still think those are a valid concern as well. Giuseppe ________________________________________ From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Christopher J. Morrone [morrone2 at llnl.gov] Sent: Tuesday, September 29, 2015 7:25 PM To: lustre-devel at lists.lustre.org Subject: Re: [lustre-devel] lprocfs Helper Issues I looked through the code a bit, and I think that the even bigger issues are the lack of reasonable naming, lack of comments, and a puzzling semantic inconsistency. Before working on any of the issues I mention below though, we should probably make sure that these functions still have a purpose once /proc goes away. They seem generic enough helpers that they will still be used with the non-/proc methods, but it is worth checking. First, consider this pair of names: lprocfs_write_frac_helper lprocfs_write_frac_u64_helper One might reasonably suspect that the major difference between these two functions is that the latter deails with a u64, and the former does not. But that is already pretty darn clear from the full function prototype, and really the main difference is that lprocfs_write_frac_u64_helper can parse a units character in the string. Maybe the name should be lprocfs_write_frac_units_helper. Also, the semantics surrounding the multiplier are field are different. For lprocfs_write_frac_helper the mult parameter is always enforced, and there is code that replies on that. With lprocfs_write_frac_u64_helper mult is merely a default, and the caller can't rely on it being used. Two functions with similar names but difference semantics (and not in the way implied by the name difference), and no function comments...not a good idea. Next there is the naming difference between these: lprocfs_write_frac_u64_helper lprocfs_write_u64_helper One might reasonably expect that when using the latter function one loses the ability to handle fractional numbers. But no, actually it just sets the multiplier to a default of 1. How does that naming make any sense? I suppose that with lprocfs_write_helper that naming style almost makes sense, because a multiplier of 1 will result in anything after the decimal point being calculated out to 0. So the fractional part is, in effect, ignored. But, strangely enough, fractions are still _accepted_ by the function. This semantic distinction is important to consider. It means that you can't just do a naive combination of the two functions into your proposed lprocfs_write_frac_helper_internal() function. There are callers of lprocfs_write_frac_helper that assume that the multiplier can be only the one specified and would result in incorrect number if there were user-specified units in the string. By the was, I'm not really in favor of duplicating the existing functions with a hope to remove the old ones at some time in the future. I think (despite current evidence to the contrary) that these functions are not so difficult to review that we would need a transition period. We would just need to audit every caller to make sure that any semantic changes are handled. And frankly, there would appear to be code that _already_ gets this wrong, so an audit is really needed already. For instance, ll_max_readahead_mb_seq_write() tries to be too clever by assuming that users can only provide an integer that represents number of MiB, and then passes in a multiplier that will have it convert into number of pages. But the since they used lprocfs_write_frac_u64_helper(), the user can specify their own units, and then the number returned number will be bytes instead of pages. Here are the callers that I found that are doing it wrong: ll_max_readahead_mb_seq_write ll_max_cached_mb_seq_write proc_max_dirty_pages_in_mb osc_cached_mb_seq_write 4 out of 5 are doing it wrong. Not a good track record. And getting back to the point, franctions and units are both accepted and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the name is misleading at best. Why does lprocfs_write_frac_helper do its own handling of negatives and then call the unsigned simple_strtoul function? Why not just use the signed simple_strtol function? As far as I can tell the signed version of the function has been in Linux as long as the unsigned version. Why is mult declared as a signed int? I think it should almost certainly be unsigned. I think it might only be signed because the function author reuses mult as a local variable to stored the negative sign when parsed from the string. If so, that is a poor choice. The function declaration is a contract with the caller. If it makes no sense to pass in a negative multiplier, then the declaration should make that clear by declaring it unsigned. Why do the unsigned versions of the helper functions allow and parse negative numbers? I think that this gets to the heart of your suggestion about special handling for -1. I think that knowing that -1 has special meaning for something things is too specialized for the helper function. I think we are better off letting the caller decided what special handling to do and when. I would suggest that the main helper that does handling of user-specified units should not be casting the number to an unsigned value. Leave the casting to the caller, or perhaps provide a simple wrapper to cast away the sign. I don't think we are going to miss that one extra bit for positive numbers. So maybe we need the most generic function prototype be be something like: int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, unsigned int mult, bool units_allowed); The function comment would explain that if units are allowed, then the multiplier is only a default and will be overridden by the user-specificed unit. Chris On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: > Greetings, > > Recently, I've noticed that the lprocfs write frac int and u64 helpers > have a few issues. The biggest issue is that neither function handles > overflow/wrap. I also noticed very similar code that should be > consolidated down and leveraged by both helpers. > > I was thinking of refactoring the functions in the fashion described below. > > int lprocfs_write_frac_helper_internal(char *buffer, unsigned long > count, __u64 *val, int mult); > int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, > unsigned long count, __u64 *val, int mult); > int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned > long count, int *val, int mult); > > lprocfs_write_frac_helper_internal would handle parsing an unsigned long > long from the kernel char buffer passed in. It will be responsible for > detecting if a uint wrap occurs. > > For lprocfs_write_frac_u64_helper_safe, the string "-1" will > automatically return ULLONG_MAX. If any other string representing a > negative number is passed in, an invalid value error code should be > returned. If the multiplier is negative, that would also be treated as > invalid. The units and multiplier logic can also be consolidated. It > will use lprocfs_write_frac_helper_internal to handle the parsing. > > lprocfs_write_frac_helper_safe will leverage > lprocfs_write_frac_helper_internal. If > lprocfs_write_frac_helper_internal indicates a wrap occurred, then we > also have an invalid integer. Checks for integer overflow happen after a > successful call to the internal helper. This is similar to how the > current lprocfs_write_frac_helper functions. > > It is also worth nothing, I plan to maintain the old helpers and their > use can be gradually phased out once we are confident the refactored > version is doing what it is supposed to. > > Also, unrelated to the above, quick question about lctl. Is there a > particular reason why the setting to be changed when using lctl > set_param is echoed back to the user? I think it can be misleading in > cases where the value set is not necessarily what is being reflected to > the user (i.e. -1 for max value). That could be confusing to a user and > they should be using lctl get_param to confirm their value was set > anyways. Also, it would follow convention that unless an error happens, > nothing is printed to console. Any disagreements on silencing lctl > set_param? > > Thanks, > Giuseppe Di Natale > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From andreas.dilger at intel.com Wed Sep 30 20:06:17 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 30 Sep 2015 20:06:17 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <560B4800.6070103@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> <560B4800.6070103@llnl.gov> Message-ID: On 2015/09/29, 8:25 PM, "lustre-devel on behalf of Christopher J. Morrone" wrote: >I looked through the code a bit, and I think that the even bigger issues >are the lack of reasonable naming, lack of comments, and a puzzling >semantic inconsistency. > >Before working on any of the issues I mention below though, we should >probably make sure that these functions still have a purpose once /proc >goes away. They seem generic enough helpers that they will still be >used with the non-/proc methods, but it is worth checking. Chris, definitely a lot of separate issues raised here. I'm in support of Giuseppe replacing these functions with a single implementation that gets it right. This is something that I've wanted for a long time, but it hasn't been a priority. It makes sense to handle the special cases (-1) in the callers, and then remove the old functions. I don't see any value in keeping the old versions of the function around either, and I don't think there are so many users that it is onerous to understand their usage and replace them all. Cheers, Andreas >First, consider this pair of names: > >lprocfs_write_frac_helper >lprocfs_write_frac_u64_helper > >One might reasonably suspect that the major difference between these two >functions is that the latter deails with a u64, and the former does not. > But that is already pretty darn clear from the full function >prototype, and really the main difference is that >lprocfs_write_frac_u64_helper can parse a units character in the string. > Maybe the name should be lprocfs_write_frac_units_helper. > >Also, the semantics surrounding the multiplier are field are different. > For lprocfs_write_frac_helper the mult parameter is always enforced, >and there is code that replies on that. With >lprocfs_write_frac_u64_helper mult is merely a default, and the caller >can't rely on it being used. Two functions with similar names but >difference semantics (and not in the way implied by the name >difference), and no function comments...not a good idea. > >Next there is the naming difference between these: > >lprocfs_write_frac_u64_helper >lprocfs_write_u64_helper > >One might reasonably expect that when using the latter function one >loses the ability to handle fractional numbers. But no, actually it >just sets the multiplier to a default of 1. How does that naming make >any sense? > >I suppose that with lprocfs_write_helper that naming style almost makes >sense, because a multiplier of 1 will result in anything after the >decimal point being calculated out to 0. So the fractional part is, in >effect, ignored. But, strangely enough, fractions are still _accepted_ >by the function. > >This semantic distinction is important to consider. It means that you >can't just do a naive combination of the two functions into your >proposed lprocfs_write_frac_helper_internal() function. There are >callers of lprocfs_write_frac_helper that assume that the multiplier can >be only the one specified and would result in incorrect number if there >were user-specified units in the string. > >By the was, I'm not really in favor of duplicating the existing >functions with a hope to remove the old ones at some time in the future. > I think (despite current evidence to the contrary) that these >functions are not so difficult to review that we would need a transition >period. We would just need to audit every caller to make sure that any >semantic changes are handled. > >And frankly, there would appear to be code that _already_ gets this >wrong, so an audit is really needed already. For instance, >ll_max_readahead_mb_seq_write() tries to be too clever by assuming that >users can only provide an integer that represents number of MiB, and >then passes in a multiplier that will have it convert into number of >pages. But the since they used lprocfs_write_frac_u64_helper(), the >user can specify their own units, and then the number returned number >will be bytes instead of pages. Here are the callers that I found that >are doing it wrong: > > ll_max_readahead_mb_seq_write > ll_max_cached_mb_seq_write > proc_max_dirty_pages_in_mb > osc_cached_mb_seq_write > >4 out of 5 are doing it wrong. Not a good track record. > >And getting back to the point, franctions and units are both accepted >and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the >name is misleading at best. > >Why does lprocfs_write_frac_helper do its own handling of negatives and >then call the unsigned simple_strtoul function? Why not just use the >signed simple_strtol function? As far as I can tell the signed version >of the function has been in Linux as long as the unsigned version. > >Why is mult declared as a signed int? I think it should almost >certainly be unsigned. I think it might only be signed because the >function author reuses mult as a local variable to stored the negative >sign when parsed from the string. If so, that is a poor choice. The >function declaration is a contract with the caller. If it makes no >sense to pass in a negative multiplier, then the declaration should make >that clear by declaring it unsigned. > >Why do the unsigned versions of the helper functions allow and parse >negative numbers? I think that this gets to the heart of your >suggestion about special handling for -1. I think that knowing that -1 >has special meaning for something things is too specialized for the >helper function. I think we are better off letting the caller decided >what special handling to do and when. > >I would suggest that the main helper that does handling of >user-specified units should not be casting the number to an unsigned >value. Leave the casting to the caller, or perhaps provide a simple >wrapper to cast away the sign. I don't think we are going to miss that >one extra bit for positive numbers. > >So maybe we need the most generic function prototype be be something like: > >int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, >unsigned int mult, bool units_allowed); > >The function comment would explain that if units are allowed, then the >multiplier is only a default and will be overridden by the >user-specificed unit. > >Chris > >On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >> Greetings, >> >> Recently, I've noticed that the lprocfs write frac int and u64 helpers >> have a few issues. The biggest issue is that neither function handles >> overflow/wrap. I also noticed very similar code that should be >> consolidated down and leveraged by both helpers. >> >> I was thinking of refactoring the functions in the fashion described >>below. >> >> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >> count, __u64 *val, int mult); >> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >> unsigned long count, __u64 *val, int mult); >> int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned >> long count, int *val, int mult); >> >> lprocfs_write_frac_helper_internal would handle parsing an unsigned long >> long from the kernel char buffer passed in. It will be responsible for >> detecting if a uint wrap occurs. >> >> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >> automatically return ULLONG_MAX. If any other string representing a >> negative number is passed in, an invalid value error code should be >> returned. If the multiplier is negative, that would also be treated as >> invalid. The units and multiplier logic can also be consolidated. It >> will use lprocfs_write_frac_helper_internal to handle the parsing. >> >> lprocfs_write_frac_helper_safe will leverage >> lprocfs_write_frac_helper_internal. If >> lprocfs_write_frac_helper_internal indicates a wrap occurred, then we >> also have an invalid integer. Checks for integer overflow happen after a >> successful call to the internal helper. This is similar to how the >> current lprocfs_write_frac_helper functions. >> >> It is also worth nothing, I plan to maintain the old helpers and their >> use can be gradually phased out once we are confident the refactored >> version is doing what it is supposed to. >> >> Also, unrelated to the above, quick question about lctl. Is there a >> particular reason why the setting to be changed when using lctl >> set_param is echoed back to the user? I think it can be misleading in >> cases where the value set is not necessarily what is being reflected to >> the user (i.e. -1 for max value). That could be confusing to a user and >> they should be using lctl get_param to confirm their value was set >> anyways. Also, it would follow convention that unless an error happens, >> nothing is printed to console. Any disagreements on silencing lctl >> set_param? >> >> Thanks, >> Giuseppe Di Natale >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division