mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: "John L. Hammond" <john.hammond@intel.com>
Cc: andreas.dilger@intel.com, oleg.drokin@intel.com,
	uja.ornl@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: lustre: fix undefined references to obd_memory
Date: Fri, 19 Sep 2014 16:10:23 -0700	[thread overview]
Message-ID: <20140919231023.GA25259@kroah.com> (raw)
In-Reply-To: <1410791693-3729-1-git-send-email-john.hammond@intel.com>

On Mon, Sep 15, 2014 at 09:34:53AM -0500, John L. Hammond wrote:
> From: "John L. Hammond" <john.hammond@intel.com>
> 
> If CONFIG_PROC_FS=n then obd_memory is not defined. So put the setup
> and cleanup of this variable within #ifdef CONFIG_PROC_FS guards.
> 
> Signed-off-by: John L. Hammond <john.hammond@intel.com>
> ---
>  .../staging/lustre/lustre/include/obd_support.h    |    2 ++
>  drivers/staging/lustre/lustre/obdclass/class_obd.c |    5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
> index 2991d2e..408ce7f 100644
> --- a/drivers/staging/lustre/lustre/include/obd_support.h
> +++ b/drivers/staging/lustre/lustre/include/obd_support.h
> @@ -43,12 +43,14 @@
>  #include "lprocfs_status.h"
>  
>  /* global variables */
> +#ifdef CONFIG_PROC_FS
>  extern struct lprocfs_stats *obd_memory;
>  enum {
>  	OBD_MEMORY_STAT = 0,
>  	OBD_MEMORY_PAGES_STAT = 1,
>  	OBD_STATS_NUM,
>  };
> +#endif /* CONFIG_PROC_FS */
>  
>  extern unsigned int obd_debug_peer_on_timeout;
>  extern unsigned int obd_dump_on_timeout;
> diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
> index 8b8d338..2939f0c 100644
> --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
> +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
> @@ -534,6 +534,7 @@ static int __init init_obdclass(void)
>  	spin_lock_init(&obd_types_lock);
>  	obd_zombie_impexp_init();
>  
> +#ifdef CONFIG_PROC_FS
>  	obd_memory = lprocfs_alloc_stats(OBD_STATS_NUM,
>  					 LPROCFS_STATS_FLAG_NONE |
>  					 LPROCFS_STATS_FLAG_IRQ_SAFE);
> @@ -548,6 +549,7 @@ static int __init init_obdclass(void)
>  	lprocfs_counter_init(obd_memory, OBD_MEMORY_PAGES_STAT,
>  			     LPROCFS_CNTR_AVGMINMAX,
>  			     "pagesused", "pages");
> +#endif /* CONFIG_PROC_FS */
>  
>  	err = obd_init_checks();
>  	if (err == -EOVERFLOW)
> @@ -688,7 +690,10 @@ static void cleanup_obdclass(void)
>  	memory_max = obd_memory_max();
>  	pages_max = obd_pages_max();
>  
> +#ifdef CONFIG_PROC_FS
>  	lprocfs_free_stats(&obd_memory);
> +#endif /* CONFIG_PROC_FS */

That's horrid.

Don't put #ifdef lines in .c files, put the proper stuff in the .h
files, that way there is always a lprocfs_free_stats call.

thanks,

greg k-h

      reply	other threads:[~2014-09-19 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 14:34 John L. Hammond
2014-09-19 23:10 ` Greg KH [this message]

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=20140919231023.GA25259@kroah.com \
    --to=greg@kroah.com \
    --cc=andreas.dilger@intel.com \
    --cc=john.hammond@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    --cc=uja.ornl@gmail.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

Powered by JetHome