linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]md:dm.c Fix warning: statement with no effect
@ 2010-07-13  1:26 Justin P. Mattock
  2010-07-31 19:05 ` Justin P. Mattock
  0 siblings, 1 reply; 5+ messages in thread
From: Justin P. Mattock @ 2010-07-13  1:26 UTC (permalink / raw)
  To: dm-devel; +Cc: neilb, agk, linux-raid, linux-kernel, Justin P. Mattock

Ive noticed that having CONFIG_BLK_DEV_INTEGRITY=n I get warning messages generated by GCC(below)
  CC      drivers/md/dm.o
drivers/md/dm.c: In function 'split_bvec':
drivers/md/dm.c:1117:3: warning: statement with no effect
drivers/md/dm.c: In function 'clone_bio':
drivers/md/dm.c:1145:3: warning: statement with no effect

adding in some #ifdef's fixes this warning if someone chooses not to have 
CONFIG_BLK_DEV_INTEGRITY turned on. but keep in mind not sure if this is the best approach
i.e. should something be done in bio.h? 
Also this patch fixes a comment which was hard to read at first. Anyways have a look 
when you have time, and let me know.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 drivers/md/dm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index d21e128..7c1cb04 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1091,7 +1091,7 @@ static void dm_bio_destructor(struct bio *bio)
 }
 
 /*
- * Creates a little bio that is just does part of a bvec.
+ * Create a little bio that just does part of a bvec.
  */
 static struct bio *split_bvec(struct bio *bio, sector_t sector,
 			      unsigned short idx, unsigned int offset,
@@ -1114,7 +1114,9 @@ static struct bio *split_bvec(struct bio *bio, sector_t sector,
 	clone->bi_flags |= 1 << BIO_CLONED;
 
 	if (bio_integrity(bio)) {
+#ifdef CONFIG_BLK_DEV_INTEGRITY
 		bio_integrity_clone(clone, bio, GFP_NOIO, bs);
+#endif
 		bio_integrity_trim(clone,
 				   bio_sector_offset(bio, idx, offset), len);
 	}
@@ -1142,7 +1144,9 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector,
 	clone->bi_flags &= ~(1 << BIO_SEG_VALID);
 
 	if (bio_integrity(bio)) {
+#ifdef CONFIG_BLK_DEV_INTEGRITY
 		bio_integrity_clone(clone, bio, GFP_NOIO, bs);
+#endif
 
 		if (idx != bio->bi_idx || clone->bi_size < bio->bi_size)
 			bio_integrity_trim(clone,
-- 
1.7.1.rc1.21.gf3bd6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH]md:dm.c Fix warning: statement with no effect
  2010-07-13  1:26 [PATCH]md:dm.c Fix warning: statement with no effect Justin P. Mattock
@ 2010-07-31 19:05 ` Justin P. Mattock
  2010-07-31 19:07   ` Alasdair G Kergon
  0 siblings, 1 reply; 5+ messages in thread
From: Justin P. Mattock @ 2010-07-31 19:05 UTC (permalink / raw)
  To: Justin P. Mattock; +Cc: dm-devel, neilb, agk, linux-raid, linux-kernel

haven't heard any feedback on this any ideas?

> Ive noticed that having CONFIG_BLK_DEV_INTEGRITY=n I get warning messages generated by GCC(below)
>    CC      drivers/md/dm.o
> drivers/md/dm.c: In function 'split_bvec':
> drivers/md/dm.c:1117:3: warning: statement with no effect
> drivers/md/dm.c: In function 'clone_bio':
> drivers/md/dm.c:1145:3: warning: statement with no effect
>
> adding in some #ifdef's fixes this warning if someone chooses not to have
> CONFIG_BLK_DEV_INTEGRITY turned on. but keep in mind not sure if this is the best approach
> i.e. should something be done in bio.h?
> Also this patch fixes a comment which was hard to read at first. Anyways have a look
> when you have time, and let me know.
>
> Signed-off-by: Justin P. Mattock<justinmattock@gmail.com>
>
> ---
>   drivers/md/dm.c |    6 +++++-
>   1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index d21e128..7c1cb04 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -1091,7 +1091,7 @@ static void dm_bio_destructor(struct bio *bio)
>   }
>
>   /*
> - * Creates a little bio that is just does part of a bvec.
> + * Create a little bio that just does part of a bvec.
>    */
>   static struct bio *split_bvec(struct bio *bio, sector_t sector,
>   			      unsigned short idx, unsigned int offset,
> @@ -1114,7 +1114,9 @@ static struct bio *split_bvec(struct bio *bio, sector_t sector,
>   	clone->bi_flags |= 1<<  BIO_CLONED;
>
>   	if (bio_integrity(bio)) {
> +#ifdef CONFIG_BLK_DEV_INTEGRITY
>   		bio_integrity_clone(clone, bio, GFP_NOIO, bs);
> +#endif
>   		bio_integrity_trim(clone,
>   				   bio_sector_offset(bio, idx, offset), len);
>   	}
> @@ -1142,7 +1144,9 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector,
>   	clone->bi_flags&= ~(1<<  BIO_SEG_VALID);
>
>   	if (bio_integrity(bio)) {
> +#ifdef CONFIG_BLK_DEV_INTEGRITY
>   		bio_integrity_clone(clone, bio, GFP_NOIO, bs);
> +#endif
>
>   		if (idx != bio->bi_idx || clone->bi_size<  bio->bi_size)
>   			bio_integrity_trim(clone,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]md:dm.c Fix warning: statement with no effect
  2010-07-31 19:05 ` Justin P. Mattock
@ 2010-07-31 19:07   ` Alasdair G Kergon
  2010-07-31 19:13     ` Justin P. Mattock
  2010-08-01 22:23     ` Justin P. Mattock
  0 siblings, 2 replies; 5+ messages in thread
From: Alasdair G Kergon @ 2010-07-31 19:07 UTC (permalink / raw)
  To: Justin P. Mattock; +Cc: dm-devel, neilb, agk, linux-raid, linux-kernel

On Sat, Jul 31, 2010 at 12:05:04PM -0700, Justin P. Mattock wrote:
> haven't heard any feedback on this any ideas?
>> Ive noticed that having CONFIG_BLK_DEV_INTEGRITY=n I get warning messages generated by GCC(below)
>>    CC      drivers/md/dm.o
>> drivers/md/dm.c: In function 'split_bvec':
>> drivers/md/dm.c:1117:3: warning: statement with no effect
>> drivers/md/dm.c: In function 'clone_bio':
>> drivers/md/dm.c:1145:3: warning: statement with no effect

I'd suggest hiding it inside the .h files and not trying to scatter #ifdefs 
throughout the code.

Alasdair

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]md:dm.c Fix warning: statement with no effect
  2010-07-31 19:07   ` Alasdair G Kergon
@ 2010-07-31 19:13     ` Justin P. Mattock
  2010-08-01 22:23     ` Justin P. Mattock
  1 sibling, 0 replies; 5+ messages in thread
From: Justin P. Mattock @ 2010-07-31 19:13 UTC (permalink / raw)
  To: dm-devel, neilb, agk, linux-raid, linux-kernel

On 07/31/2010 12:07 PM, Alasdair G Kergon wrote:
> On Sat, Jul 31, 2010 at 12:05:04PM -0700, Justin P. Mattock wrote:
>> haven't heard any feedback on this any ideas?
>>> Ive noticed that having CONFIG_BLK_DEV_INTEGRITY=n I get warning messages generated by GCC(below)
>>>     CC      drivers/md/dm.o
>>> drivers/md/dm.c: In function 'split_bvec':
>>> drivers/md/dm.c:1117:3: warning: statement with no effect
>>> drivers/md/dm.c: In function 'clone_bio':
>>> drivers/md/dm.c:1145:3: warning: statement with no effect
>
> I'd suggest hiding it inside the .h files and not trying to scatter #ifdefs
> throughout the code.
>
> Alasdair
>
>


cool thanks.. I'll have a look and see if I can come up with something.

Justin P. Mattock

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]md:dm.c Fix warning: statement with no effect
  2010-07-31 19:07   ` Alasdair G Kergon
  2010-07-31 19:13     ` Justin P. Mattock
@ 2010-08-01 22:23     ` Justin P. Mattock
  1 sibling, 0 replies; 5+ messages in thread
From: Justin P. Mattock @ 2010-08-01 22:23 UTC (permalink / raw)
  To: dm-devel, neilb, agk, linux-raid, linux-kernel

On 07/31/2010 12:07 PM, Alasdair G Kergon wrote:
> On Sat, Jul 31, 2010 at 12:05:04PM -0700, Justin P. Mattock wrote:
>> haven't heard any feedback on this any ideas?
>>> Ive noticed that having CONFIG_BLK_DEV_INTEGRITY=n I get warning messages generated by GCC(below)
>>>     CC      drivers/md/dm.o
>>> drivers/md/dm.c: In function 'split_bvec':
>>> drivers/md/dm.c:1117:3: warning: statement with no effect
>>> drivers/md/dm.c: In function 'clone_bio':
>>> drivers/md/dm.c:1145:3: warning: statement with no effect
>
> I'd suggest hiding it inside the .h files and not trying to scatter #ifdefs
> throughout the code.
>
> Alasdair
>
>


o.k. this ones a bit tricky.. but I did finally get this to build clean.
below is an updated patch that gets me to build clean. Let me know if 
something other than this should be used.(or if this is a good solution 
then let me know and I'll resend)

<---cut--->

When building the kernel with CONFIG_BLK_DEV_INTEGRITY=n everything
gets sent(if Im reading this correctly) too:
(line #660 bio.h)
#else /* CONFIG_BLK_DEV_INTEGRITY */

#define bio_integrity(a)		(0)
#define bioset_integrity_create(a, b)	(0)
#define bio_integrity_prep(a)		(0)
#define bio_integrity_enabled(a)	(0)
#define bio_integrity_clone(a, b, c, d)	(0)
#define bioset_integrity_free(a)	do { } while (0)
#define bio_integrity_free(a, b)	do { } while (0)
#define bio_integrity_endio(a, b)	do { } while (0)
#define bio_integrity_advance(a, b)	do { } while (0)
#define bio_integrity_trim(a, b, c)	do { } while (0)
#define bio_integrity_split(a, b, c)	do { } while (0)
#define bio_integrity_set_tag(a, b, c)	do { } while (0)
#define bio_integrity_get_tag(a, b, c)	do { } while (0)
#define bio_integrity_init(a)		do { } while (0)

changing #else preprocessor to #elif !defined(CONFIG_BLK_DEV_INTEGRITY)
opposite of #if defined(CONFIG_BLK_DEV_INTEGRITY)
gets me to build dm.c without the warning message.
please have a look when you have time and let me know if this is a good
solution to this.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
  include/linux/bio.h |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7fc5606..a8259c8 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -657,7 +657,7 @@ extern int bioset_integrity_create(struct bio_set *, 
int);
  extern void bioset_integrity_free(struct bio_set *);
  extern void bio_integrity_init(void);

-#else /* CONFIG_BLK_DEV_INTEGRITY */
+#elif !defined(CONFIG_BLK_DEV_INTEGRITY) /* CONFIG_BLK_DEV_INTEGRITY */

  #define bio_integrity(a)		(0)
  #define bioset_integrity_create(a, b)	(0)
-- 1.7.1.rc1.21.gf3bd6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-01 22:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-13  1:26 [PATCH]md:dm.c Fix warning: statement with no effect Justin P. Mattock
2010-07-31 19:05 ` Justin P. Mattock
2010-07-31 19:07   ` Alasdair G Kergon
2010-07-31 19:13     ` Justin P. Mattock
2010-08-01 22:23     ` Justin P. Mattock

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).