From: James Simmons <jsimmons@infradead.org> To: lustre-devel@lists.lustre.org Subject: [lustre-devel] [PATCH 03/22] lustre: use BIT() macro where appropriate Date: Tue, 2 Jun 2020 20:59:42 -0400 Message-ID: <1591146001-27171-4-git-send-email-jsimmons@infradead.org> (raw) In-Reply-To: <1591146001-27171-1-git-send-email-jsimmons@infradead.org> From: Mr NeilBrown <neilb@suse.de> When accessing a bit in a bitmap/mask/flags-word it can be more readable to use BIT(num) rather than "1 << num". This patch makes that change to various places in lustre WC-bug-id: https://jira.whamcloud.com/browse/LU-6142 Lustre-commit: ff09273feadc9 ("LU-6142 lustre: use BIT() macro where appropriate") Signed-off-by: Mr NeilBrown <neilb@suse.de> Reviewed-on: https://review.whamcloud.com/38377 Reviewed-by: Olaf Faaland-LLNL <faaland1@llnl.gov> Reviewed-by: Gian-Carlo DeFazio <defazio1@llnl.gov> Reviewed-by: James Simmons <jsimmons@infradead.org> Reviewed-by: Oleg Drokin <green@whamcloud.com> Signed-off-by: James Simmons <jsimmons@infradead.org> --- fs/lustre/ldlm/ldlm_extent.c | 4 ++-- fs/lustre/ldlm/ldlm_resource.c | 2 +- fs/lustre/llite/file.c | 2 +- fs/lustre/lov/lov_cl_internal.h | 2 +- fs/lustre/osc/lproc_osc.c | 4 ++-- fs/lustre/ptlrpc/layout.c | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/lustre/ldlm/ldlm_extent.c b/fs/lustre/ldlm/ldlm_extent.c index 3e0f7a2..7474c85 100644 --- a/fs/lustre/ldlm/ldlm_extent.c +++ b/fs/lustre/ldlm/ldlm_extent.c @@ -157,7 +157,7 @@ void ldlm_extent_add_lock(struct ldlm_resource *res, LASSERT(RB_EMPTY_NODE(&lock->l_rb)); idx = lock_mode_to_index(lock->l_granted_mode); - LASSERT(lock->l_granted_mode == 1 << idx); + LASSERT(lock->l_granted_mode == BIT(idx)); LASSERT(lock->l_granted_mode == res->lr_itree[idx].lit_mode); tree = &res->lr_itree[idx]; @@ -202,7 +202,7 @@ void ldlm_extent_unlink_lock(struct ldlm_lock *lock) return; idx = lock_mode_to_index(lock->l_granted_mode); - LASSERT(lock->l_granted_mode == 1 << idx); + LASSERT(lock->l_granted_mode == BIT(idx)); tree = &res->lr_itree[idx]; tree->lit_size--; diff --git a/fs/lustre/ldlm/ldlm_resource.c b/fs/lustre/ldlm/ldlm_resource.c index a6572af..a461ca7 100644 --- a/fs/lustre/ldlm/ldlm_resource.c +++ b/fs/lustre/ldlm/ldlm_resource.c @@ -1023,7 +1023,7 @@ static struct ldlm_resource *ldlm_resource_new(enum ldlm_type ldlm_type) /* Initialize interval trees for each lock mode. */ for (idx = 0; idx < LCK_MODE_NUM; idx++) { res->lr_itree[idx].lit_size = 0; - res->lr_itree[idx].lit_mode = 1 << idx; + res->lr_itree[idx].lit_mode = BIT(idx); res->lr_itree[idx].lit_root = RB_ROOT_CACHED; } } diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index 871fa59..ce50fd9 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -4410,7 +4410,7 @@ int ll_have_md_lock(struct inode *inode, u64 *bits, flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK; for (i = 0; i < MDS_INODELOCK_NUMBITS && *bits != 0; i++) { - policy.l_inodebits.bits = *bits & (1 << i); + policy.l_inodebits.bits = *bits & BIT(i); if (policy.l_inodebits.bits == 0) continue; diff --git a/fs/lustre/lov/lov_cl_internal.h b/fs/lustre/lov/lov_cl_internal.h index 9dd523f..6796d88 100644 --- a/fs/lustre/lov/lov_cl_internal.h +++ b/fs/lustre/lov/lov_cl_internal.h @@ -83,7 +83,7 @@ struct lovsub_object; enum lov_device_flags { - LOV_DEV_INITIALIZED = 1 << 0 + LOV_DEV_INITIALIZED = BIT(0), }; /* diff --git a/fs/lustre/osc/lproc_osc.c b/fs/lustre/osc/lproc_osc.c index de35d32..9b43710 100644 --- a/fs/lustre/osc/lproc_osc.c +++ b/fs/lustre/osc/lproc_osc.c @@ -398,9 +398,9 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v) return 0; for (i = 0; i < ARRAY_SIZE(cksum_name); i++) { - if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0) + if ((BIT(i) & obd->u.cli.cl_supp_cksum_types) == 0) continue; - if (obd->u.cli.cl_cksum_type == (1 << i)) + if (obd->u.cli.cl_cksum_type == BIT(i)) seq_printf(m, "[%s] ", cksum_name[i]); else seq_printf(m, "%s ", cksum_name[i]); diff --git a/fs/lustre/ptlrpc/layout.c b/fs/lustre/ptlrpc/layout.c index 754c87d..1286547 100644 --- a/fs/lustre/ptlrpc/layout.c +++ b/fs/lustre/ptlrpc/layout.c @@ -817,17 +817,17 @@ enum rmf_flags { /** * The field is a string, must be NUL-terminated. */ - RMF_F_STRING = BIT(0), + RMF_F_STRING = BIT(0), /** * The field's buffer size need not match the declared @rmf_size. */ - RMF_F_NO_SIZE_CHECK = BIT(1), + RMF_F_NO_SIZE_CHECK = BIT(1), /** * The field's buffer size must be a whole multiple of the declared * @rmf_size and the @rmf_swabber function must work on the declared * @rmf_size worth of bytes. */ - RMF_F_STRUCT_ARRAY = BIT(2) + RMF_F_STRUCT_ARRAY = BIT(2), }; struct req_capsule; -- 1.8.3.1
next prev parent reply index Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-03 0:59 [lustre-devel] [PATCH 00/22] lustre: OpenSFS backport patches for May 29 2020 James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 01/22] lnet: libcfs: fix CPT handling for UP systems James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 02/22] lustre: use BIT() macro where appropriate in include James Simmons 2020-06-03 0:59 ` James Simmons [this message] 2020-06-03 0:59 ` [lustre-devel] [PATCH 04/22] lustre: ptlrpc: change LONG_UNLINK to PTLRPC_REQ_LONG_UNLINK James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 05/22] lustre: llite: use %pd to report dentry names James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 06/22] lnet: tidy lnet_discover and fix mem accounting bug James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 07/22] lustre: llite: prevent MAX_DIO_SIZE 32-bit truncation James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 08/22] lustre: llite: integrate statx() API with Lustre James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 09/22] lustre: ldlm: no current source if lu_ref_del not in same tsk James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 10/22] lnet: always pass struct lnet_md by reference James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 11/22] lustre: llite: fix read if readahead window smaller than rpc size James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 12/22] lustre: obdclass: bind zombie export cleanup workqueue James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 13/22] lnet: handle discovery off properly James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 14/22] lnet: Force full discovery cycle James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 15/22] lnet: set route aliveness properly James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 16/22] lnet: Correct the default LND timeout James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 17/22] lnet: Add lnet_lnd_timeout to sysfs James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 18/22] lnet: lnd: Allow independent ko2iblnd timeout James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 19/22] lnet: lnd: Allow independent socklnd timeout James Simmons 2020-06-03 0:59 ` [lustre-devel] [PATCH 20/22] lnet: lnd: gracefully handle unexpected events James Simmons 2020-06-03 1:00 ` [lustre-devel] [PATCH 21/22] lustre: update version to 2.13.54 James Simmons 2020-06-03 1:00 ` [lustre-devel] [PATCH 22/22] lnet: procs: print new line based on distro James Simmons
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=1591146001-27171-4-git-send-email-jsimmons@infradead.org \ --to=jsimmons@infradead.org \ --cc=lustre-devel@lists.lustre.org \ /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
Lustre-devel archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lustre-devel/0 lustre-devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lustre-devel lustre-devel/ https://lore.kernel.org/lustre-devel \ lustre-devel@lists.lustre.org public-inbox-index lustre-devel Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.lustre.lists.lustre-devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git