From patchwork Mon Sep 17 17:31:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 10603237 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 B2D38157B for ; Mon, 17 Sep 2018 17:33:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B117C27F98 for ; Mon, 17 Sep 2018 17:33:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A39082837D; Mon, 17 Sep 2018 17:33:09 +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 384C427F98 for ; Mon, 17 Sep 2018 17:33:09 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 39BC09C109C; Mon, 17 Sep 2018 10:31:53 -0700 (PDT) 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 BA22721F850 for ; Mon, 17 Sep 2018 10:31:25 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id ECE629EC; Mon, 17 Sep 2018 13:31:23 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id EB2262B7; Mon, 17 Sep 2018 13:31:23 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 17 Sep 2018 13:31:15 -0400 Message-Id: <1537205481-6899-3-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537205481-6899-1-git-send-email-jsimmons@infradead.org> References: <1537205481-6899-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 2/8] lustre: obdclass: remove cl_for_each defines 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 From: Ben Evans cl_for_each and cl_for_each_reverse are simply aliases for list_for_each_entry and list_for_each_entry_reverse There is no point to them so just get rid of them and eliminate any confusion. Signed-off-by: Ben Evans WC-bug-id: https://jira.whamcloud.com/browse/LU-9575 Reviewed-on: https://review.whamcloud.com/27385 Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/cl_io.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index 3a96d4a..879383ae 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -52,11 +52,6 @@ * */ -#define cl_io_for_each(slice, io) \ - list_for_each_entry((slice), &io->ci_layers, cis_linkage) -#define cl_io_for_each_reverse(slice, io) \ - list_for_each_entry_reverse((slice), &io->ci_layers, cis_linkage) - static inline int cl_io_type_is_valid(enum cl_io_type type) { return CIT_READ <= type && type < CIT_OP_NR; @@ -343,13 +338,14 @@ int cl_io_lock(const struct lu_env *env, struct cl_io *io) LINVRNT(io->ci_state == CIS_IT_STARTED); LINVRNT(cl_io_invariant(io)); - cl_io_for_each(scan, io) { + list_for_each_entry(scan, &io->ci_layers, cis_linkage) { if (!scan->cis_iop->op[io->ci_type].cio_lock) continue; result = scan->cis_iop->op[io->ci_type].cio_lock(env, scan); if (result != 0) break; } + if (result == 0) { cl_io_locks_sort(io); result = cl_lockset_lock(env, io, &io->ci_lockset); @@ -391,7 +387,7 @@ void cl_io_unlock(const struct lu_env *env, struct cl_io *io) link->cill_fini(env, link); } - cl_io_for_each_reverse(scan, io) { + list_for_each_entry_reverse(scan, &io->ci_layers, cis_linkage) { if (scan->cis_iop->op[io->ci_type].cio_unlock) scan->cis_iop->op[io->ci_type].cio_unlock(env, scan); } @@ -416,7 +412,7 @@ int cl_io_iter_init(const struct lu_env *env, struct cl_io *io) LINVRNT(cl_io_invariant(io)); result = 0; - cl_io_for_each(scan, io) { + list_for_each_entry(scan, &io->ci_layers, cis_linkage) { if (!scan->cis_iop->op[io->ci_type].cio_iter_init) continue; result = scan->cis_iop->op[io->ci_type].cio_iter_init(env, @@ -443,7 +439,7 @@ void cl_io_iter_fini(const struct lu_env *env, struct cl_io *io) LINVRNT(io->ci_state == CIS_UNLOCKED); LINVRNT(cl_io_invariant(io)); - cl_io_for_each_reverse(scan, io) { + list_for_each_entry_reverse(scan, &io->ci_layers, cis_linkage) { if (scan->cis_iop->op[io->ci_type].cio_iter_fini) scan->cis_iop->op[io->ci_type].cio_iter_fini(env, scan); } @@ -468,7 +464,7 @@ static void cl_io_rw_advance(const struct lu_env *env, struct cl_io *io, io->u.ci_rw.crw_count -= nob; /* layers have to be notified. */ - cl_io_for_each_reverse(scan, io) { + list_for_each_entry_reverse(scan, &io->ci_layers, cis_linkage) { if (scan->cis_iop->op[io->ci_type].cio_advance) scan->cis_iop->op[io->ci_type].cio_advance(env, scan, nob); @@ -536,7 +532,7 @@ int cl_io_start(const struct lu_env *env, struct cl_io *io) LINVRNT(cl_io_invariant(io)); io->ci_state = CIS_IO_GOING; - cl_io_for_each(scan, io) { + list_for_each_entry(scan, &io->ci_layers, cis_linkage) { if (!scan->cis_iop->op[io->ci_type].cio_start) continue; result = scan->cis_iop->op[io->ci_type].cio_start(env, scan); @@ -561,7 +557,7 @@ void cl_io_end(const struct lu_env *env, struct cl_io *io) LINVRNT(io->ci_state == CIS_IO_GOING); LINVRNT(cl_io_invariant(io)); - cl_io_for_each_reverse(scan, io) { + list_for_each_entry_reverse(scan, &io->ci_layers, cis_linkage) { if (scan->cis_iop->op[io->ci_type].cio_end) scan->cis_iop->op[io->ci_type].cio_end(env, scan); /* TODO: error handling. */ @@ -584,7 +580,7 @@ int cl_io_read_ahead(const struct lu_env *env, struct cl_io *io, LINVRNT(io->ci_type == CIT_READ || io->ci_type == CIT_FAULT); LINVRNT(cl_io_invariant(io)); - cl_io_for_each(scan, io) { + list_for_each_entry(scan, &io->ci_layers, cis_linkage) { if (!scan->cis_iop->cio_read_ahead) continue; @@ -609,7 +605,7 @@ int cl_io_commit_async(const struct lu_env *env, struct cl_io *io, const struct cl_io_slice *scan; int result = 0; - cl_io_for_each(scan, io) { + list_for_each_entry(scan, &io->ci_layers, cis_linkage) { if (!scan->cis_iop->cio_commit_async) continue; result = scan->cis_iop->cio_commit_async(env, scan, queue, @@ -637,7 +633,7 @@ int cl_io_submit_rw(const struct lu_env *env, struct cl_io *io, const struct cl_io_slice *scan; int result = 0; - cl_io_for_each(scan, io) { + list_for_each_entry(scan, &io->ci_layers, cis_linkage) { if (!scan->cis_iop->cio_submit) continue; result = scan->cis_iop->cio_submit(env, scan, crt, queue);