[PATCH vv6.19-rc6 7/7] dlm: use coniditon expression instead return scalars
Alexander Aring <[email protected]>
| Newsgroups | dev.linux.lists.gfs2 |
|---|---|
| Message-ID | <[email protected]> |
Removes the condition and the scalar returns, instead we return directly the boolean expression. Signed-off-by: Alexander Aring <[email protected]> --- fs/dlm/lock.c | 47 ++++++++++++------------------------------- fs/dlm/member.c | 12 +++-------- fs/dlm/requestqueue.c | 5 +---- 3 files changed, 17 insertions(+), 47 deletions(-) diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 7ec30fbe33d92..d5bf194ae4f51 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -260,10 +260,8 @@ static inline bool is_master_copy(struct dlm_lkb *lkb) static inline bool middle_conversion(struct dlm_lkb *lkb) { - if ((lkb->lkb_grmode==DLM_LOCK_PR && lkb->lkb_rqmode==DLM_LOCK_CW) || - (lkb->lkb_rqmode==DLM_LOCK_PR && lkb->lkb_grmode==DLM_LOCK_CW)) - return true; - return false; + return ((lkb->lkb_grmode == DLM_LOCK_PR && lkb->lkb_rqmode == DLM_LOCK_CW) || + (lkb->lkb_rqmode == DLM_LOCK_PR && lkb->lkb_grmode == DLM_LOCK_CW)); } static inline bool down_conversion(struct dlm_lkb *lkb) @@ -2140,10 +2138,7 @@ static inline bool first_in_list(struct dlm_lkb *lkb, struct list_head *head) { struct dlm_lkb *first = list_entry(head->next, struct dlm_lkb, lkb_statequeue); - if (lkb->lkb_id == first->lkb_id) - return true; - - return false; + return (lkb->lkb_id == first->lkb_id); } /* Check if the given lkb conflicts with another lkb on the queue. */ @@ -2380,11 +2375,8 @@ static bool _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, bool now, * of the most restrictive lock granted on the resource. */ - if (!now && !conv && list_empty(&r->res_convertqueue) && - first_in_list(lkb, &r->res_waitqueue)) - return true; - - return false; + return (!now && !conv && list_empty(&r->res_convertqueue) && + first_in_list(lkb, &r->res_waitqueue)); } static bool can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, bool now, @@ -2544,16 +2536,11 @@ static int grant_pending_wait(struct dlm_rsb *r, int high, bool *cw, static bool lock_requires_bast(struct dlm_lkb *gr, int high, bool cw) { - if (gr->lkb_grmode == DLM_LOCK_PR && cw) { - if (gr->lkb_highbast < DLM_LOCK_EX) - return true; - return false; - } + if (gr->lkb_grmode == DLM_LOCK_PR && cw) + return (gr->lkb_highbast < DLM_LOCK_EX); - if (gr->lkb_highbast < high && - !__dlm_compat_matrix[gr->lkb_grmode+1][high+1]) - return true; - return false; + return (gr->lkb_highbast < high && + !__dlm_compat_matrix[gr->lkb_grmode+1][high+1]); } static void grant_pending_locks(struct dlm_rsb *r, unsigned int *count) @@ -2595,15 +2582,10 @@ static void grant_pending_locks(struct dlm_rsb *r, unsigned int *count) static int modes_require_bast(struct dlm_lkb *gr, struct dlm_lkb *rq) { if ((gr->lkb_grmode == DLM_LOCK_PR && rq->lkb_rqmode == DLM_LOCK_CW) || - (gr->lkb_grmode == DLM_LOCK_CW && rq->lkb_rqmode == DLM_LOCK_PR)) { - if (gr->lkb_highbast < DLM_LOCK_EX) - return true; - return false; - } + (gr->lkb_grmode == DLM_LOCK_CW && rq->lkb_rqmode == DLM_LOCK_PR)) + return (gr->lkb_highbast < DLM_LOCK_EX); - if (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq)) - return true; - return false; + return (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq)); } static void send_bast_queue(struct dlm_rsb *r, struct list_head *head, @@ -5030,10 +5012,7 @@ static bool waiter_needs_recovery(struct dlm_ls *ls, struct dlm_lkb *lkb, if (dlm_no_directory(ls)) return true; - if (dlm_is_removed(ls, lkb->lkb_wait_nodeid)) - return true; - - return false; + return dlm_is_removed(ls, lkb->lkb_wait_nodeid); } /* Recovery for locks that are waiting for replies from nodes that are now diff --git a/fs/dlm/member.c b/fs/dlm/member.c index c34ddf726cb06..b670c4fc8f4c4 100644 --- a/fs/dlm/member.c +++ b/fs/dlm/member.c @@ -20,9 +20,7 @@ bool dlm_slots_version(const struct dlm_header *h) { - if ((le32_to_cpu(h->h_version) & 0x0000FFFF) < DLM_HEADER_SLOTS) - return false; - return true; + return !((le32_to_cpu(h->h_version) & 0x0000FFFF) < DLM_HEADER_SLOTS); } void dlm_slot_save(struct dlm_ls *ls, struct dlm_rcom *rc, @@ -355,18 +353,14 @@ static struct dlm_member *find_memb(struct list_head *head, int nodeid) bool dlm_is_member(struct dlm_ls *ls, int nodeid) { - if (find_memb(&ls->ls_nodes, nodeid)) - return true; - return false; + return !!find_memb(&ls->ls_nodes, nodeid); } bool dlm_is_removed(struct dlm_ls *ls, int nodeid) { WARN_ON_ONCE(!nodeid || nodeid == -1); - if (find_memb(&ls->ls_nodes_gone, nodeid)) - return true; - return false; + return !!find_memb(&ls->ls_nodes_gone, nodeid); } static void clear_memb_list(struct list_head *head, diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c index daffc8df61e76..ac18dd0c09df6 100644 --- a/fs/dlm/requestqueue.c +++ b/fs/dlm/requestqueue.c @@ -124,10 +124,7 @@ static bool purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid) type == cpu_to_le32(DLM_MSG_LOOKUP_REPLY)) return true; - if (!dlm_no_directory(ls)) - return false; - - return true; + return dlm_no_directory(ls); } void dlm_purge_requestqueue(struct dlm_ls *ls) -- 2.43.0