From patchwork Fri Feb 1 20:04:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 10793685 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 BE6401390 for ; Fri, 1 Feb 2019 20:04:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B04A032C9E for ; Fri, 1 Feb 2019 20:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5067330BE; Fri, 1 Feb 2019 20:04:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46E0332C9E for ; Fri, 1 Feb 2019 20:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730838AbfBAUEw (ORCPT ); Fri, 1 Feb 2019 15:04:52 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37126 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730787AbfBAUEv (ORCPT ); Fri, 1 Feb 2019 15:04:51 -0500 Received: by mail-pg1-f195.google.com with SMTP id c25so3433088pgb.4 for ; Fri, 01 Feb 2019 12:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=T9tOKlKtEoIY8+gqJRbprGCpsBu5Rn8NVjmO/12hMEM=; b=dE7MYqaIhQ6vmNin8yz7npNkU7tnziX2XBmOqzFdslskCeB1pcS0blYtTtg3vWQRYs Fsn2nBOGBP7jjjMPcAjpVSDXOuCo3L3WpesBqr4e2dUzYYUNDJtw0aineW1y5IYlnQr7 cklVrGgalyO5fOyKJmL5J5ZLlTP1Nbv6d6/csXGNoWDZ6MUo+QEhQrYSP+eR0jRoyw85 U178w81yqZkZii7yhjwLIw2D8PFU9+HYsmjStMacHqf+c3IyqG1m+6JqRXmxrLQ7oMhE LUtmu/z72t60WdFNh6lClq+G4eqX3so9aDSbf4mOd/WA8yilPYYqbElcVldMsj6slypl vgSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=T9tOKlKtEoIY8+gqJRbprGCpsBu5Rn8NVjmO/12hMEM=; b=nKwuljn2y7tp9tPX62lOQHGjYvUSiposgiCenUkDKkVEYkMRJj1lddi+OO+BG9AcWu gP9XcQy6eE80jenAlhoWOqK1qK4YU7S5UKs18EMGQ+bI5Rf+q7080ZmSeLAptcykNvzS PQfBlyeF3hAW2Xx5GRwxkFS4pI8yClKahjaskaNFREV7tzo5hzXfsnbDqTKhMYlEg7PS O+KrFyMZrkMkvLO0ZOoDHpUmqvCmlv7knKZowkgZPNSycr3YTMwQeeMrQuCvCY7ymF+j Y9Yoan7Qc+OBDj4W4kbNaczEX1iit/+5i/RpcIagsHsb3DitgDHZr74+C8WFqeuuG9e1 OPmg== X-Gm-Message-State: AJcUukdCVAntLUa5FdO9e6n6wfrixt2fL2Hn4YFCqcPw8xke1pwb8NlS S8kmQ7kgYaLK4OoGnVLGY0uBncA= X-Google-Smtp-Source: ALg8bN6irD6mLNGaGHnrRgQJCIjv+ZL/4jQijEjOxg79xd2LPagJo+VHtfahGyKD2HgW6Ci3xEA2Eg== X-Received: by 2002:a62:56c7:: with SMTP id h68mr42449756pfj.134.1549051490435; Fri, 01 Feb 2019 12:04:50 -0800 (PST) Received: from ubuntu-vm.corp.microsoft.com ([2001:4898:80e8:0:a18e:4e9f:6b7c:507d]) by smtp.gmail.com with ESMTPSA id x11sm24247451pfe.72.2019.02.01.12.04.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Feb 2019 12:04:48 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 20/23] CIFS: Move unlocking pages from wdata_send_pages() Date: Fri, 1 Feb 2019 12:04:09 -0800 Message-Id: <1549051452-5968-22-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549051452-5968-1-git-send-email-pshilov@microsoft.com> References: <1549051452-5968-1-git-send-email-pshilov@microsoft.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently wdata_send_pages() unlocks pages after sending. This complicates further refactoring and doesn't align with the function name. Move unlocking to writepages. Signed-off-by: Pavel Shilovsky --- fs/cifs/file.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index dd8bf69..cb37b1f 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2080,8 +2080,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata, unsigned int nr_pages, struct address_space *mapping, struct writeback_control *wbc) { - int rc = 0; - unsigned int i; + int rc; wdata->sync_mode = wbc->sync_mode; wdata->nr_pages = nr_pages; @@ -2094,7 +2093,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata, rc = adjust_credits(server, &wdata->credits, wdata->bytes); if (rc) - goto send_pages_out; + return rc; if (!wdata->cfile) { cifs_dbg(VFS, "No writable handle in writepages\n"); @@ -2108,10 +2107,6 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata, cifs_writedata_release); } -send_pages_out: - for (i = 0; i < nr_pages; ++i) - unlock_page(wdata->pages[i]); - return rc; } @@ -2200,6 +2195,9 @@ static int cifs_writepages(struct address_space *mapping, rc = wdata_send_pages(server, wdata, nr_pages, mapping, wbc); + for (i = 0; i < nr_pages; ++i) + unlock_page(wdata->pages[i]); + /* send failure -- clean up the mess */ if (rc != 0) { add_credits_and_wake_if(server, &wdata->credits, 0);