From patchwork Thu Feb 7 00:03:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 10800313 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 7949413B4 for ; Thu, 7 Feb 2019 00:06:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 612212D348 for ; Thu, 7 Feb 2019 00:06:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5236D2D5C8; Thu, 7 Feb 2019 00:06:48 +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 0537B2D348 for ; Thu, 7 Feb 2019 00:06:47 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id A685421F816; Wed, 6 Feb 2019 16:06:44 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 94EF94C3B5D for ; Wed, 6 Feb 2019 16:06:42 -0800 (PST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8842EAF3D; Thu, 7 Feb 2019 00:06:41 +0000 (UTC) From: NeilBrown To: Andreas Dilger , James Simmons , Oleg Drokin Date: Thu, 07 Feb 2019 11:03:33 +1100 Message-ID: <154949781307.10620.3918792136275031845.stgit@noble.brown> In-Reply-To: <154949776249.10620.1215070753973826063.stgit@noble.brown> References: <154949776249.10620.1215070753973826063.stgit@noble.brown> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [lustre-devel] [PATCH 09/21] lustre: use list_last_entry() throughout 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 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" X-Virus-Scanned: ClamAV using ClamSMTP Convert list_entry(foo->prev .....) to list_last_entry(foo, ....) throughout lustre. Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 +++--- drivers/staging/lustre/lustre/ptlrpc/service.c | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 53fd8d469e55..bf7678aed6bf 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -2329,7 +2329,7 @@ do { \ static inline struct cl_page *cl_page_list_last(struct cl_page_list *plist) { LASSERT(plist->pl_nr > 0); - return list_entry(plist->pl_pages.prev, struct cl_page, cp_batch); + return list_last_entry(&plist->pl_pages, struct cl_page, cp_batch); } static inline struct cl_page *cl_page_list_first(struct cl_page_list *plist) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index a78d49621c42..b2b11047ea19 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1464,9 +1464,9 @@ static int after_reply(struct ptlrpc_request *req) if (!list_empty(&imp->imp_replay_list)) { struct ptlrpc_request *last; - last = list_entry(imp->imp_replay_list.prev, - struct ptlrpc_request, - rq_replay_list); + last = list_last_entry(&imp->imp_replay_list, + struct ptlrpc_request, + rq_replay_list); /* * Requests with rq_replay stay on the list even if no * commit is expected. diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index a69736dfe8b7..35a59e5a5e9d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -2255,8 +2255,9 @@ static int ptlrpc_hr_main(void *arg) while (!list_empty(&replies)) { struct ptlrpc_reply_state *rs; - rs = list_entry(replies.prev, struct ptlrpc_reply_state, - rs_list); + rs = list_last_entry(&replies, + struct ptlrpc_reply_state, + rs_list); list_del_init(&rs->rs_list); ptlrpc_handle_rs(rs); }