From patchwork Tue Sep 9 05:26:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 4865931 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6F415C0338 for ; Tue, 9 Sep 2014 05:27:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 846542015D for ; Tue, 9 Sep 2014 05:27:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 727E92014A for ; Tue, 9 Sep 2014 05:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755441AbaIIF1I (ORCPT ); Tue, 9 Sep 2014 01:27:08 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:38963 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755315AbaIIF1H (ORCPT ); Tue, 9 Sep 2014 01:27:07 -0400 Received: by mail-pd0-f178.google.com with SMTP id p10so5330154pdj.37 for ; Mon, 08 Sep 2014 22:27:05 -0700 (PDT) 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:mime-version :content-type:content-transfer-encoding; bh=UxLAarNCNQvybgHGz5Ra7en8+jG3ImsF6nR2xux0tKw=; b=ax8cUS7CmnE3ZcXcw/yciihU8UmPhsWQZbeYUanJXTKq6JRdBFUitZQ0KDJVb/f5j8 23fQHY4l/CfK+n89CId13zaYeAO/92cYzzVvG+1hVcc5+H6BkTm2mLBvZ5cVeJQRDzyU T8UySWXf7VaX/IE3r3D1j7UwzBEvjTct8zWP7EdeopbaXWjFXV3o+Kid7NdKMhFhFTJw R6eptACshJB8Z3TX2goRbuDIpxut3hIv4pKMQf63WNWB1Lfz4r3pxk9qD2S7KZ4V7rFw bSWfap0GWxzvOzn3DFUJul3JrleIKylrHyAn8Icl2SF9iOR6ajvAWbY/iYLhLRoTCq7N uGGg== X-Gm-Message-State: ALoCoQk7vcefnRk5lWz8aWAX9Hae+98Gp1UxTqTMfBzcM5keclPKSl4NKc72tWkgD9rReFVkIta5 X-Received: by 10.66.251.195 with SMTP id zm3mr53446839pac.78.1410240425592; Mon, 08 Sep 2014 22:27:05 -0700 (PDT) Received: from leira.trondhjem.org ([98.234.222.22]) by mx.google.com with ESMTPSA id im1sm10363592pbb.29.2014.09.08.22.27.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Sep 2014 22:27:04 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Cc: Anna Schumaker , Weston Andros Adamson Subject: [PATCH] NFS: Fix a compile warning when !(CONFIG_NFS_V3 || CONFIG_NFS_V4) Date: Mon, 8 Sep 2014 22:26:59 -0700 Message-Id: <1410240419-43111-1-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 1.9.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 gcc reports: linux/fs/nfs/write.c: In function ‘nfs_page_find_head_request_locked.isra.17’: linux/fs/nfs/write.c:121:64: warning: ‘cinfo.mds’ may be used uninitialized in this function [-Wmaybe-uninitialized] list_for_each_entry_safe(freq, t, &cinfo.mds->list, wb_list) { ^ linux/fs/nfs/write.c:110:25: note: ‘cinfo.mds’ was declared here struct nfs_commit_info cinfo; Reported-by: Anna Schumaker Cc: Weston Andros Adamson Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 74 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 3c5638f381cd..128d97f01d1c 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -49,6 +49,9 @@ static const struct nfs_rw_ops nfs_rw_write_ops; static void nfs_clear_request_commit(struct nfs_page *req); static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo, struct inode *inode); +static struct nfs_page * +nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi, + struct page *page); static struct kmem_cache *nfs_wdata_cachep; static mempool_t *nfs_wdata_mempool; @@ -95,38 +98,6 @@ static void nfs_context_set_write_error(struct nfs_open_context *ctx, int error) } /* - * nfs_page_search_commits_for_head_request_locked - * - * Search through commit lists on @inode for the head request for @page. - * Must be called while holding the inode (which is cinfo) lock. - * - * Returns the head request if found, or NULL if not found. - */ -static struct nfs_page * -nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi, - struct page *page) -{ - struct nfs_page *freq, *t; - struct nfs_commit_info cinfo; - struct inode *inode = &nfsi->vfs_inode; - - nfs_init_cinfo_from_inode(&cinfo, inode); - - /* search through pnfs commit lists */ - freq = pnfs_search_commit_reqs(inode, &cinfo, page); - if (freq) - return freq->wb_head; - - /* Linearly search the commit list for the correct request */ - list_for_each_entry_safe(freq, t, &cinfo.mds->list, wb_list) { - if (freq->wb_page == page) - return freq->wb_head; - } - - return NULL; -} - -/* * nfs_page_find_head_request_locked - find head request associated with @page * * must be called while holding the inode lock. @@ -750,6 +721,38 @@ nfs_mark_request_dirty(struct nfs_page *req) } #if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4) +/* + * nfs_page_search_commits_for_head_request_locked + * + * Search through commit lists on @inode for the head request for @page. + * Must be called while holding the inode (which is cinfo) lock. + * + * Returns the head request if found, or NULL if not found. + */ +static struct nfs_page * +nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi, + struct page *page) +{ + struct nfs_page *freq, *t; + struct nfs_commit_info cinfo; + struct inode *inode = &nfsi->vfs_inode; + + nfs_init_cinfo_from_inode(&cinfo, inode); + + /* search through pnfs commit lists */ + freq = pnfs_search_commit_reqs(inode, &cinfo, page); + if (freq) + return freq->wb_head; + + /* Linearly search the commit list for the correct request */ + list_for_each_entry_safe(freq, t, &cinfo.mds->list, wb_list) { + if (freq->wb_page == page) + return freq->wb_head; + } + + return NULL; +} + /** * nfs_request_add_commit_list - add request to a commit list * @req: pointer to a struct nfs_page @@ -868,6 +871,13 @@ int nfs_write_need_commit(struct nfs_pgio_header *hdr) } #else +static struct nfs_page * +nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi, + struct page *page) +{ + return NULL; +} + static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo, struct inode *inode) {