From patchwork Thu Oct 11 06:06:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10636099 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 E29EE1508 for ; Thu, 11 Oct 2018 06:06:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB3702AD3C for ; Thu, 11 Oct 2018 06:06:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACA892AF33; Thu, 11 Oct 2018 06:06:31 +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 2A87C2AD3C for ; Thu, 11 Oct 2018 06:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728081AbeJKNcN (ORCPT ); Thu, 11 Oct 2018 09:32:13 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42372 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbeJKNcN (ORCPT ); Thu, 11 Oct 2018 09:32:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id f26-v6so3825935pfn.9 for ; Wed, 10 Oct 2018 23:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=fX/t1aSGMoNiEjB+VcqrBvIPk65RHU2ZemvBRMm4SCM=; b=HdDws7+6QvEZcRBRlr7risJ/9v8EphLKtOkukiAMOQXei/vAKuEwF5fPRQZxGuXufe CuPW6Go+LKYx/RIit4k3sxySSVXdVTJOYZSB+v7ftj4uJFoSAX/9zX5JtNZ2Y5B+A8Zg VHZe9sqQOiNl0SkAOsQ9mrtD8dRaJuh/Tq3a5O0k5ZxOrSB5UWn7+VJA5GI1jBigsngl DrECjuTboVGOn9NxRmOwdJnn6Ytuf3k0YdOYbssWUa6xa16kMFURpteIsl7A/N2gUPBV ME5OwARvAIsL7LEw2ARyz5aiCXXpD/3XSSlm9g3SQQEakb/lCZua1tbp02G7fJviC2go Wqyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=fX/t1aSGMoNiEjB+VcqrBvIPk65RHU2ZemvBRMm4SCM=; b=t2DT7yGDviiXRdnemrViD/f7hF4GYOfAke9bQ+W81zAdGUpz9+7SLqsnKTL+5WbYQG JCPI+5Syly0014iPIMd2jIBoRkxiSKW+OWg8XLU4i9dSzxAsOxFu7N5vtPhS8tlHEuY4 yS9f93zWK16CbawTi0zRGprYTCMXz6/0vQUHAkzAHnhO55iN6E1A8OOCMpezXY3f6R41 OAeihGUMpNUW/BVu7kwBliJiFvVmnclKOXaZN4PNDVQppH57deCmW+dqRsSqt6rtdp0j Pr9q1n6efGPv+F/4+FIu8kUN5rQkbZbylMESkciCZFZ5PPnnPCO1ryaAesd2tqhii+bN +U/Q== X-Gm-Message-State: ABuFfogXuwtpKCEHlB7EYVjBgSPRFcV1YDGCf/bqPPCPaUl4VEjkYzjN P1nevOXysG1OVKg9GxE4124oN1+Gx1Y16gNgrs1l8zgP X-Google-Smtp-Source: ACcGV60IDJCiWo+vIeiLh5ebK73JA1unFjHhWpcVeoyxGLp0K1ay868tx2BUOobf/tPZRcBpj/J4t/zOPbTxggMEv3I= X-Received: by 2002:a63:6b05:: with SMTP id g5-v6mr209617pgc.344.1539237989489; Wed, 10 Oct 2018 23:06:29 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Thu, 11 Oct 2018 01:06:17 -0500 Message-ID: Subject: [PATCH] cifs: track writepages in vfs operation counters To: CIFS 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 writepages and readpages operations did not call get/free_xid so the statistics for file copy could get confusing with "vfs operations" not increasing. Add get_xid and free_xid to cifs readpages and writepages functions. Signed-off-by: Steve French Reviewed-by: Ronnie Sahlberg --- fs/cifs/file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) * immediately if the cookie is negative @@ -3762,8 +3767,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, */ rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list, &num_pages); - if (rc == 0) + if (rc == 0) { + free_xid(xid); return rc; + } if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) pid = open_file->pid; @@ -3807,6 +3814,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, */ if (unlikely(rsize < PAGE_SIZE)) { add_credits_and_wake_if(server, credits, 0); + free_xid(xid); return 0; } @@ -3871,6 +3879,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, * allocator. */ cifs_fscache_readpages_cancel(mapping->host, page_list); + free_xid(xid); return rc; } From 79ec5c09fb84ab57118d6a246d7f9483cc4b09b3 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 11 Oct 2018 01:01:02 -0500 Subject: [PATCH] cifs: track writepages in vfs operation counters writepages and readpages operations did not call get/free_xid so the statistics for file copy could get confusing with "vfs operations" not increasing. Add get_xid and free_xid to cifs readpages and writepages functions. Signed-off-by: Steve French --- fs/cifs/file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 00abaa1dce02..84477e995246 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2107,6 +2107,7 @@ static int cifs_writepages(struct address_space *mapping, pgoff_t end, index; struct cifs_writedata *wdata; int rc = 0; + unsigned int xid; /* * If wsize is smaller than the page cache size, default to writing @@ -2115,6 +2116,7 @@ static int cifs_writepages(struct address_space *mapping, if (cifs_sb->wsize < PAGE_SIZE) return generic_writepages(mapping, wbc); + xid = get_xid(); if (wbc->range_cyclic) { index = mapping->writeback_index; /* Start from prev offset */ end = -1; @@ -2208,6 +2210,7 @@ static int cifs_writepages(struct address_space *mapping, if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) mapping->writeback_index = index; + free_xid(xid); return rc; } @@ -3752,7 +3755,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file); struct TCP_Server_Info *server; pid_t pid; + unsigned int xid; + xid = get_xid(); /* * Reads as many pages as possible from fscache. Returns -ENOBUFS * immediately if the cookie is negative @@ -3762,8 +3767,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, */ rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list, &num_pages); - if (rc == 0) + if (rc == 0) { + free_xid(xid); return rc; + } if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) pid = open_file->pid; @@ -3807,6 +3814,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, */ if (unlikely(rsize < PAGE_SIZE)) { add_credits_and_wake_if(server, credits, 0); + free_xid(xid); return 0; } @@ -3871,6 +3879,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, * allocator. */ cifs_fscache_readpages_cancel(mapping->host, page_list); + free_xid(xid); return rc; } -- 2.17.1