lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: James Simmons <jsimmons@infradead.org>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 02/10] staging: lustre: make struct lu_site_bkt_data private
Date: Fri, 04 May 2018 09:39:04 +1000	[thread overview]
Message-ID: <87muxgfgx3.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <alpine.LFD.2.21.1805020400400.2551@casper.infradead.org>

On Wed, May 02 2018, James Simmons wrote:

>> This data structure only needs to be public so that
>> various modules can access a wait queue to wait for object
>> destruction.
>> If we provide a function to get the wait queue, rather than the
>> whole bucket, the structure can be made private.
>> 
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>>  drivers/staging/lustre/lustre/include/lu_object.h  |   36 +-------------
>>  drivers/staging/lustre/lustre/llite/lcommon_cl.c   |    8 ++-
>>  drivers/staging/lustre/lustre/lov/lov_object.c     |    8 ++-
>>  drivers/staging/lustre/lustre/obdclass/lu_object.c |   50 +++++++++++++++++---
>>  4 files changed, 54 insertions(+), 48 deletions(-)
>> 
>> diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h
>> index c3b0ed518819..f29bbca5af65 100644
>> --- a/drivers/staging/lustre/lustre/include/lu_object.h
>> +++ b/drivers/staging/lustre/lustre/include/lu_object.h
>> @@ -549,31 +549,7 @@ struct lu_object_header {
>>  };
>>  
>>  struct fld;
>> -
>> -struct lu_site_bkt_data {
>> -	/**
>> -	 * number of object in this bucket on the lsb_lru list.
>> -	 */
>> -	long			lsb_lru_len;
>> -	/**
>> -	 * LRU list, updated on each access to object. Protected by
>> -	 * bucket lock of lu_site::ls_obj_hash.
>> -	 *
>> -	 * "Cold" end of LRU is lu_site::ls_lru.next. Accessed object are
>> -	 * moved to the lu_site::ls_lru.prev (this is due to the non-existence
>> -	 * of list_for_each_entry_safe_reverse()).
>> -	 */
>> -	struct list_head		lsb_lru;
>> -	/**
>> -	 * Wait-queue signaled when an object in this site is ultimately
>> -	 * destroyed (lu_object_free()). It is used by lu_object_find() to
>> -	 * wait before re-trying when object in the process of destruction is
>> -	 * found in the hash table.
>> -	 *
>> -	 * \see htable_lookup().
>> -	 */
>> -	wait_queue_head_t	       lsb_marche_funebre;
>> -};
>> +struct lu_site_bkt_data;
>>  
>>  enum {
>>  	LU_SS_CREATED	 = 0,
>> @@ -642,14 +618,8 @@ struct lu_site {
>>  	struct percpu_counter	 ls_lru_len_counter;
>>  };
>>  
>> -static inline struct lu_site_bkt_data *
>> -lu_site_bkt_from_fid(struct lu_site *site, struct lu_fid *fid)
>> -{
>> -	struct cfs_hash_bd bd;
>> -
>> -	cfs_hash_bd_get(site->ls_obj_hash, fid, &bd);
>> -	return cfs_hash_bd_extra_get(site->ls_obj_hash, &bd);
>> -}
>> +wait_queue_head_t *
>> +lu_site_wq_from_fid(struct lu_site *site, struct lu_fid *fid);
>>  
>>  static inline struct seq_server_site *lu_site2seq(const struct lu_site *s)
>>  {
>> diff --git a/drivers/staging/lustre/lustre/llite/lcommon_cl.c b/drivers/staging/lustre/lustre/llite/lcommon_cl.c
>> index df5c0c0ae703..d5b42fb1d601 100644
>> --- a/drivers/staging/lustre/lustre/llite/lcommon_cl.c
>> +++ b/drivers/staging/lustre/lustre/llite/lcommon_cl.c
>> @@ -211,12 +211,12 @@ static void cl_object_put_last(struct lu_env *env, struct cl_object *obj)
>>  
>>  	if (unlikely(atomic_read(&header->loh_ref) != 1)) {
>>  		struct lu_site *site = obj->co_lu.lo_dev->ld_site;
>> -		struct lu_site_bkt_data *bkt;
>> +		wait_queue_head_t *wq;
>>  
>> -		bkt = lu_site_bkt_from_fid(site, &header->loh_fid);
>> +		wq = lu_site_wq_from_fid(site, &header->loh_fid);
>>  
>>  		init_waitqueue_entry(&waiter, current);
>> -		add_wait_queue(&bkt->lsb_marche_funebre, &waiter);
>> +		add_wait_queue(wq, &waiter);
>>  
>>  		while (1) {
>>  			set_current_state(TASK_UNINTERRUPTIBLE);
>> @@ -226,7 +226,7 @@ static void cl_object_put_last(struct lu_env *env, struct cl_object *obj)
>>  		}
>>  
>>  		set_current_state(TASK_RUNNING);
>> -		remove_wait_queue(&bkt->lsb_marche_funebre, &waiter);
>> +		remove_wait_queue(wq, &waiter);
>>  	}
>>  
>>  	cl_object_put(env, obj);
>> diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c
>> index f7c69680cb7d..adc90f310fd7 100644
>> --- a/drivers/staging/lustre/lustre/lov/lov_object.c
>> +++ b/drivers/staging/lustre/lustre/lov/lov_object.c
>> @@ -370,7 +370,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
>>  	struct cl_object	*sub;
>>  	struct lov_layout_raid0 *r0;
>>  	struct lu_site	  *site;
>> -	struct lu_site_bkt_data *bkt;
>> +	wait_queue_head_t *wq;
>>  	wait_queue_entry_t	  *waiter;
>>  
>>  	r0  = &lov->u.raid0;
>> @@ -378,7 +378,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
>>  
>>  	sub  = lovsub2cl(los);
>>  	site = sub->co_lu.lo_dev->ld_site;
>> -	bkt  = lu_site_bkt_from_fid(site, &sub->co_lu.lo_header->loh_fid);
>> +	wq   = lu_site_wq_from_fid(site, &sub->co_lu.lo_header->loh_fid);
>>  
>>  	cl_object_kill(env, sub);
>>  	/* release a reference to the sub-object and ... */
>> @@ -391,7 +391,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
>>  	if (r0->lo_sub[idx] == los) {
>>  		waiter = &lov_env_info(env)->lti_waiter;
>>  		init_waitqueue_entry(waiter, current);
>> -		add_wait_queue(&bkt->lsb_marche_funebre, waiter);
>> +		add_wait_queue(wq, waiter);
>>  		set_current_state(TASK_UNINTERRUPTIBLE);
>>  		while (1) {
>>  			/* this wait-queue is signaled at the end of
>> @@ -408,7 +408,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
>>  				break;
>>  			}
>>  		}
>> -		remove_wait_queue(&bkt->lsb_marche_funebre, waiter);
>> +		remove_wait_queue(wq, waiter);
>>  	}
>>  	LASSERT(!r0->lo_sub[idx]);
>>  }
>> diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
>> index 3de7dc0497c4..2a8a25d6edb5 100644
>> --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
>> +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
>> @@ -56,6 +56,31 @@
>>  #include <lu_ref.h>
>>  #include <linux/list.h>
>>  
>> +struct lu_site_bkt_data {
>> +	/**
>> +	 * number of object in this bucket on the lsb_lru list.
>> +	 */
>> +	long			lsb_lru_len;
>> +	/**
>> +	 * LRU list, updated on each access to object. Protected by
>> +	 * bucket lock of lu_site::ls_obj_hash.
>> +	 *
>> +	 * "Cold" end of LRU is lu_site::ls_lru.next. Accessed object are
>> +	 * moved to the lu_site::ls_lru.prev (this is due to the non-existence
>> +	 * of list_for_each_entry_safe_reverse()).
>> +	 */
>> +	struct list_head		lsb_lru;
>> +	/**
>> +	 * Wait-queue signaled when an object in this site is ultimately
>> +	 * destroyed (lu_object_free()). It is used by lu_object_find() to
>> +	 * wait before re-trying when object in the process of destruction is
>> +	 * found in the hash table.
>> +	 *
>> +	 * \see htable_lookup().
>> +	 */
>> +	wait_queue_head_t	       lsb_marche_funebre;
>> +};
>> +
>>  enum {
>>  	LU_CACHE_PERCENT_MAX	 = 50,
>>  	LU_CACHE_PERCENT_DEFAULT = 20
>> @@ -88,6 +113,17 @@ MODULE_PARM_DESC(lu_cache_nr, "Maximum number of objects in lu_object cache");
>>  static void lu_object_free(const struct lu_env *env, struct lu_object *o);
>>  static __u32 ls_stats_read(struct lprocfs_stats *stats, int idx);
>>  
>> +wait_queue_head_t *
>> +lu_site_wq_from_fid(struct lu_site *site, struct lu_fid *fid)
>> +{
>> +	struct cfs_hash_bd bd;
>> +	struct lu_site_bkt_data *bkt;
>> +
>> +	cfs_hash_bd_get(site->ls_obj_hash, fid, &bd);
>> +	bkt = cfs_hash_bd_extra_get(site->ls_obj_hash, &bd);
>> +	return &bkt->lsb_marche_funebre;
>> +}
>> +
>
> Nak. You forgot the EXPORT_SYMBOL for this. Once I added the export symbol
> it seems to work so far in my testing.

Thanks!  I'll try to remember the occasional build-test with modules.

Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180504/d7c519f5/attachment.sig>

  reply	other threads:[~2018-05-03 23:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01  3:52 [lustre-devel] [PATCH 00/10] staging: lustre: assorted improvements NeilBrown
2018-05-01  3:52 ` [lustre-devel] [PATCH 01/10] staging: lustre: ldlm: store name directly in namespace NeilBrown
2018-05-01  4:04   ` Dilger, Andreas
2018-05-02 18:11   ` James Simmons
2018-05-01  3:52 ` [lustre-devel] [PATCH 02/10] staging: lustre: make struct lu_site_bkt_data private NeilBrown
2018-05-01  4:10   ` Dilger, Andreas
2018-05-02  3:02   ` James Simmons
2018-05-03 23:39     ` NeilBrown [this message]
2018-05-07  1:42       ` Greg Kroah-Hartman
2018-05-01  3:52 ` [lustre-devel] [PATCH 03/10] staging: lustre: lu_object: discard extra lru count NeilBrown
2018-05-01  4:19   ` Dilger, Andreas
2018-05-04  0:08     ` NeilBrown
2018-05-01  3:52 ` [lustre-devel] [PATCH 07/10] staging: lustre: llite: remove redundant lookup in dump_pgcache NeilBrown
2018-05-01  3:52 ` [lustre-devel] [PATCH 08/10] staging: lustre: move misc-device registration closer to related code NeilBrown
2018-05-02 18:12   ` James Simmons
2018-05-01  3:52 ` [lustre-devel] [PATCH 06/10] staging: lustre: llite: use more private data in dump_pgcache NeilBrown
2018-05-01  3:52 ` [lustre-devel] [PATCH 09/10] staging: lustre: move remaining code from linux-module.c to module.c NeilBrown
2018-05-02 18:13   ` James Simmons
2018-05-01  3:52 ` [lustre-devel] [PATCH 05/10] staging: lustre: fold lu_object_new() into lu_object_find_at() NeilBrown
2018-05-01  3:52 ` [lustre-devel] [PATCH 10/10] staging: lustre: fix error deref in ll_splice_alias() NeilBrown
2018-05-02  3:05   ` James Simmons
2018-05-04  0:34     ` NeilBrown
2018-05-01  3:52 ` [lustre-devel] [PATCH 04/10] staging: lustre: lu_object: move retry logic inside htable_lookup NeilBrown
2018-05-01  8:22   ` Dilger, Andreas
2018-05-02 18:21     ` James Simmons
2018-05-04  0:30       ` NeilBrown
2018-05-04  1:30     ` NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2018-05-07  0:54 [lustre-devel] [PATCH 00/10 - v2] staging: lustre: assorted improvements NeilBrown
2018-05-07  0:54 ` [lustre-devel] [PATCH 02/10] staging: lustre: make struct lu_site_bkt_data private NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muxgfgx3.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=andreas.dilger@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).