From patchwork Fri Apr 1 14:29:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weston Andros Adamson X-Patchwork-Id: 8725251 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA7B1C0553 for ; Fri, 1 Apr 2016 14:29:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6C04203B6 for ; Fri, 1 Apr 2016 14:29:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB984203C3 for ; Fri, 1 Apr 2016 14:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757295AbcDAO3O (ORCPT ); Fri, 1 Apr 2016 10:29:14 -0400 Received: from mail-io0-f171.google.com ([209.85.223.171]:33995 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758815AbcDAO3M (ORCPT ); Fri, 1 Apr 2016 10:29:12 -0400 Received: by mail-io0-f171.google.com with SMTP id e3so153469345ioa.1 for ; Fri, 01 Apr 2016 07:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=primarydata-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q6WmqDobv8oNwaeGrIEiHRCQfS5Kjp7Jjxb51Zc6Xf0=; b=ypSO+lX0KGHTREoJxDzl+X8NpDI2SREFCvuTk9bIE6MzaKIr1FGtetbLAZ6qvqOrFc k2SgcTTV7rtqGZKkDOpXE+bSbO7QPBOr6HPn/6y7p15EkWtTkndsZzlcHjnWDNA5KwNX FwhEWc0naPNJew64ZtFQkWV/k1u/gU0GkIi3aw5WMWWkhYZfQvnff5Pk97tYNL0BV23u r6GM6cx800QxJWyN4m4KVxi+8Vh2x2bRYVlerIYpqY46O+TYuuP0TAimdH6WIUx68XDt 1EeaPGSAxUoO3dm0Co7H/xCnAMXaljQ3uBSxMDQlAkgwaW8cqxetybwBxtCkyNEiRqGw ZWjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q6WmqDobv8oNwaeGrIEiHRCQfS5Kjp7Jjxb51Zc6Xf0=; b=bctfixKYVO9Fo5n2g2ep1aP7G3VACsR7pDgHUA8bUG93pFamQBPjeUeGdz9yjseSiK z5LP6IKq07V1XwCf3+jwHjvvSaLoz1OOMYJLKAn+W2oTSdY+Kz4CYWgAB2ljuKWMPkIQ gX98KPZhczDTk4VK4/V2OdaVJcJFW0X6Zy/vQs+kWO2sydCDNrdbEIRofBAP9BVmUD7t 6Jyyc01qKetiaD+GdB3kHFxZQudNdnP6alDCedcnUecE7f0+GKCAE/0q9qcYx7Aw2TUZ lS5NvVF2oJox/qTE/nsHJv108Baqy4tJ5djQ9DdmU9BdnlIu8ANEocNSudVXJPCpoGxY yCxg== X-Gm-Message-State: AD7BkJILHxjR1eQCkfXPKSPmWaaGQcEXGOz8vMXg8MNlAtTd2M0Kh/AxOO3vcjQ9EbuapBOE X-Received: by 10.107.164.170 with SMTP id d42mr4969191ioj.80.1459520952093; Fri, 01 Apr 2016 07:29:12 -0700 (PDT) Received: from dhcp-56.robotsandstuff.fake (c-68-49-175-159.hsd1.mi.comcast.net. [68.49.175.159]) by smtp.gmail.com with ESMTPSA id 78sm5887454iof.22.2016.04.01.07.29.11 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 01 Apr 2016 07:29:11 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 2/2] nfs: add debug to directio "good_bytes" counting Date: Fri, 1 Apr 2016 10:29:03 -0400 Message-Id: <1459520943-5558-3-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1459520943-5558-1-git-send-email-dros@primarydata.com> References: <1459520943-5558-1-git-send-email-dros@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This will pop a warning if we count too many good bytes. Signed-off-by: Weston Andros Adamson --- fs/nfs/direct.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 7a0cfd3266e5..5a31f2928530 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -87,6 +87,7 @@ struct nfs_direct_req { int mirror_count; ssize_t count, /* bytes actually processed */ + max_count, /* max expected count */ bytes_left, /* bytes left to be sent */ io_start, /* start of IO */ error; /* any reported error */ @@ -123,6 +124,8 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr) int i; ssize_t count; + WARN_ON_ONCE(dreq->count >= dreq->max_count); + if (dreq->mirror_count == 1) { dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes; dreq->count += hdr->good_bytes; @@ -593,7 +596,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, goto out_unlock; dreq->inode = inode; - dreq->bytes_left = count; + dreq->bytes_left = dreq->max_count = count; dreq->io_start = pos; dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); l_ctx = nfs_get_lock_context(dreq->ctx); @@ -1026,7 +1029,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) goto out_unlock; dreq->inode = inode; - dreq->bytes_left = iov_iter_count(iter); + dreq->bytes_left = dreq->max_count = iov_iter_count(iter); dreq->io_start = pos; dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); l_ctx = nfs_get_lock_context(dreq->ctx);