* [PATCH] f2fs: use extra parenthesis around assignment/condition
@ 2017-10-17 9:07 Arnd Bergmann
2017-10-17 9:51 ` Jan Kara
2017-10-17 13:36 ` [f2fs-dev] " Chao Yu
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-10-17 9:07 UTC (permalink / raw)
To: Jan Kara, Andrew Morton
Cc: Daniel Jordan, Chao Yu, Arnd Bergmann, Jaegeuk Kim, Kinglong Mee,
Yunlei He, linux-f2fs-devel, linux-kernel
gcc warns that writing a while() loop with an assignment as the condition
looks suspiciously like a comparison, and suggests a workaround:
fs/f2fs/checkpoint.c: In function 'sync_meta_pages':
fs/f2fs/checkpoint.c:321:9: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
while (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
This seems reasonable, so let's do that.
Fixes: 4aba7297f4a5 ("f2fs: simplify page iteration loops")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
The warning is from mmotm. Andrew, please fold this fix into the
patch that caused the warning, unless there are objections.
---
fs/f2fs/checkpoint.c | 4 ++--
fs/f2fs/node.c | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 3ed9dcbf70ae..6124f8710dc3 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -318,8 +318,8 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
blk_start_plug(&plug);
- while (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
- PAGECACHE_TAG_DIRTY)) {
+ while ((nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
+ PAGECACHE_TAG_DIRTY))) {
int i;
for (i = 0; i < nr_pages; i++) {
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index d4ceb9ebfe92..d6e4df0bb622 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1285,8 +1285,8 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
pagevec_init(&pvec, 0);
index = 0;
- while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
- PAGECACHE_TAG_DIRTY)) {
+ while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
+ PAGECACHE_TAG_DIRTY))) {
int i;
for (i = 0; i < nr_pages; i++) {
@@ -1439,8 +1439,8 @@ int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
pagevec_init(&pvec, 0);
index = 0;
- while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
- PAGECACHE_TAG_DIRTY)) {
+ while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
+ PAGECACHE_TAG_DIRTY))) {
int i;
for (i = 0; i < nr_pages; i++) {
@@ -1552,8 +1552,8 @@ int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc,
next_step:
index = 0;
- while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
- PAGECACHE_TAG_DIRTY)) {
+ while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
+ PAGECACHE_TAG_DIRTY))) {
int i;
for (i = 0; i < nr_pages; i++) {
@@ -1650,8 +1650,8 @@ int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino)
pagevec_init(&pvec, 0);
- while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
- PAGECACHE_TAG_WRITEBACK)) {
+ while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
+ PAGECACHE_TAG_WRITEBACK))) {
int i;
for (i = 0; i < nr_pages; i++) {
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: use extra parenthesis around assignment/condition
2017-10-17 9:07 [PATCH] f2fs: use extra parenthesis around assignment/condition Arnd Bergmann
@ 2017-10-17 9:51 ` Jan Kara
2017-10-17 13:36 ` [f2fs-dev] " Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2017-10-17 9:51 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jan Kara, linux-kernel, Daniel Jordan, Yunlei He, Jaegeuk Kim,
Andrew Morton, linux-f2fs-devel
On Tue 17-10-17 11:07:12, Arnd Bergmann wrote:
> gcc warns that writing a while() loop with an assignment as the condition
> looks suspiciously like a comparison, and suggests a workaround:
>
> fs/f2fs/checkpoint.c: In function 'sync_meta_pages':
> fs/f2fs/checkpoint.c:321:9: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
> while (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
>
> This seems reasonable, so let's do that.
>
> Fixes: 4aba7297f4a5 ("f2fs: simplify page iteration loops")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> The warning is from mmotm. Andrew, please fold this fix into the
> patch that caused the warning, unless there are objections.
Yeah, thanks for fixing this.
Honza
> ---
> fs/f2fs/checkpoint.c | 4 ++--
> fs/f2fs/node.c | 16 ++++++++--------
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 3ed9dcbf70ae..6124f8710dc3 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -318,8 +318,8 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
>
> blk_start_plug(&plug);
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index d4ceb9ebfe92..d6e4df0bb622 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1285,8 +1285,8 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
> pagevec_init(&pvec, 0);
> index = 0;
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> @@ -1439,8 +1439,8 @@ int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
> pagevec_init(&pvec, 0);
> index = 0;
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> @@ -1552,8 +1552,8 @@ int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc,
> next_step:
> index = 0;
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> @@ -1650,8 +1650,8 @@ int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino)
>
> pagevec_init(&pvec, 0);
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_WRITEBACK)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_WRITEBACK))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> --
> 2.9.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: use extra parenthesis around assignment/condition
2017-10-17 9:07 [PATCH] f2fs: use extra parenthesis around assignment/condition Arnd Bergmann
2017-10-17 9:51 ` Jan Kara
@ 2017-10-17 13:36 ` Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2017-10-17 13:36 UTC (permalink / raw)
To: Arnd Bergmann, Jan Kara, Andrew Morton
Cc: linux-kernel, Daniel Jordan, Yunlei He, Jaegeuk Kim,
linux-f2fs-devel
On 2017/10/17 17:07, Arnd Bergmann wrote:
> gcc warns that writing a while() loop with an assignment as the condition
> looks suspiciously like a comparison, and suggests a workaround:
>
> fs/f2fs/checkpoint.c: In function 'sync_meta_pages':
> fs/f2fs/checkpoint.c:321:9: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
> while (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
>
> This seems reasonable, so let's do that.
>
> Fixes: 4aba7297f4a5 ("f2fs: simplify page iteration loops")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
> ---
> The warning is from mmotm. Andrew, please fold this fix into the
> patch that caused the warning, unless there are objections.
> ---
> fs/f2fs/checkpoint.c | 4 ++--
> fs/f2fs/node.c | 16 ++++++++--------
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 3ed9dcbf70ae..6124f8710dc3 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -318,8 +318,8 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
>
> blk_start_plug(&plug);
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index d4ceb9ebfe92..d6e4df0bb622 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1285,8 +1285,8 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
> pagevec_init(&pvec, 0);
> index = 0;
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> @@ -1439,8 +1439,8 @@ int fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
> pagevec_init(&pvec, 0);
> index = 0;
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> @@ -1552,8 +1552,8 @@ int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc,
> next_step:
> index = 0;
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_DIRTY)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_DIRTY))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
> @@ -1650,8 +1650,8 @@ int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino)
>
> pagevec_init(&pvec, 0);
>
> - while (nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> - PAGECACHE_TAG_WRITEBACK)) {
> + while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index,
> + PAGECACHE_TAG_WRITEBACK))) {
> int i;
>
> for (i = 0; i < nr_pages; i++) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-17 13:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 9:07 [PATCH] f2fs: use extra parenthesis around assignment/condition Arnd Bergmann
2017-10-17 9:51 ` Jan Kara
2017-10-17 13:36 ` [f2fs-dev] " Chao Yu
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).