Lustre-devel archive on lore.kernel.org
 help / color / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 02/22] lustre: use BIT() macro where appropriate in include
Date: Tue,  2 Jun 2020 20:59:41 -0400
Message-ID: <1591146001-27171-3-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/include.

WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: c438fba7f068b ("LU-6142 lustre: use BIT() macro where appropriate in include")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/38376
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/include/cl_object.h  | 14 +++++++-------
 fs/lustre/include/lu_object.h  | 36 ++++++++++++++++++------------------
 fs/lustre/include/lustre_dlm.h |  8 ++++----
 fs/lustre/include/lustre_net.h | 32 ++++++++++++++++----------------
 fs/lustre/include/lustre_sec.h | 12 ++++++------
 fs/lustre/include/obd.h        |  2 +-
 6 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h
index cde89f67..a0b9e87 100644
--- a/fs/lustre/include/cl_object.h
+++ b/fs/lustre/include/cl_object.h
@@ -176,13 +176,13 @@ struct cl_attr {
  * Fields in cl_attr that are being set.
  */
 enum cl_attr_valid {
-	CAT_SIZE   = 1 << 0,
-	CAT_KMS    = 1 << 1,
-	CAT_MTIME  = 1 << 3,
-	CAT_ATIME  = 1 << 4,
-	CAT_CTIME  = 1 << 5,
-	CAT_BLOCKS = 1 << 6,
-	CAT_UID    = 1 << 7,
+	CAT_SIZE	= BIT(0),
+	CAT_KMS		= BIT(1),
+	CAT_MTIME	= BIT(3),
+	CAT_ATIME	= BIT(4),
+	CAT_CTIME	= BIT(5),
+	CAT_BLOCKS	= BIT(6),
+	CAT_UID		= BIT(7),
 	CAT_GID		= BIT(8),
 	CAT_PROJID	= BIT(9),
 };
diff --git a/fs/lustre/include/lu_object.h b/fs/lustre/include/lu_object.h
index 6886177..2a2f38e 100644
--- a/fs/lustre/include/lu_object.h
+++ b/fs/lustre/include/lu_object.h
@@ -299,11 +299,11 @@ struct lu_device {
  */
 enum lu_device_tag {
 	/** this is meta-data device */
-	LU_DEVICE_MD = (1 << 0),
+	LU_DEVICE_MD	= BIT(0),
 	/** this is data device */
-	LU_DEVICE_DT = (1 << 1),
+	LU_DEVICE_DT	= BIT(1),
 	/** data device in the client stack */
-	LU_DEVICE_CL = (1 << 2)
+	LU_DEVICE_CL	= BIT(2)
 };
 
 /**
@@ -477,8 +477,8 @@ enum lu_object_header_flags {
 };
 
 enum lu_object_header_attr {
-	LOHA_EXISTS	= 1 << 0,
-	LOHA_REMOTE	= 1 << 1,
+	LOHA_EXISTS	= BIT(0),
+	LOHA_REMOTE	= BIT(1),
 	/**
 	 * UNIX file type is stored in S_IFMT bits.
 	 */
@@ -874,7 +874,7 @@ struct lu_rdpg {
 };
 
 enum lu_xattr_flags {
-	LU_XATTR_REPLACE = (1 << 0),
+	LU_XATTR_REPLACE = BIT(0),
 	LU_XATTR_CREATE	 = BIT(1),
 	LU_XATTR_MERGE   = BIT(2),
 	LU_XATTR_SPLIT	 = BIT(3),
@@ -964,36 +964,36 @@ enum lu_context_tag {
 	/**
 	 * Thread on md server
 	 */
-	LCT_MD_THREAD		= 1 << 0,
+	LCT_MD_THREAD		= BIT(0),
 	/**
 	 * Thread on dt server
 	 */
-	LCT_DT_THREAD		= 1 << 1,
+	LCT_DT_THREAD		= BIT(1),
 	/**
 	 * Context for transaction handle
 	 */
-	LCT_TX_HANDLE		= 1 << 2,
+	LCT_TX_HANDLE		= BIT(2),
 	/**
 	 * Thread on client
 	 */
-	LCT_CL_THREAD		= 1 << 3,
+	LCT_CL_THREAD		= BIT(3),
 	/**
 	 * A per-request session on a server, and a per-system-call session on
 	 * a client.
 	 */
-	LCT_SESSION		= 1 << 4,
+	LCT_SESSION		= BIT(4),
 	/**
 	 * A per-request data on OSP device
 	 */
-	LCT_OSP_THREAD		= 1 << 5,
+	LCT_OSP_THREAD		= BIT(5),
 	/**
 	 * MGS device thread
 	 */
-	LCT_MG_THREAD		= 1 << 6,
+	LCT_MG_THREAD		= BIT(6),
 	/**
 	 * Context for local operations
 	 */
-	LCT_LOCAL		= 1 << 7,
+	LCT_LOCAL		= BIT(7),
 	/**
 	 * session for server thread
 	 **/
@@ -1003,20 +1003,20 @@ enum lu_context_tag {
 	 * non-NULL lu_context_key::lct_exit() method. This is used to
 	 * optimize lu_context_exit() call.
 	 */
-	LCT_HAS_EXIT		= 1 << 28,
+	LCT_HAS_EXIT		= BIT(28),
 	/**
 	 * Don't add references for modules creating key values in that context.
 	 * This is only for contexts used internally by lu_object framework.
 	 */
-	LCT_NOREF		= 1 << 29,
+	LCT_NOREF		= BIT(29),
 	/**
 	 * Key is being prepared for retiring, don't create new values for it.
 	 */
-	LCT_QUIESCENT		= 1 << 30,
+	LCT_QUIESCENT		= BIT(30),
 	/**
 	 * Context should be remembered.
 	 */
-	LCT_REMEMBER		= 1 << 31,
+	LCT_REMEMBER		= BIT(31),
 	/**
 	 * Contexts usable in cache shrinker thread.
 	 */
diff --git a/fs/lustre/include/lustre_dlm.h b/fs/lustre/include/lustre_dlm.h
index 174b314..74c380e 100644
--- a/fs/lustre/include/lustre_dlm.h
+++ b/fs/lustre/include/lustre_dlm.h
@@ -91,8 +91,8 @@ enum ldlm_error {
  * first speaking to a server.
  */
 enum ldlm_side {
-	LDLM_NAMESPACE_SERVER = 1 << 0,
-	LDLM_NAMESPACE_CLIENT = 1 << 1
+	LDLM_NAMESPACE_SERVER = 0x01,
+	LDLM_NAMESPACE_CLIENT = 0x02
 };
 
 /**
@@ -293,8 +293,8 @@ struct ldlm_valblock_ops {
  * Greedy means release cached locks aggressively
  */
 enum ldlm_appetite {
-	LDLM_NAMESPACE_GREEDY = 1 << 0,
-	LDLM_NAMESPACE_MODEST = 1 << 1
+	LDLM_NAMESPACE_GREEDY = BIT(0),
+	LDLM_NAMESPACE_MODEST = BIT(1),
 };
 
 struct ldlm_ns_bucket {
diff --git a/fs/lustre/include/lustre_net.h b/fs/lustre/include/lustre_net.h
index cad69a0..a94d826 100644
--- a/fs/lustre/include/lustre_net.h
+++ b/fs/lustre/include/lustre_net.h
@@ -386,8 +386,8 @@ struct ptlrpc_client {
 
 /** state flags of requests */
 /* XXX only ones left are those used by the bulk descs as well! */
-#define PTL_RPC_FL_INTR      (1 << 0)  /* reply wait was interrupted by user */
-#define PTL_RPC_FL_TIMEOUT   (1 << 7)  /* request timed out waiting for reply */
+#define PTL_RPC_FL_INTR      BIT(0)  /* reply wait was interrupted by user */
+#define PTL_RPC_FL_TIMEOUT   BIT(7)  /* request timed out waiting for reply */
 
 #define REQ_MAX_ACK_LOCKS 8
 
@@ -1013,7 +1013,7 @@ static inline bool ptlrpc_nrs_req_can_move(struct ptlrpc_request *req)
 static inline bool lustre_req_swabbed(struct ptlrpc_request *req, size_t index)
 {
 	LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
-	return req->rq_req_swab_mask & (1 << index);
+	return req->rq_req_swab_mask & BIT(index);
 }
 
 /**
@@ -1022,7 +1022,7 @@ static inline bool lustre_req_swabbed(struct ptlrpc_request *req, size_t index)
 static inline bool lustre_rep_swabbed(struct ptlrpc_request *req, size_t index)
 {
 	LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
-	return req->rq_rep_swab_mask & (1 << index);
+	return req->rq_rep_swab_mask & BIT(index);
 }
 
 /**
@@ -1048,8 +1048,8 @@ static inline void lustre_set_req_swabbed(struct ptlrpc_request *req,
 					  size_t index)
 {
 	LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
-	LASSERT((req->rq_req_swab_mask & (1 << index)) == 0);
-	req->rq_req_swab_mask |= 1 << index;
+	LASSERT((req->rq_req_swab_mask & BIT(index)) == 0);
+	req->rq_req_swab_mask |= BIT(index);
 }
 
 /**
@@ -1059,8 +1059,8 @@ static inline void lustre_set_rep_swabbed(struct ptlrpc_request *req,
 					  size_t index)
 {
 	LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
-	LASSERT((req->rq_rep_swab_mask & (1 << index)) == 0);
-	req->rq_rep_swab_mask |= 1 << index;
+	LASSERT((req->rq_rep_swab_mask & BIT(index)) == 0);
+	req->rq_rep_swab_mask |= BIT(index);
 }
 
 /**
@@ -1274,10 +1274,10 @@ struct ptlrpc_bulk_desc {
 };
 
 enum {
-	SVC_STOPPED     = 1 << 0,
-	SVC_STOPPING    = 1 << 1,
-	SVC_STARTING    = 1 << 2,
-	SVC_RUNNING     = 1 << 3,
+	SVC_STOPPED     = BIT(0),
+	SVC_STOPPING    = BIT(1),
+	SVC_STARTING    = BIT(2),
+	SVC_RUNNING     = BIT(3),
 };
 
 #define PTLRPC_THR_NAME_LEN		32
@@ -1694,21 +1694,21 @@ enum ptlrpcd_ctl_flags {
 	/**
 	 * Ptlrpc thread start flag.
 	 */
-	LIOD_START       = 1 << 0,
+	LIOD_START	= BIT(0),
 	/**
 	 * Ptlrpc thread stop flag.
 	 */
-	LIOD_STOP	= 1 << 1,
+	LIOD_STOP	= BIT(1),
 	/**
 	 * Ptlrpc thread force flag (only stop force so far).
 	 * This will cause aborting any inflight rpcs handled
 	 * by thread if LIOD_STOP is specified.
 	 */
-	LIOD_FORCE       = 1 << 2,
+	LIOD_FORCE       = BIT(2),
 	/**
 	 * This is a recovery ptlrpc thread.
 	 */
-	LIOD_RECOVERY    = 1 << 3,
+	LIOD_RECOVERY    = BIT(3),
 };
 
 /**
diff --git a/fs/lustre/include/lustre_sec.h b/fs/lustre/include/lustre_sec.h
index e265868..aec30bc 100644
--- a/fs/lustre/include/lustre_sec.h
+++ b/fs/lustre/include/lustre_sec.h
@@ -467,12 +467,12 @@ struct ptlrpc_ctx_ops {
 #define PTLRPC_CTX_CACHED_BIT		(8)  /* in ctx cache (hash etc.) */
 #define PTLRPC_CTX_ETERNAL_BIT		(9)  /* always valid */
 
-#define PTLRPC_CTX_NEW			(1 << PTLRPC_CTX_NEW_BIT)
-#define PTLRPC_CTX_UPTODATE		(1 << PTLRPC_CTX_UPTODATE_BIT)
-#define PTLRPC_CTX_DEAD			(1 << PTLRPC_CTX_DEAD_BIT)
-#define PTLRPC_CTX_ERROR		(1 << PTLRPC_CTX_ERROR_BIT)
-#define PTLRPC_CTX_CACHED		(1 << PTLRPC_CTX_CACHED_BIT)
-#define PTLRPC_CTX_ETERNAL		(1 << PTLRPC_CTX_ETERNAL_BIT)
+#define PTLRPC_CTX_NEW			BIT(PTLRPC_CTX_NEW_BIT)
+#define PTLRPC_CTX_UPTODATE		BIT(PTLRPC_CTX_UPTODATE_BIT)
+#define PTLRPC_CTX_DEAD			BIT(PTLRPC_CTX_DEAD_BIT)
+#define PTLRPC_CTX_ERROR		BIT(PTLRPC_CTX_ERROR_BIT)
+#define PTLRPC_CTX_CACHED		BIT(PTLRPC_CTX_CACHED_BIT)
+#define PTLRPC_CTX_ETERNAL		BIT(PTLRPC_CTX_ETERNAL_BIT)
 
 #define PTLRPC_CTX_STATUS_MASK	       (PTLRPC_CTX_NEW_BIT	| \
 					PTLRPC_CTX_UPTODATE	| \
diff --git a/fs/lustre/include/obd.h b/fs/lustre/include/obd.h
index bf3273a..0ff19c8 100644
--- a/fs/lustre/include/obd.h
+++ b/fs/lustre/include/obd.h
@@ -702,7 +702,7 @@ enum md_cli_flags {
 	CLI_HASH64		= BIT(2),
 	CLI_API32		= BIT(3),
 	CLI_MIGRATE		= BIT(4),
-	CLI_DIRTY_DATA	= 1 << 5,
+	CLI_DIRTY_DATA		= BIT(5),
 };
 
 enum md_op_code {
-- 
1.8.3.1

  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 ` James Simmons [this message]
2020-06-03  0:59 ` [lustre-devel] [PATCH 03/22] lustre: use BIT() macro where appropriate James Simmons
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-3-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