From: Greg Donald <gdonald@gmail.com>
To: Greg Kroah-Hartman <greg@kroah.com>,
Andreas Dilger <andreas.dilger@intel.com>,
Oleg Drokin <oleg.drokin@intel.com>,
linux-kernel@vger.kernel.org, Joe Perches <joe@perches.com>
Cc: Greg Donald <gdonald@gmail.com>
Subject: [PATCH] drivers: staging: lustre: Cleanup src/dst comparisons in obdo_cmp_md()
Date: Thu, 11 Sep 2014 18:38:25 -0500 [thread overview]
Message-ID: <1410478705-5052-1-git-send-email-gdonald@gmail.com> (raw)
Cleanup obdo_cmp_md() src/dst comparisons using bitwise OR assignments
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Donald <gdonald@gmail.com>
---
drivers/staging/lustre/lustre/obdclass/obdo.c | 32 +++++++++++++--------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
index b97433e..307ffe3 100644
--- a/drivers/staging/lustre/lustre/obdclass/obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
@@ -162,38 +162,38 @@ int obdo_cmp_md(struct obdo *dst, struct obdo *src, u32 compare)
int res = 0;
if (compare & OBD_MD_FLATIME)
- res = (res || (dst->o_atime != src->o_atime));
+ res |= dst->o_atime != src->o_atime;
if (compare & OBD_MD_FLMTIME)
- res = (res || (dst->o_mtime != src->o_mtime));
+ res |= dst->o_mtime != src->o_mtime;
if (compare & OBD_MD_FLCTIME)
- res = (res || (dst->o_ctime != src->o_ctime));
+ res |= dst->o_ctime != src->o_ctime;
if (compare & OBD_MD_FLSIZE)
- res = (res || (dst->o_size != src->o_size));
+ res |= dst->o_size != src->o_size;
if (compare & OBD_MD_FLBLOCKS) /* allocation of space */
- res = (res || (dst->o_blocks != src->o_blocks));
+ res |= dst->o_blocks != src->o_blocks;
if (compare & OBD_MD_FLBLKSZ)
- res = (res || (dst->o_blksize != src->o_blksize));
+ res |= dst->o_blksize != src->o_blksize;
if (compare & OBD_MD_FLTYPE)
- res = (res || (((dst->o_mode ^ src->o_mode) & S_IFMT) != 0));
+ res |= ((dst->o_mode ^ src->o_mode) & S_IFMT) != 0;
if (compare & OBD_MD_FLMODE)
- res = (res || (((dst->o_mode ^ src->o_mode) & ~S_IFMT) != 0));
+ res |= ((dst->o_mode ^ src->o_mode) & ~S_IFMT) != 0;
if (compare & OBD_MD_FLUID)
- res = (res || (dst->o_uid != src->o_uid));
+ res |= dst->o_uid != src->o_uid;
if (compare & OBD_MD_FLGID)
- res = (res || (dst->o_gid != src->o_gid));
+ res |= dst->o_gid != src->o_gid;
if (compare & OBD_MD_FLFLAGS)
- res = (res || (dst->o_flags != src->o_flags));
+ res |= dst->o_flags != src->o_flags;
if (compare & OBD_MD_FLNLINK)
- res = (res || (dst->o_nlink != src->o_nlink));
+ res |= dst->o_nlink != src->o_nlink;
if (compare & OBD_MD_FLFID) {
- res = (res || (dst->o_parent_seq != src->o_parent_seq));
- res = (res || (dst->o_parent_ver != src->o_parent_ver));
+ res |= dst->o_parent_seq != src->o_parent_seq;
+ res |= dst->o_parent_ver != src->o_parent_ver;
}
if (compare & OBD_MD_FLGENER)
- res = (res || (dst->o_parent_oid != src->o_parent_oid));
+ res |= dst->o_parent_oid != src->o_parent_oid;
/* XXX Don't know if these should be included here - wasn't previously
if ( compare & OBD_MD_FLINLINE )
- res = (res || memcmp(dst->o_inline, src->o_inline));
+ res |= memcmp(dst->o_inline, src->o_inline);
*/
return res;
}
--
1.9.1
reply other threads:[~2014-09-11 23:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1410478705-5052-1-git-send-email-gdonald@gmail.com \
--to=gdonald@gmail.com \
--cc=andreas.dilger@intel.com \
--cc=greg@kroah.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg.drokin@intel.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
all inboxes | Powered by JetHome®