* [PATCH] logfs: fix build warning
@ 2015-09-10 10:11 Sudip Mukherjee
2015-09-15 8:03 ` Sudip Mukherjee
2015-10-01 23:15 ` Andrew Morton
0 siblings, 2 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2015-09-10 10:11 UTC (permalink / raw)
To: Joern Engel, Prasad Joshi; +Cc: linux-kernel, logfs, Sudip Mukherjee
While building we were getting build warning of:
fs/logfs/dev_bdev.c: In function '__bdev_writeseg':
include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void) (&_min1 == &_min2); \
fs/logfs/dev_bdev.c:84:14: note: in expansion of macro 'min'
max_pages = min(nr_pages, BIO_MAX_PAGES);
fs/logfs/dev_bdev.c: In function 'do_erase':
include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void) (&_min1 == &_min2); \
fs/logfs/dev_bdev.c:174:14: note: in expansion of macro 'min'
max_pages = min(nr_pages, BIO_MAX_PAGES);
Lets use min_t and mention the type.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
fs/logfs/dev_bdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index a7fdbd8..a709d80 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -81,7 +81,7 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
unsigned int max_pages;
int i;
- max_pages = min(nr_pages, BIO_MAX_PAGES);
+ max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);
bio = bio_alloc(GFP_NOFS, max_pages);
BUG_ON(!bio);
@@ -171,7 +171,7 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
unsigned int max_pages;
int i;
- max_pages = min(nr_pages, BIO_MAX_PAGES);
+ max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);
bio = bio_alloc(GFP_NOFS, max_pages);
BUG_ON(!bio);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] logfs: fix build warning
2015-09-10 10:11 [PATCH] logfs: fix build warning Sudip Mukherjee
@ 2015-09-15 8:03 ` Sudip Mukherjee
2015-09-29 12:48 ` Sudip Mukherjee
2015-10-01 23:15 ` Andrew Morton
1 sibling, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-09-15 8:03 UTC (permalink / raw)
To: Joern Engel, Prasad Joshi; +Cc: linux-kernel, logfs, akpm
On Thu, Sep 10, 2015 at 03:41:04PM +0530, Sudip Mukherjee wrote:
> While building we were getting build warning of:
>
> fs/logfs/dev_bdev.c: In function '__bdev_writeseg':
> include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_min1 == &_min2); \
> fs/logfs/dev_bdev.c:84:14: note: in expansion of macro 'min'
> max_pages = min(nr_pages, BIO_MAX_PAGES);
>
> fs/logfs/dev_bdev.c: In function 'do_erase':
> include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_min1 == &_min2); \
> fs/logfs/dev_bdev.c:174:14: note: in expansion of macro 'min'
> max_pages = min(nr_pages, BIO_MAX_PAGES);
>
> Lets use min_t and mention the type.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
Hi,
I know its too early to ping. But I can still see the build warnings
with i386 allmodconfig. Build is at:
https://travis-ci.org/sudipm-mukherjee/parport/jobs/80365417
regards
sudip
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] logfs: fix build warning
2015-09-15 8:03 ` Sudip Mukherjee
@ 2015-09-29 12:48 ` Sudip Mukherjee
0 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2015-09-29 12:48 UTC (permalink / raw)
To: Joern Engel, Prasad Joshi; +Cc: linux-kernel, logfs, akpm
On Tue, Sep 15, 2015 at 01:33:15PM +0530, Sudip Mukherjee wrote:
> On Thu, Sep 10, 2015 at 03:41:04PM +0530, Sudip Mukherjee wrote:
> > While building we were getting build warning of:
> >
> > fs/logfs/dev_bdev.c: In function '__bdev_writeseg':
> > include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> > (void) (&_min1 == &_min2); \
> > fs/logfs/dev_bdev.c:84:14: note: in expansion of macro 'min'
> > max_pages = min(nr_pages, BIO_MAX_PAGES);
> >
> > fs/logfs/dev_bdev.c: In function 'do_erase':
> > include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> > (void) (&_min1 == &_min2); \
> > fs/logfs/dev_bdev.c:174:14: note: in expansion of macro 'min'
> > max_pages = min(nr_pages, BIO_MAX_PAGES);
> >
> > Lets use min_t and mention the type.
> >
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> Hi,
> I know its too early to ping. But I can still see the build warnings
> with i386 allmodconfig. Build is at:
> https://travis-ci.org/sudipm-mukherjee/parport/jobs/80365417
Another gentle ping. Build warning still shows with next-20150929.
regards
sudip
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] logfs: fix build warning
2015-09-10 10:11 [PATCH] logfs: fix build warning Sudip Mukherjee
2015-09-15 8:03 ` Sudip Mukherjee
@ 2015-10-01 23:15 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2015-10-01 23:15 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: Joern Engel, Prasad Joshi, linux-kernel, logfs
On Thu, 10 Sep 2015 15:41:04 +0530 Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
> While building we were getting build warning of:
>
> fs/logfs/dev_bdev.c: In function '__bdev_writeseg':
> include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_min1 == &_min2); \
> fs/logfs/dev_bdev.c:84:14: note: in expansion of macro 'min'
> max_pages = min(nr_pages, BIO_MAX_PAGES);
>
> fs/logfs/dev_bdev.c: In function 'do_erase':
> include/linux/kernel.h:601:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_min1 == &_min2); \
> fs/logfs/dev_bdev.c:174:14: note: in expansion of macro 'min'
> max_pages = min(nr_pages, BIO_MAX_PAGES);
>
> Lets use min_t and mention the type.
>
> ...
>
> --- a/fs/logfs/dev_bdev.c
> +++ b/fs/logfs/dev_bdev.c
> @@ -81,7 +81,7 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
> unsigned int max_pages;
> int i;
>
> - max_pages = min(nr_pages, BIO_MAX_PAGES);
> + max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);
>
> bio = bio_alloc(GFP_NOFS, max_pages);
> BUG_ON(!bio);
> @@ -171,7 +171,7 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
> unsigned int max_pages;
> int i;
>
> - max_pages = min(nr_pages, BIO_MAX_PAGES);
> + max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);
>
> bio = bio_alloc(GFP_NOFS, max_pages);
> BUG_ON(!bio);
I don't think it's logical for either __bdev_writeseg() or do_erase()
to use size_t for `nr_pages'. For "number of pagecache pages" we'd
normally use pgoff_t or unsigned long.
But they'd generate warnings as well, because BIO_MAX_PAGES is plain
old `int'. Ho hum.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-01 23:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-10 10:11 [PATCH] logfs: fix build warning Sudip Mukherjee
2015-09-15 8:03 ` Sudip Mukherjee
2015-09-29 12:48 ` Sudip Mukherjee
2015-10-01 23:15 ` Andrew Morton
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).