From patchwork Fri Oct 13 07:30:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 152357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1719409vqb; Fri, 13 Oct 2023 00:33:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeXepkYhvmkimpB3jYAiVs3BFp1dQtpKHUljwHYUs9tTmY+opx+9tRdSVRK/73ZgoWXYR/ X-Received: by 2002:a05:6870:e24f:b0:1dc:6f5b:c0a0 with SMTP id d15-20020a056870e24f00b001dc6f5bc0a0mr28037966oac.4.1697182399099; Fri, 13 Oct 2023 00:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697182399; cv=none; d=google.com; s=arc-20160816; b=N4t7sakpcsKe3vHQTgYNXzN9ETVTP2RYQslh8yf20aL3qUd9kmE7JPnHvx2s6wqH92 dmdCek02jVVMgBNNcqzXtdKKhm4Y1bhzeIRvYoRTTtGlrhPAF8IjZ9NnTExs5bF5ro76 HMvvxqLeMbm3F6+oKhxEGryFivEvvk02v1iBQ2BbVQuYcv6Q/dkoFzbosZ7kZ46z5Qiy fy0Uqvj8xYmAPYxQI0ZFu7t6FN2Dc5VLoyKYZfqIrfVULm7ZSWH+uUzVvQaMjoxKbsrE TqGrIcNnVSjemyZ1a4ODOAhyPEcBYqU7kxQnziTUvG0z4oLpvUNKhrNkhsaIQzjU0dMm 7EGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:subject:cc:to:from:date; bh=16Wo0vFWDkR5Pp18wkABTLKqT6mqbpQW7hT4stR7GjE=; fh=rLt+2nbm/xVfBVN4+4iEfWF8IqTi6wGQAa3OIw/WOio=; b=LMuI+I4se2FrSVef1hcwZLatxrn4Us2vFCTJqzS7V061J6AzwjuLDMZnt19BAOnefF 9Q7lz0k1NlpD50sUcjTLL3Jsj9ZfZZiwulJBCVBWCqSmyqEZpeNKmuxkZVEP7UNzAmlw ZqDHMInzCPD46oJ6Hv3QLcJON09wnUmirhE3RC0H9RRUll+CGMKfXRnGeAS8f+6jri70 yiF3lweaQwTsB4cN/gDrS1UWrNdWkjdZafJa2iec7L5k0aJS8dIpOP2tZi3qxMnAIuX6 w0ZLV6WIy31YT90ElBYuhTzdsE6o9DzDu4I5EPCHrjdRmbK9BaVunv6AwsNl4VOif30j DXbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bs184-20020a6328c1000000b005897bfc2ed1si3949040pgb.215.2023.10.13.00.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 00:33:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 93A8D82516D7; Fri, 13 Oct 2023 00:33:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229740AbjJMHdB (ORCPT + 19 others); Fri, 13 Oct 2023 03:33:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjJMHc7 (ORCPT ); Fri, 13 Oct 2023 03:32:59 -0400 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 292B4AD for ; Fri, 13 Oct 2023 00:32:58 -0700 (PDT) Received: from wangkailong$jari.cn ( [182.148.14.172] ) by ajax-webmail-localhost.localdomain (Coremail) ; Fri, 13 Oct 2023 15:30:59 +0800 (GMT+08:00) X-Originating-IP: [182.148.14.172] Date: Fri, 13 Oct 2023 15:30:59 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: "KaiLong Wang" To: mark@fasheh.com, jlbec@evilplan.org, akpm@linux-foundation.org Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] ocfs2/dlm: Clean up errors in dlmmaster.c X-Priority: 3 X-Mailer: Coremail Webmail Server Version 2023.1-cmXT6 build 20230419(ff23bf83) Copyright (c) 2002-2023 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn MIME-Version: 1.0 Message-ID: <7a92ebb0.967.18b27f217c1.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwD3lD8z8ihl+t7BAA--.754W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQADB2UnvzMAKgAHsm X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 13 Oct 2023 00:33:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779624731306546041 X-GMAIL-MSGID: 1779624731306546041 Fix the following errors reported by checkpatch: ERROR: switch and case should be at the same indent ERROR: "foo * bar" should be "foo *bar" ERROR: spaces required around that '=' (ctx:VxV) ERROR: open brace '{' following struct go on the same line ERROR: space required after that ',' (ctx:VxV) ERROR: spaces required around that '<' (ctx:VxV) Signed-off-by: KaiLong Wang --- fs/ocfs2/dlm/dlmmaster.c | 98 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index d610da8e2f24..d290715a0a3d 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c @@ -115,23 +115,23 @@ static int dlm_pre_master_reco_lockres(struct dlm_ctxt *dlm, int dlm_is_host_down(int errno) { switch (errno) { - case -EBADF: - case -ECONNREFUSED: - case -ENOTCONN: - case -ECONNRESET: - case -EPIPE: - case -EHOSTDOWN: - case -EHOSTUNREACH: - case -ETIMEDOUT: - case -ECONNABORTED: - case -ENETDOWN: - case -ENETUNREACH: - case -ENETRESET: - case -ESHUTDOWN: - case -ENOPROTOOPT: - case -EINVAL: /* if returned from our tcp code, + case -EBADF: + case -ECONNREFUSED: + case -ENOTCONN: + case -ECONNRESET: + case -EPIPE: + case -EHOSTDOWN: + case -EHOSTUNREACH: + case -ETIMEDOUT: + case -ECONNABORTED: + case -ENETDOWN: + case -ENETUNREACH: + case -ENETRESET: + case -ESHUTDOWN: + case -ENOPROTOOPT: + case -EINVAL: /* if returned from our tcp code, this means there is no socket */ - return 1; + return 1; } return 0; } @@ -698,12 +698,12 @@ static void dlm_lockres_drop_inflight_worker(struct dlm_ctxt *dlm, * to assert_master (or die). * */ -struct dlm_lock_resource * dlm_get_lock_resource(struct dlm_ctxt *dlm, +struct dlm_lock_resource *dlm_get_lock_resource(struct dlm_ctxt *dlm, const char *lockid, int namelen, int flags) { - struct dlm_lock_resource *tmpres=NULL, *res=NULL; + struct dlm_lock_resource *tmpres = NULL, *res = NULL; struct dlm_master_list_entry *mle = NULL; struct dlm_master_list_entry *alloc_mle = NULL; int blocked = 0; @@ -1144,16 +1144,14 @@ static int dlm_wait_for_lock_mastery(struct dlm_ctxt *dlm, return ret; } -struct dlm_bitmap_diff_iter -{ +struct dlm_bitmap_diff_iter { int curnode; unsigned long *orig_bm; unsigned long *cur_bm; unsigned long diff_bm[BITS_TO_LONGS(O2NM_MAX_NODES)]; }; -enum dlm_node_state_change -{ +enum dlm_node_state_change { NODE_DOWN = -1, NODE_NO_CHANGE = 0, NODE_UP @@ -1308,7 +1306,7 @@ static int dlm_do_master_request(struct dlm_lock_resource *res, { struct dlm_ctxt *dlm = mle->dlm; struct dlm_master_request request; - int ret, response=0, resend; + int ret, response = 0, resend; memset(&request, 0, sizeof(request)); request.node_idx = dlm->node_num; @@ -1351,31 +1349,31 @@ static int dlm_do_master_request(struct dlm_lock_resource *res, resend = 0; spin_lock(&mle->spinlock); switch (response) { - case DLM_MASTER_RESP_YES: - set_bit(to, mle->response_map); - mlog(0, "node %u is the master, response=YES\n", to); - mlog(0, "%s:%.*s: master node %u now knows I have a " - "reference\n", dlm->name, res->lockname.len, - res->lockname.name, to); - mle->master = to; - break; - case DLM_MASTER_RESP_NO: - mlog(0, "node %u not master, response=NO\n", to); - set_bit(to, mle->response_map); - break; - case DLM_MASTER_RESP_MAYBE: - mlog(0, "node %u not master, response=MAYBE\n", to); - set_bit(to, mle->response_map); - set_bit(to, mle->maybe_map); - break; - case DLM_MASTER_RESP_ERROR: - mlog(0, "node %u hit an error, resending\n", to); - resend = 1; - response = 0; - break; - default: - mlog(ML_ERROR, "bad response! %u\n", response); - BUG(); + case DLM_MASTER_RESP_YES: + set_bit(to, mle->response_map); + mlog(0, "node %u is the master, response=YES\n", to); + mlog(0, "%s:%.*s: master node %u now knows I have a " + "reference\n", dlm->name, res->lockname.len, + res->lockname.name, to); + mle->master = to; + break; + case DLM_MASTER_RESP_NO: + mlog(0, "node %u not master, response=NO\n", to); + set_bit(to, mle->response_map); + break; + case DLM_MASTER_RESP_MAYBE: + mlog(0, "node %u not master, response=MAYBE\n", to); + set_bit(to, mle->response_map); + set_bit(to, mle->maybe_map); + break; + case DLM_MASTER_RESP_ERROR: + mlog(0, "node %u hit an error, resending\n", to); + resend = 1; + response = 0; + break; + default: + mlog(ML_ERROR, "bad response! %u\n", response); + BUG(); } spin_unlock(&mle->spinlock); if (resend) { @@ -1699,7 +1697,7 @@ static int dlm_do_assert_master(struct dlm_ctxt *dlm, r = 0; } else if (r < 0) { /* ok, something horribly messed. kill thyself. */ - mlog(ML_ERROR,"during assert master of %.*s to %u, " + mlog(ML_ERROR, "during assert master of %.*s to %u, " "got %d.\n", namelen, lockname, to, r); spin_lock(&dlm->spinlock); spin_lock(&dlm->master_lock); @@ -2930,7 +2928,7 @@ static void dlm_remove_nonlocal_locks(struct dlm_ctxt *dlm, BUG_ON(res->owner == dlm->node_num); - for (i=0; i<3; i++) { + for (i = 0; i < 3; i++) { list_for_each_entry_safe(lock, next, queue, list) { if (lock->ml.node != dlm->node_num) { mlog(0, "putting lock for node %u\n",