diff mbox

[1/1,linux-next] ceph: fix bool assignments

Message ID 1412889395-19350-1-git-send-email-fabf@skynet.be (mailing list archive)
State New, archived
Headers show

Commit Message

Fabian Frederick Oct. 9, 2014, 9:16 p.m. UTC
Fix some coccinelle warnings:
fs/ceph/caps.c:2400:6-10: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2401:6-15: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2402:6-17: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2403:6-22: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2404:6-22: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2405:6-19: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2440:4-20: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2469:3-16: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2490:2-18: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2519:3-7: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2549:3-12: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2575:2-6: WARNING: Assignment of bool to 0/1
fs/ceph/caps.c:2589:3-7: WARNING: Assignment of bool to 0/1

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/ceph/caps.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

Comments

Dan Mick Oct. 10, 2014, 12:41 a.m. UTC | #1
On 10/09/2014 02:16 PM, Fabian Frederick wrote:
> Fix some coccinelle warnings:
> fs/ceph/caps.c:2400:6-10: WARNING: Assignment of bool to 0/1


> -	bool wake = 0;
> +	bool wake = false;

FWIW, that message is backwards: it should say "WARNING: Assignment of
0/1 to bool" (I know, it's a coccinelle issue, but..)


--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ilya Dryomov Oct. 10, 2014, 8:19 a.m. UTC | #2
On Fri, Oct 10, 2014 at 1:16 AM, Fabian Frederick <fabf@skynet.be> wrote:
> Fix some coccinelle warnings:
> fs/ceph/caps.c:2400:6-10: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2401:6-15: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2402:6-17: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2403:6-22: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2404:6-22: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2405:6-19: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2440:4-20: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2469:3-16: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2490:2-18: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2519:3-7: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2549:3-12: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2575:2-6: WARNING: Assignment of bool to 0/1
> fs/ceph/caps.c:2589:3-7: WARNING: Assignment of bool to 0/1
>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
>  fs/ceph/caps.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index 6d1cd45..7131327 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -2397,12 +2397,12 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>         u64 max_size = le64_to_cpu(grant->max_size);
>         struct timespec mtime, atime, ctime;
>         int check_caps = 0;
> -       bool wake = 0;
> -       bool writeback = 0;
> -       bool queue_trunc = 0;
> -       bool queue_invalidate = 0;
> -       bool queue_revalidate = 0;
> -       bool deleted_inode = 0;
> +       bool wake = false;
> +       bool writeback = false;
> +       bool queue_trunc = false;
> +       bool queue_invalidate = false;
> +       bool queue_revalidate = false;
> +       bool deleted_inode = false;
>
>         dout("handle_cap_grant inode %p cap %p mds%d seq %d %s\n",
>              inode, cap, mds, seq, ceph_cap_string(newcaps));
> @@ -2437,7 +2437,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>                         /* there were locked pages.. invalidate later
>                            in a separate thread. */
>                         if (ci->i_rdcache_revoking != ci->i_rdcache_gen) {
> -                               queue_invalidate = 1;
> +                               queue_invalidate = true;
>                                 ci->i_rdcache_revoking = ci->i_rdcache_gen;
>                         }
>                 }
> @@ -2466,7 +2466,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>                 set_nlink(inode, le32_to_cpu(grant->nlink));
>                 if (inode->i_nlink == 0 &&
>                     (newcaps & (CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL)))
> -                       deleted_inode = 1;
> +                       deleted_inode = true;
>         }
>
>         if ((issued & CEPH_CAP_XATTR_EXCL) == 0 && grant->xattr_len) {
> @@ -2487,7 +2487,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>         /* Do we need to revalidate our fscache cookie. Don't bother on the
>          * first cache cap as we already validate at cookie creation time. */
>         if ((issued & CEPH_CAP_FILE_CACHE) && ci->i_rdcache_gen > 1)
> -               queue_revalidate = 1;
> +               queue_revalidate = true;
>
>         if (newcaps & CEPH_CAP_ANY_RD) {
>                 /* ctime/mtime/atime? */
> @@ -2516,7 +2516,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>                                 ci->i_wanted_max_size = 0;  /* reset */
>                                 ci->i_requested_max_size = 0;
>                         }
> -                       wake = 1;
> +                       wake = true;
>                 }
>         }
>
> @@ -2546,7 +2546,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>                      ceph_cap_string(newcaps),
>                      ceph_cap_string(revoking));
>                 if (revoking & used & CEPH_CAP_FILE_BUFFER)
> -                       writeback = 1;  /* initiate writeback; will delay ack */
> +                       writeback = true;  /* initiate writeback; will delay ack */
>                 else if (revoking == CEPH_CAP_FILE_CACHE &&
>                          (newcaps & CEPH_CAP_FILE_LAZYIO) == 0 &&
>                          queue_invalidate)
> @@ -2572,7 +2572,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>                 cap->implemented |= newcaps; /* add bits only, to
>                                               * avoid stepping on a
>                                               * pending revocation */
> -               wake = 1;
> +               wake = true;
>         }
>         BUG_ON(cap->issued & ~cap->implemented);
>
> @@ -2586,7 +2586,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc,
>                 kick_flushing_inode_caps(mdsc, session, inode);
>                 up_read(&mdsc->snap_rwsem);
>                 if (newcaps & ~issued)
> -                       wake = 1;
> +                       wake = true;
>         }
>
>         if (queue_trunc) {

(CC'ing Yan just in case)

Applied.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ilya Dryomov Oct. 10, 2014, 8:24 a.m. UTC | #3
On Fri, Oct 10, 2014 at 4:41 AM, Dan Mick <dan.mick@inktank.com> wrote:
>
>
> On 10/09/2014 02:16 PM, Fabian Frederick wrote:
>> Fix some coccinelle warnings:
>> fs/ceph/caps.c:2400:6-10: WARNING: Assignment of bool to 0/1
>
>
>> -     bool wake = 0;
>> +     bool wake = false;
>
> FWIW, that message is backwards: it should say "WARNING: Assignment of
> 0/1 to bool" (I know, it's a coccinelle issue, but..)

Hi Julia,

See above, hopefully you are the right person to ask to forward this to
the right people ;)

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Fabian Frederick Oct. 10, 2014, 8:41 a.m. UTC | #4
> On 10 October 2014 at 10:24 Ilya Dryomov <ilya.dryomov@inktank.com> wrote:
>
>
> On Fri, Oct 10, 2014 at 4:41 AM, Dan Mick <dan.mick@inktank.com> wrote:
> >
> >
> > On 10/09/2014 02:16 PM, Fabian Frederick wrote:
> >> Fix some coccinelle warnings:
> >> fs/ceph/caps.c:2400:6-10: WARNING: Assignment of bool to 0/1
> >
> >
> >> -     bool wake = 0;
> >> +     bool wake = false;
> >
> > FWIW, that message is backwards: it should say "WARNING: Assignment of
> > 0/1 to bool" (I know, it's a coccinelle issue, but..)
>
> Hi Julia,
>
> See above, hopefully you are the right person to ask to forward this to
> the right people ;)
>
> Thanks,
>
>                 Ilya
Hi Ilya,

    Patch already send and acked:
http://marc.info/?l=linux-kernel&m=141292553109418&w=2

Regards,
Fabian
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 6d1cd45..7131327 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2397,12 +2397,12 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 	u64 max_size = le64_to_cpu(grant->max_size);
 	struct timespec mtime, atime, ctime;
 	int check_caps = 0;
-	bool wake = 0;
-	bool writeback = 0;
-	bool queue_trunc = 0;
-	bool queue_invalidate = 0;
-	bool queue_revalidate = 0;
-	bool deleted_inode = 0;
+	bool wake = false;
+	bool writeback = false;
+	bool queue_trunc = false;
+	bool queue_invalidate = false;
+	bool queue_revalidate = false;
+	bool deleted_inode = false;
 
 	dout("handle_cap_grant inode %p cap %p mds%d seq %d %s\n",
 	     inode, cap, mds, seq, ceph_cap_string(newcaps));
@@ -2437,7 +2437,7 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 			/* there were locked pages.. invalidate later
 			   in a separate thread. */
 			if (ci->i_rdcache_revoking != ci->i_rdcache_gen) {
-				queue_invalidate = 1;
+				queue_invalidate = true;
 				ci->i_rdcache_revoking = ci->i_rdcache_gen;
 			}
 		}
@@ -2466,7 +2466,7 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 		set_nlink(inode, le32_to_cpu(grant->nlink));
 		if (inode->i_nlink == 0 &&
 		    (newcaps & (CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL)))
-			deleted_inode = 1;
+			deleted_inode = true;
 	}
 
 	if ((issued & CEPH_CAP_XATTR_EXCL) == 0 && grant->xattr_len) {
@@ -2487,7 +2487,7 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 	/* Do we need to revalidate our fscache cookie. Don't bother on the
 	 * first cache cap as we already validate at cookie creation time. */
 	if ((issued & CEPH_CAP_FILE_CACHE) && ci->i_rdcache_gen > 1)
-		queue_revalidate = 1;
+		queue_revalidate = true;
 
 	if (newcaps & CEPH_CAP_ANY_RD) {
 		/* ctime/mtime/atime? */
@@ -2516,7 +2516,7 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 				ci->i_wanted_max_size = 0;  /* reset */
 				ci->i_requested_max_size = 0;
 			}
-			wake = 1;
+			wake = true;
 		}
 	}
 
@@ -2546,7 +2546,7 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 		     ceph_cap_string(newcaps),
 		     ceph_cap_string(revoking));
 		if (revoking & used & CEPH_CAP_FILE_BUFFER)
-			writeback = 1;  /* initiate writeback; will delay ack */
+			writeback = true;  /* initiate writeback; will delay ack */
 		else if (revoking == CEPH_CAP_FILE_CACHE &&
 			 (newcaps & CEPH_CAP_FILE_LAZYIO) == 0 &&
 			 queue_invalidate)
@@ -2572,7 +2572,7 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 		cap->implemented |= newcaps; /* add bits only, to
 					      * avoid stepping on a
 					      * pending revocation */
-		wake = 1;
+		wake = true;
 	}
 	BUG_ON(cap->issued & ~cap->implemented);
 
@@ -2586,7 +2586,7 @@  static void handle_cap_grant(struct ceph_mds_client *mdsc,
 		kick_flushing_inode_caps(mdsc, session, inode);
 		up_read(&mdsc->snap_rwsem);
 		if (newcaps & ~issued)
-			wake = 1;
+			wake = true;
 	}
 
 	if (queue_trunc) {