Skip to content

Commit e1af872

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: move internal flags to atomic ops
This patch will move the lkb_flags value to the recently introduced lkb_iflags value. For lkb_iflags we use atomic bit operations because some flags like DLM_IFL_CB_PENDING are used while non rsb lock is held to avoid issues with other flag manipulations which might run at the same time we switch to atomic bit operations. Snapshot the bit values to an uint32_t value is only used for debugging/logging use cases and don't need to be 100% correct. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 8a39dcd commit e1af872

6 files changed

Lines changed: 90 additions & 83 deletions

File tree

fs/dlm/debug_fs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static void print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb,
188188
lkb->lkb_ownpid,
189189
(unsigned long long)xid,
190190
lkb->lkb_exflags,
191-
lkb->lkb_flags,
191+
dlm_iflags_val(lkb),
192192
lkb->lkb_status,
193193
lkb->lkb_grmode,
194194
lkb->lkb_rqmode,
@@ -242,7 +242,7 @@ static void print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb,
242242
lkb->lkb_ownpid,
243243
(unsigned long long)xid,
244244
lkb->lkb_exflags,
245-
lkb->lkb_flags,
245+
dlm_iflags_val(lkb),
246246
lkb->lkb_status,
247247
lkb->lkb_grmode,
248248
lkb->lkb_rqmode,

fs/dlm/dlm_internal.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,18 @@ struct dlm_args {
194194
#define DLM_LKSTS_GRANTED 2
195195
#define DLM_LKSTS_CONVERT 3
196196

197-
/* lkb_flags */
198-
199-
#define DLM_IFL_MSTCPY 0x00010000
200-
#define DLM_IFL_RESEND 0x00020000
201-
#define DLM_IFL_DEAD 0x00040000
202-
#define DLM_IFL_OVERLAP_UNLOCK 0x00080000
203-
#define DLM_IFL_OVERLAP_CANCEL 0x00100000
204-
#define DLM_IFL_ENDOFLIFE 0x00200000
205-
#define DLM_IFL_DEADLOCK_CANCEL 0x01000000
206-
207-
#define DLM_IFL_CB_PENDING_BIT 0
197+
/* lkb_iflags */
198+
199+
#define DLM_IFL_MSTCPY_BIT 16
200+
#define __DLM_IFL_MIN_BIT DLM_IFL_MSTCPY_BIT
201+
#define DLM_IFL_RESEND_BIT 17
202+
#define DLM_IFL_DEAD_BIT 18
203+
#define DLM_IFL_OVERLAP_UNLOCK_BIT 19
204+
#define DLM_IFL_OVERLAP_CANCEL_BIT 20
205+
#define DLM_IFL_ENDOFLIFE_BIT 21
206+
#define DLM_IFL_DEADLOCK_CANCEL_BIT 24
207+
#define DLM_IFL_CB_PENDING_BIT 25
208+
#define __DLM_IFL_MAX_BIT DLM_IFL_CB_PENDING_BIT
208209

209210
/* lkb_dflags */
210211

@@ -235,7 +236,6 @@ struct dlm_lkb {
235236
uint32_t lkb_remid; /* lock ID on remote partner */
236237
uint32_t lkb_exflags; /* external flags from caller */
237238
uint32_t lkb_sbflags; /* lksb flags */
238-
uint32_t lkb_flags; /* internal flags */
239239
unsigned long lkb_dflags; /* distributed flags */
240240
unsigned long lkb_iflags; /* internal flags */
241241
uint32_t lkb_lvbseq; /* lvb sequence number */
@@ -748,6 +748,12 @@ static inline uint32_t dlm_flags_val(const unsigned long *addr,
748748
return val;
749749
}
750750

751+
static inline uint32_t dlm_iflags_val(const struct dlm_lkb *lkb)
752+
{
753+
return dlm_flags_val(&lkb->lkb_iflags, __DLM_IFL_MIN_BIT,
754+
__DLM_IFL_MAX_BIT);
755+
}
756+
751757
static inline uint32_t dlm_dflags_val(const struct dlm_lkb *lkb)
752758
{
753759
return dlm_flags_val(&lkb->lkb_dflags, __DLM_DFL_MIN_BIT,

0 commit comments

Comments
 (0)