From patchwork Thu Jan 31 17:19:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 10791049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8758B13BF for ; Thu, 31 Jan 2019 17:21:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F55E312DA for ; Thu, 31 Jan 2019 17:21:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63A7F31519; Thu, 31 Jan 2019 17:21:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D4C85312DA for ; Thu, 31 Jan 2019 17:21:12 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id F0B2221FE9D; Thu, 31 Jan 2019 09:20:18 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 2855B21FD61 for ; Thu, 31 Jan 2019 09:19:43 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 046FA5E6; Thu, 31 Jan 2019 12:19:36 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 02FDF46D; Thu, 31 Jan 2019 12:19:36 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 31 Jan 2019 12:19:19 -0500 Message-Id: <1548955170-13456-16-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 15/26] mgc: cleanup white spaces X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" X-Virus-Scanned: ClamAV using ClamSMTP The mgc code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 85 +++++++++++++------------ 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index dc80081..a4dfdc0 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -193,7 +193,7 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, struct super_block *sb) { struct config_llog_data *cld; - int rc; + int rc; CDEBUG(D_MGC, "do adding config log %s:%p\n", logname, cfg ? cfg->cfg_instance : NULL); @@ -267,8 +267,8 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, struct super_block *sb, int type, struct config_llog_instance *cfg) { - struct config_llog_instance lcfg = *cfg; - struct config_llog_data *cld; + struct config_llog_instance lcfg = *cfg; + struct config_llog_data *cld; lcfg.cfg_instance = sb ? (void *)sb : (void *)obd; @@ -296,9 +296,9 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, struct config_llog_data *sptlrpc_cld = NULL; struct config_llog_data *params_cld = NULL; struct config_llog_data *recover_cld = NULL; - char seclogname[32]; - char *ptr; - int rc; + char seclogname[32]; + char *ptr; + int rc; CDEBUG(D_MGC, "adding config log %s:%p\n", logname, cfg->cfg_instance); @@ -459,8 +459,8 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) { - struct obd_device *obd = data; - struct obd_import *imp; + struct obd_device *obd = data; + struct obd_import *imp; struct obd_connect_data *ocd; struct config_llog_data *cld; int rc; @@ -491,13 +491,14 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) } /* reenqueue any lost locks */ -#define RQ_RUNNING 0x1 -#define RQ_NOW 0x2 -#define RQ_LATER 0x4 -#define RQ_STOP 0x8 -#define RQ_PRECLEANUP 0x10 +#define RQ_RUNNING 0x01 +#define RQ_NOW 0x02 +#define RQ_LATER 0x04 +#define RQ_STOP 0x08 +#define RQ_PRECLEANUP 0x10 + static int rq_state; -static wait_queue_head_t rq_waitq; +static wait_queue_head_t rq_waitq; static DECLARE_COMPLETION(rq_exit); static DECLARE_COMPLETION(rq_start); @@ -620,7 +621,7 @@ static int mgc_requeue_thread(void *data) return 0; } -/* Add a cld to the list to requeue. Start the requeue thread if needed. +/* Add a cld to the list to requeue. Start the requeue thread if needed. * We are responsible for dropping the config log reference from here on out. */ static void mgc_requeue_add(struct config_llog_data *cld) @@ -647,8 +648,8 @@ static void mgc_requeue_add(struct config_llog_data *cld) static int mgc_llog_init(const struct lu_env *env, struct obd_device *obd) { - struct llog_ctxt *ctxt; - int rc; + struct llog_ctxt *ctxt; + int rc; /* setup only remote ctxt, the local disk context is switched per each * filesystem during mgc_fs_setup() @@ -941,9 +942,9 @@ static void mgc_notify_active(struct obd_device *unused) static int mgc_target_register(struct obd_export *exp, struct mgs_target_info *mti) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct mgs_target_info *req_mti, *rep_mti; - int rc; + int rc; req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MGS_TARGET_REG, LUSTRE_MGS_VERSION, @@ -1009,8 +1010,8 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, return rc; } if (KEY_IS(KEY_MGSSEC)) { - struct client_obd *cli = &exp->exp_obd->u.cli; - struct sptlrpc_flavor flvr; + struct client_obd *cli = &exp->exp_obd->u.cli; + struct sptlrpc_flavor flvr; /* * empty string means using current flavor, if which haven't @@ -1040,7 +1041,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, cli->cl_flvr_mgc = flvr; } else if (memcmp(&cli->cl_flvr_mgc, &flvr, sizeof(flvr)) != 0) { - char str[20]; + char str[20]; sptlrpc_flavor2name(&cli->cl_flvr_mgc, str, sizeof(str)); @@ -1125,15 +1126,15 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, { struct config_llog_instance *cfg = &cld->cld_cfg; struct mgs_nidtbl_entry *entry; - struct lustre_cfg *lcfg; - struct lustre_cfg_bufs bufs; - u64 prev_version = 0; + struct lustre_cfg *lcfg; + struct lustre_cfg_bufs bufs; + u64 prev_version = 0; char *inst; char *buf; - int bufsz; - int pos; - int rc = 0; - int off = 0; + int bufsz; + int pos; + int rc = 0; + int off = 0; LASSERT(cfg->cfg_instance); LASSERT(cfg->cfg_sb == cfg->cfg_instance); @@ -1149,11 +1150,11 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, } ++pos; - buf = inst + pos; + buf = inst + pos; bufsz = PAGE_SIZE - pos; while (datalen > 0) { - int entry_len = sizeof(*entry); + int entry_len = sizeof(*entry); int is_ost, i; struct obd_device *obd; char *obdname; @@ -1191,7 +1192,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, if (entry->mne_length < entry_len) break; - off += entry->mne_length; + off += entry->mne_length; datalen -= entry->mne_length; if (datalen < 0) break; @@ -1323,7 +1324,7 @@ static int mgc_process_recover_log(struct obd_device *obd, struct ptlrpc_request *req = NULL; struct config_llog_instance *cfg = &cld->cld_cfg; struct mgs_config_body *body; - struct mgs_config_res *res; + struct mgs_config_res *res; struct ptlrpc_bulk_desc *desc; struct page **pages; int nrpages; @@ -1380,9 +1381,9 @@ static int mgc_process_recover_log(struct obd_device *obd, goto out; } body->mcb_offset = cfg->cfg_last_idx + 1; - body->mcb_type = cld->cld_type; - body->mcb_bits = PAGE_SHIFT; - body->mcb_units = nrpages; + body->mcb_type = cld->cld_type; + body->mcb_bits = PAGE_SHIFT; + body->mcb_units = nrpages; /* allocate bulk transfer descriptor */ desc = ptlrpc_prep_bulk_imp(req, nrpages, 1, @@ -1483,11 +1484,11 @@ static int mgc_process_recover_log(struct obd_device *obd, static int mgc_process_cfg_log(struct obd_device *mgc, struct config_llog_data *cld, int local_only) { - struct llog_ctxt *ctxt; - struct lustre_sb_info *lsi = NULL; - int rc = 0; - bool sptlrpc_started = false; - struct lu_env *env; + struct llog_ctxt *ctxt; + struct lustre_sb_info *lsi = NULL; + int rc = 0; + bool sptlrpc_started = false; + struct lu_env *env; LASSERT(cld); LASSERT(mutex_is_locked(&cld->cld_lock)); @@ -1570,7 +1571,7 @@ static bool mgc_import_in_recovery(struct obd_import *imp) * Get a configuration log from the MGS and process it. * * This function is called for both clients and servers to process the - * configuration log from the MGS. The MGC enqueues a DLM lock on the + * configuration log from the MGS. The MGC enqueues a DLM lock on the * log from the MGS, and if the lock gets revoked the MGC will be notified * by the lock cancellation callback that the config log has changed, * and will enqueue another MGS lock on it, and then continue processing