Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1012140ybe; Wed, 4 Sep 2019 11:07:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxdnRujeH4FPhCUIu9w7oQipmNUiG1xDqr72Dt9z9Ba56dGCKS9V7FwUZcvc7Y4Hwwsdll X-Received: by 2002:a17:902:e506:: with SMTP id ck6mr42826482plb.132.1567620462137; Wed, 04 Sep 2019 11:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620462; cv=none; d=google.com; s=arc-20160816; b=KaBNihbm2n7PwolB76cXxXW9j/vXa6eBGLM2yON7tsztn0/Hv6prEtRC+Jx2dRdj3A lDG5yV4kr0x/sr+8XUKKIvalxiB6Wb6DIDrZjQnnzAIJL+gKrN5H/7pA+qMeKMmGlUd6 OhBdAFMLS9Dbi5p+WbRp3RaswYKrvOGryNdG+2mdaXFQlAUGSH4SUPpIDwlFW6S5O00a Tiocgr1+lASaGrHnKeCSTyFm/HqhUt5G+255PZ+EGkh0/OqDTqLOonAl+wyLlLA4gl6g grz0L0I94ieEETfD9CWl1RzEe4lr9G5ZJHInV5TpJ54U5YRdUs51vY0eJ+7VlvI+Lcro eqmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b+oSHYcGDo9HAdec8Cf9uqkNDz2TWvI5wYDJDPb3qfo=; b=BNNP7d4XghHZi4TKnWiJoTVDhLmvIEkv4oWewzFnR7tqahNDgVIHexOXwyLmFfvDny AMEcHoFHg5sjXudVtiF4QUKqHnfbv7+6NWzTAt2BO+5G8Lh1XzRkxj18MnOJslYbkK/1 DkdooBwOt3wVr98cWeLKnovk3tNF3znb7mHPmw19aRwy5kn7EIKOSG6JoS2e8n4g1yrW iknfTs2IfpjTL1ykokhsszUylBwvh6zaEUx36ImjEacg0FTqA7mXG8iEfEJSSrHQBVzd zoZhvYsLdWZg8HOSVBxzoFNRHffyll/XRSkM1/E8WFAz5XSP4ZE9mM3+6jj69qSuPGr3 Tw2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fjcejCe5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h45si1269646pjb.0.2019.09.04.11.07.25; Wed, 04 Sep 2019 11:07:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fjcejCe5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389096AbfIDSEb (ORCPT + 99 others); Wed, 4 Sep 2019 14:04:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:45478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388665AbfIDSE0 (ORCPT ); Wed, 4 Sep 2019 14:04:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC8E523401; Wed, 4 Sep 2019 18:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620265; bh=FIMhe5wqKZ7wKr08bAItySFaV2dIz+9zENYWQkjtVdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fjcejCe54Tml8Dh/OBaleLUN2onYirjL4w0r4oF/PkVOQQz4wKFcdrGTbi+FmaJKd 96ntmm71nnG90X0yVB+ga7e39U/yMc7w6HlcvP9T0H7ij0p2s21qF2fgHNZOYMllzf X+lgU7CXUaPaQEV4EENld2kPfY5AKDlNMgi4ce/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 4.14 52/57] NFS: Clean up list moves of struct nfs_page Date: Wed, 4 Sep 2019 19:54:20 +0200 Message-Id: <20190904175306.975236128@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175301.777414715@linuxfoundation.org> References: <20190904175301.777414715@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 078b5fd92c4913dd367361db6c28568386077c89 ] In several places we're just moving the struct nfs_page from one list to another by first removing from the existing list, then adding to the new one. Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/direct.c | 3 +-- fs/nfs/pagelist.c | 12 ++++-------- include/linux/nfs_page.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 89c03a507dd9d..0c5e56702b19e 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -664,8 +664,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) list_for_each_entry_safe(req, tmp, &reqs, wb_list) { if (!nfs_pageio_add_request(&desc, req)) { - nfs_list_remove_request(req); - nfs_list_add_request(req, &failed); + nfs_list_move_request(req, &failed); spin_lock(&cinfo.inode->i_lock); dreq->flags = 0; if (desc.pg_error < 0) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 28b013d1d44ae..a7aa028a5b0bb 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -768,8 +768,7 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, pageused = 0; while (!list_empty(head)) { req = nfs_list_entry(head->next); - nfs_list_remove_request(req); - nfs_list_add_request(req, &hdr->pages); + nfs_list_move_request(req, &hdr->pages); if (!last_page || last_page != req->wb_page) { pageused++; @@ -961,8 +960,7 @@ static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc, } if (!nfs_can_coalesce_requests(prev, req, desc)) return 0; - nfs_list_remove_request(req); - nfs_list_add_request(req, &mirror->pg_list); + nfs_list_move_request(req, &mirror->pg_list); mirror->pg_count += req->wb_bytes; return 1; } @@ -994,8 +992,7 @@ nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc, { LIST_HEAD(head); - nfs_list_remove_request(req); - nfs_list_add_request(req, &head); + nfs_list_move_request(req, &head); desc->pg_completion_ops->error_cleanup(&head); } @@ -1241,9 +1238,8 @@ int nfs_pageio_resend(struct nfs_pageio_descriptor *desc, while (!list_empty(&hdr->pages)) { struct nfs_page *req = nfs_list_entry(hdr->pages.next); - nfs_list_remove_request(req); if (!nfs_pageio_add_request(desc, req)) - nfs_list_add_request(req, &failed); + nfs_list_move_request(req, &failed); } nfs_pageio_complete(desc); if (!list_empty(&failed)) { diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index e27572d30d977..ad69430fd0eb5 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -164,6 +164,16 @@ nfs_list_add_request(struct nfs_page *req, struct list_head *head) list_add_tail(&req->wb_list, head); } +/** + * nfs_list_move_request - Move a request to a new list + * @req: request + * @head: head of list into which to insert the request. + */ +static inline void +nfs_list_move_request(struct nfs_page *req, struct list_head *head) +{ + list_move_tail(&req->wb_list, head); +} /** * nfs_list_remove_request - Remove a request from its wb_list -- 2.20.1