From patchwork Wed Jul 13 16:16:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 9227927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA26B6075D for ; Wed, 13 Jul 2016 16:16:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B5A526E64 for ; Wed, 13 Jul 2016 16:16:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9031727F9C; Wed, 13 Jul 2016 16:16:50 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34BAB26E64 for ; Wed, 13 Jul 2016 16:16:50 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id E48447CB0; Wed, 13 Jul 2016 11:16:43 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay2.corp.sgi.com [137.38.102.29]) by oss.sgi.com (Postfix) with ESMTP id BDBC47CAF for ; Wed, 13 Jul 2016 11:16:41 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay2.corp.sgi.com (Postfix) with ESMTP id 7B6BA304032 for ; Wed, 13 Jul 2016 09:16:41 -0700 (PDT) X-ASG-Debug-ID: 1468426597-04cb6c063f7e74c0001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id 7ktaK7KZkQG3HEO8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 13 Jul 2016 09:16:37 -0700 (PDT) X-Barracuda-Envelope-From: bfoster@redhat.com X-Barracuda-Effective-Source-IP: mx1.redhat.com[209.132.183.28] X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-ASG-Whitelist: Client Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E5E20E7D17 for ; Wed, 13 Jul 2016 16:16:36 +0000 (UTC) Received: from bfoster.bfoster (dhcp-41-134.bos.redhat.com [10.18.41.134]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6DGGaGF023084 for ; Wed, 13 Jul 2016 12:16:36 -0400 Received: by bfoster.bfoster (Postfix, from userid 1000) id 66484120680; Wed, 13 Jul 2016 12:16:35 -0400 (EDT) From: Brian Foster To: xfs@oss.sgi.com Subject: [PATCH 1/3] xfs: helper to set flags on uncached buffer reads Date: Wed, 13 Jul 2016 12:16:33 -0400 X-ASG-Orig-Subj: [PATCH 1/3] xfs: helper to set flags on uncached buffer reads Message-Id: <1468426595-35032-2-git-send-email-bfoster@redhat.com> In-Reply-To: <1468426595-35032-1-git-send-email-bfoster@redhat.com> References: <1468426595-35032-1-git-send-email-bfoster@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Jul 2016 16:16:36 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1468426597 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.176.15:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 2601 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP xfs_buf_read_uncached() allocates an uncached buffer and performs a read in one go. As part of the upcoming buftarg I/O accounting mechanism, some sites may need to set flags on a buffer before I/O submission. Create a new helper to support the ability to set flags on a buffer before it is submitted for I/O. This use case is the exception, so create a wrapper for the original xfs_buf_read_uncached(). Signed-off-by: Brian Foster --- fs/xfs/xfs_buf.c | 20 +++++++++++++++++--- fs/xfs/xfs_buf.h | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 4665ff6..f007713 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -693,13 +693,14 @@ xfs_buf_readahead_map( * buffer containing the disk contents or nothing. */ int -xfs_buf_read_uncached( +xfs_buf_read_uncached_flags( struct xfs_buftarg *target, xfs_daddr_t daddr, size_t numblks, int flags, struct xfs_buf **bpp, - const struct xfs_buf_ops *ops) + const struct xfs_buf_ops *ops, + int bflags) { struct xfs_buf *bp; @@ -713,7 +714,7 @@ xfs_buf_read_uncached( ASSERT(bp->b_map_count == 1); bp->b_bn = XFS_BUF_DADDR_NULL; /* always null for uncached buffers */ bp->b_maps[0].bm_bn = daddr; - bp->b_flags |= XBF_READ; + bp->b_flags |= XBF_READ | bflags; bp->b_ops = ops; xfs_buf_submit_wait(bp); @@ -727,6 +728,19 @@ xfs_buf_read_uncached( return 0; } +int +xfs_buf_read_uncached( + struct xfs_buftarg *target, + xfs_daddr_t daddr, + size_t numblks, + int flags, + struct xfs_buf **bpp, + const struct xfs_buf_ops *ops) +{ + return xfs_buf_read_uncached_flags(target, daddr, numblks, flags, bpp, + ops, 0); +} + /* * Return a buffer allocated as an empty buffer and associated to external * memory via xfs_buf_associate_memory() back to it's empty state. diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index 8bfb974..a3c7ba4 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -295,6 +295,10 @@ struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks, int xfs_buf_read_uncached(struct xfs_buftarg *target, xfs_daddr_t daddr, size_t numblks, int flags, struct xfs_buf **bpp, const struct xfs_buf_ops *ops); +int xfs_buf_read_uncached_flags(struct xfs_buftarg *target, xfs_daddr_t daddr, + size_t numblks, int flags, struct xfs_buf **bpp, + const struct xfs_buf_ops *ops, int blags); + void xfs_buf_hold(struct xfs_buf *bp); /* Releasing Buffers */