From patchwork Tue Aug 13 09:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 11091539 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 26429112C for ; Tue, 13 Aug 2019 09:03:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17B822022B for ; Tue, 13 Aug 2019 09:03:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C2FB283BF; Tue, 13 Aug 2019 09:03:11 +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=-7.9 required=2.0 tests=BAYES_00,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 9C4FC28622 for ; Tue, 13 Aug 2019 09:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726986AbfHMJDK (ORCPT ); Tue, 13 Aug 2019 05:03:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:54922 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726026AbfHMJDK (ORCPT ); Tue, 13 Aug 2019 05:03:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 482F0AFC3; Tue, 13 Aug 2019 09:03:08 +0000 (UTC) From: Nikolay Borisov To: linux-xfs@vger.kernel.org Cc: darrick.wong@oracle.com, Nikolay Borisov Subject: [PATCH 1/3] xfs: Use __xfs_buf_submit everywhere Date: Tue, 13 Aug 2019 12:03:04 +0300 Message-Id: <20190813090306.31278-2-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813090306.31278-1-nborisov@suse.com> References: <20190813090306.31278-1-nborisov@suse.com> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently xfs_buf_submit is used as a tiny wrapper to __xfs_buf_submit. It only checks whether XFB_ASYNC flag is set and sets the second parameter to __xfs_buf_submit accordingly. It's possible to remove the level of indirection since in all contexts where xfs_buf_submit is called we already know if XBF_ASYNC is set or not. Signed-off-by: Nikolay Borisov --- fs/xfs/xfs_buf.c | 8 +++++--- fs/xfs/xfs_buf_item.c | 2 +- fs/xfs/xfs_log_recover.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index ca0849043f54..a75d05e49a98 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -751,13 +751,15 @@ _xfs_buf_read( xfs_buf_t *bp, xfs_buf_flags_t flags) { + bool wait = bp->b_flags & XBF_ASYNC ? false : true; + ASSERT(!(flags & XBF_WRITE)); ASSERT(bp->b_maps[0].bm_bn != XFS_BUF_DADDR_NULL); bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD); bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); - return xfs_buf_submit(bp); + return __xfs_buf_submit(bp, wait); } /* @@ -883,7 +885,7 @@ xfs_buf_read_uncached( bp->b_flags |= XBF_READ; bp->b_ops = ops; - xfs_buf_submit(bp); + __xfs_buf_submit(bp, true); if (bp->b_error) { int error = bp->b_error; xfs_buf_relse(bp); @@ -1214,7 +1216,7 @@ xfs_bwrite( bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q | XBF_WRITE_FAIL | XBF_DONE); - error = xfs_buf_submit(bp); + error = __xfs_buf_submit(bp, true); if (error) xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR); return error; diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 7dcaec54a20b..fef08980dd21 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -1123,7 +1123,7 @@ xfs_buf_iodone_callback_error( bp->b_first_retry_time = jiffies; xfs_buf_ioerror(bp, 0); - xfs_buf_submit(bp); + __xfs_buf_submit(bp, false); return true; } diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 13d1d3e95b88..64e315f80147 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -5610,7 +5610,7 @@ xlog_do_recover( bp->b_flags |= XBF_READ; bp->b_ops = &xfs_sb_buf_ops; - error = xfs_buf_submit(bp); + error = __xfs_buf_submit(bp, true); if (error) { if (!XFS_FORCED_SHUTDOWN(mp)) { xfs_buf_ioerror_alert(bp, __func__); From patchwork Tue Aug 13 09:03:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 11091535 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 A54DC746 for ; Tue, 13 Aug 2019 09:03:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 969C028606 for ; Tue, 13 Aug 2019 09:03:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A28F2861D; Tue, 13 Aug 2019 09:03:10 +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=-7.9 required=2.0 tests=BAYES_00,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 2A1A42022B for ; Tue, 13 Aug 2019 09:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbfHMJDJ (ORCPT ); Tue, 13 Aug 2019 05:03:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:54940 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726890AbfHMJDJ (ORCPT ); Tue, 13 Aug 2019 05:03:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 88692AF78; Tue, 13 Aug 2019 09:03:08 +0000 (UTC) From: Nikolay Borisov To: linux-xfs@vger.kernel.org Cc: darrick.wong@oracle.com, Nikolay Borisov Subject: [PATCH 2/3] xfs: Rename __xfs_buf_submit to xfs_buf_submit Date: Tue, 13 Aug 2019 12:03:05 +0300 Message-Id: <20190813090306.31278-3-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813090306.31278-1-nborisov@suse.com> References: <20190813090306.31278-1-nborisov@suse.com> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since xfs_buf_submit no longer has any callers just rename its __ prefixed counterpart. Signed-off-by: Nikolay Borisov --- fs/xfs/xfs_buf.c | 10 +++++----- fs/xfs/xfs_buf.h | 7 +------ fs/xfs/xfs_buf_item.c | 2 +- fs/xfs/xfs_log_recover.c | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index a75d05e49a98..99c66f80d7cc 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -759,7 +759,7 @@ _xfs_buf_read( bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD); bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); - return __xfs_buf_submit(bp, wait); + return xfs_buf_submit(bp, wait); } /* @@ -885,7 +885,7 @@ xfs_buf_read_uncached( bp->b_flags |= XBF_READ; bp->b_ops = ops; - __xfs_buf_submit(bp, true); + xfs_buf_submit(bp, true); if (bp->b_error) { int error = bp->b_error; xfs_buf_relse(bp); @@ -1216,7 +1216,7 @@ xfs_bwrite( bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q | XBF_WRITE_FAIL | XBF_DONE); - error = __xfs_buf_submit(bp, true); + error = xfs_buf_submit(bp, true); if (error) xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR); return error; @@ -1427,7 +1427,7 @@ xfs_buf_iowait( * holds an additional reference itself. */ int -__xfs_buf_submit( +xfs_buf_submit( struct xfs_buf *bp, bool wait) { @@ -1929,7 +1929,7 @@ xfs_buf_delwri_submit_buffers( bp->b_flags |= XBF_ASYNC; list_del_init(&bp->b_list); } - __xfs_buf_submit(bp, false); + xfs_buf_submit(bp, false); } blk_finish_plug(&plug); diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index c6e57a3f409e..ec7037284d62 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -262,12 +262,7 @@ extern void __xfs_buf_ioerror(struct xfs_buf *bp, int error, #define xfs_buf_ioerror(bp, err) __xfs_buf_ioerror((bp), (err), __this_address) extern void xfs_buf_ioerror_alert(struct xfs_buf *, const char *func); -extern int __xfs_buf_submit(struct xfs_buf *bp, bool); -static inline int xfs_buf_submit(struct xfs_buf *bp) -{ - bool wait = bp->b_flags & XBF_ASYNC ? false : true; - return __xfs_buf_submit(bp, wait); -} +extern int xfs_buf_submit(struct xfs_buf *bp, bool); void xfs_buf_zero(struct xfs_buf *bp, size_t boff, size_t bsize); diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index fef08980dd21..93f38fdceb80 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -1123,7 +1123,7 @@ xfs_buf_iodone_callback_error( bp->b_first_retry_time = jiffies; xfs_buf_ioerror(bp, 0); - __xfs_buf_submit(bp, false); + xfs_buf_submit(bp, false); return true; } diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 64e315f80147..9b7822638f83 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -5610,7 +5610,7 @@ xlog_do_recover( bp->b_flags |= XBF_READ; bp->b_ops = &xfs_sb_buf_ops; - error = __xfs_buf_submit(bp, true); + error = xfs_buf_submit(bp, true); if (error) { if (!XFS_FORCED_SHUTDOWN(mp)) { xfs_buf_ioerror_alert(bp, __func__); From patchwork Tue Aug 13 09:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 11091537 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 BECD91823 for ; Tue, 13 Aug 2019 09:03:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0C462022B for ; Tue, 13 Aug 2019 09:03:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4F132861E; Tue, 13 Aug 2019 09:03:10 +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=-7.9 required=2.0 tests=BAYES_00,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 4A3F2283BF for ; Tue, 13 Aug 2019 09:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726890AbfHMJDJ (ORCPT ); Tue, 13 Aug 2019 05:03:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:54948 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726986AbfHMJDJ (ORCPT ); Tue, 13 Aug 2019 05:03:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C949EAFD2; Tue, 13 Aug 2019 09:03:08 +0000 (UTC) From: Nikolay Borisov To: linux-xfs@vger.kernel.org Cc: darrick.wong@oracle.com, Nikolay Borisov Subject: [PATCH 3/3] xfs: Opencode and remove DEFINE_SINGLE_BUF_MAP Date: Tue, 13 Aug 2019 12:03:06 +0300 Message-Id: <20190813090306.31278-4-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813090306.31278-1-nborisov@suse.com> References: <20190813090306.31278-1-nborisov@suse.com> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This macro encodes a trivial struct initializations, just open code it. Signed-off-by: Nikolay Borisov Reviewed-by: Brian Foster --- fs/xfs/xfs_buf.c | 4 ++-- fs/xfs/xfs_buf.h | 9 +++------ fs/xfs/xfs_trans.h | 6 ++++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 99c66f80d7cc..389c5b590f11 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -658,7 +658,7 @@ xfs_buf_incore( { struct xfs_buf *bp; int error; - DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + struct xfs_buf_map map = { .bm_bn = blkno, .bm_len = numblks }; error = xfs_buf_find(target, &map, 1, flags, NULL, &bp); if (error) @@ -905,7 +905,7 @@ xfs_buf_get_uncached( unsigned long page_count; int error, i; struct xfs_buf *bp; - DEFINE_SINGLE_BUF_MAP(map, XFS_BUF_DADDR_NULL, numblks); + struct xfs_buf_map map = { .bm_bn = XFS_BUF_DADDR_NULL, .bm_len = numblks }; /* flags might contain irrelevant bits, pass only what we care about */ bp = _xfs_buf_alloc(target, &map, 1, flags & XBF_NO_IOACCT); diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index ec7037284d62..548dfb0c6e27 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -104,9 +104,6 @@ struct xfs_buf_map { int bm_len; /* size of I/O */ }; -#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \ - struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) }; - struct xfs_buf_ops { char *name; union { @@ -209,7 +206,7 @@ xfs_buf_get( xfs_daddr_t blkno, size_t numblks) { - DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + struct xfs_buf_map map = { .bm_bn = blkno, .bm_len = numblks }; return xfs_buf_get_map(target, &map, 1, 0); } @@ -221,7 +218,7 @@ xfs_buf_read( xfs_buf_flags_t flags, const struct xfs_buf_ops *ops) { - DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + struct xfs_buf_map map = { .bm_bn = blkno, .bm_len = numblks }; return xfs_buf_read_map(target, &map, 1, flags, ops); } @@ -232,7 +229,7 @@ xfs_buf_readahead( size_t numblks, const struct xfs_buf_ops *ops) { - DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + struct xfs_buf_map map = { .bm_bn = blkno, .bm_len = numblks }; return xfs_buf_readahead_map(target, &map, 1, ops); } diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 64d7f171ebd3..8d6fce5c0320 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h @@ -182,7 +182,8 @@ xfs_trans_get_buf( int numblks, uint flags) { - DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + struct xfs_buf_map map = { .bm_bn = blkno, .bm_len = numblks }; + return xfs_trans_get_buf_map(tp, target, &map, 1, flags); } @@ -205,7 +206,8 @@ xfs_trans_read_buf( struct xfs_buf **bpp, const struct xfs_buf_ops *ops) { - DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + struct xfs_buf_map map = { .bm_bn = blkno, .bm_len = numblks }; + return xfs_trans_read_buf_map(mp, tp, target, &map, 1, flags, bpp, ops); }