From patchwork Fri Apr 1 15:42:29 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: 8725641 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9FE519F38C for ; Fri, 1 Apr 2016 15:42:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC29B201C7 for ; Fri, 1 Apr 2016 15:42:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B88D0203C4 for ; Fri, 1 Apr 2016 15:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbcDAPmh (ORCPT ); Fri, 1 Apr 2016 11:42:37 -0400 Received: from mail-ig0-f172.google.com ([209.85.213.172]:37842 "EHLO mail-ig0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbcDAPmg (ORCPT ); Fri, 1 Apr 2016 11:42:36 -0400 Received: by mail-ig0-f172.google.com with SMTP id l20so15966961igf.0 for ; Fri, 01 Apr 2016 08:42:36 -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=puHoV0mIq51z5tKgktBs8spZudAfain46qCmKrFuATrsEG9qZ7ZH8I19LkTQojWCWm QS54yeWpZ5BbajTPfisKp4CO/0QK7GuRFpznQnd43wSNXLaPPcXmL41waul4g1JFiTq1 yTM4lKG8Dvznx277mUf2y5QXq8nTCKGKQX90nsIkKtUaHYBetGh1zOmQO+uvARtABsUE 665VTLADe15pmTuV5ev2NyC/5EwLYmyZCenePBWs+qs8M7vbmYDEUz9dGJjN8pvkNaDm ltR1RxeF7+WYIGvmGQV6todnb1YWSbFo/8Ob9RKL4FZm7zUiexSenZsYrc4uOazSGj2C Hcxg== 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=NBKsxNw8ogAiyxdzPahWM3uPHvEqshpnhJc5wZra2Ng5W3lwgogNBRg2mqLkt0ooQW PeKqNAx7wxSxLecPKGmeznr+VvgpJOjPpmVQQMJp/NRVSYJmgjdPHefmPe2oZJcfFPGA nolOztpjiIO8hZf0eEz1A0PPOvbdAj2kPpnQcKBa5XmyOyRFdNN6o/NmEFziD08MhhFJ VhUwvl/Mx9tjItXqnRM6w7RefzpwZrtbPuBmVfLnFILb8xifPTZT2B+WHFwf0beB2fIS WhW2H40WUcrxESTqoBS5+HASo397rGPZhonIhb5/0/knMshd2Cg5zAx0eYltbT3Z5Re9 rP6A== X-Gm-Message-State: AD7BkJKDe3AaprGnSWZpGPNnxB6wVPW7GmZtu+QQ/dsXuCVA7Mil3jOxoG8F8vrvgLhie7rb X-Received: by 10.50.79.198 with SMTP id l6mr3989357igx.30.1459525355624; Fri, 01 Apr 2016 08:42:35 -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 i187sm6017870ioi.33.2016.04.01.08.42.34 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 01 Apr 2016 08:42:35 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 2/2 vers 2] nfs: add debug to directio "good_bytes" counting Date: Fri, 1 Apr 2016 11:42:29 -0400 Message-Id: <1459525349-6100-3-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1459525349-6100-1-git-send-email-dros@primarydata.com> References: <1459525349-6100-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);