From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6289C432C2 for ; Wed, 25 Sep 2019 21:34:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7326821D81 for ; Wed, 25 Sep 2019 21:34:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="OT2CNjgI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727395AbfIYVe2 (ORCPT ); Wed, 25 Sep 2019 17:34:28 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:36974 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbfIYVe1 (ORCPT ); Wed, 25 Sep 2019 17:34:27 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8PLYNU1057952; Wed, 25 Sep 2019 21:34:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=uP4IyuRfuHCEAChnI0vS0qLm57WFRpeJa8Q+yl7RFu4=; b=OT2CNjgI8w+cXYTSIUd9Skr7WhhBfkzxX3vS3hoC3Yy0VDycBanckSh47bXBtPM3xyts JuIMeTHizhq3r08z4mDVL+B5Yq1TORtVdcVeoDQDk5jldB68gs8YRto3ug6AfJEZpvtL ZOCI3xh9hIw/SP5CEzV+6tIWkuDdaepYDkB93qXMB1qX48hFrHsMvqniVlcMUHuYk1FU zqbwSw9UreG9NTlW/VCWmVlxV/qJ1Nl5JUjSZViwXmrhj+3ExEzgLdLXl90IIFWZcVyV l4tWJ1jHk63xsgOZj/8p7KZ42N3oKNKeeCpqVVj3gIG066zzVJOZq/iYQIR6sPW3PkzR /g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2v5b9tygwm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Sep 2019 21:34:23 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8PLTESK011719; Wed, 25 Sep 2019 21:32:21 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2v7vnyuk3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Sep 2019 21:32:21 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x8PLWKXZ013196; Wed, 25 Sep 2019 21:32:20 GMT Received: from localhost (/10.145.178.55) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 25 Sep 2019 14:32:19 -0700 Subject: [PATCH 3/4] libxfs: make xfs_buf_delwri_submit actually do something From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, Christoph Hellwig Date: Wed, 25 Sep 2019 14:32:18 -0700 Message-ID: <156944713860.296397.552937074569500727.stgit@magnolia> In-Reply-To: <156944712040.296397.10216531793013990772.stgit@magnolia> References: <156944712040.296397.10216531793013990772.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9391 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909250173 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9391 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909250174 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong xfs_buf_delwri_queue doesn't report errors, which means that if the buffer write fails we have no way of knowing that something bad happened. In the kernel we queue and then submit buffers, and the submit call communicates errors to callers. Do the same here since we're going to start using the AG header initialization functions, which use delwri_{queue,submit} heavily. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/libxfs_io.h | 6 +++++- libxfs/libxfs_priv.h | 1 - libxfs/rdwr.c | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 09ed043b..579df52b 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -71,6 +71,7 @@ typedef struct xfs_buf { struct xfs_buf_map *b_maps; struct xfs_buf_map __b_map; int b_nmaps; + struct list_head b_list; #ifdef XFS_BUF_TRACING struct list_head b_lock_list; const char *b_func; @@ -245,11 +246,14 @@ xfs_buf_get_uncached(struct xfs_buftarg *targ, size_t bblen, int flags) return bp; } +/* Push a single buffer on a delwri queue. */ static inline void xfs_buf_delwri_queue(struct xfs_buf *bp, struct list_head *buffer_list) { bp->b_node.cn_count++; - libxfs_writebuf(bp, 0); + list_add_tail(&bp->b_list, buffer_list); } +int xfs_buf_delwri_submit(struct list_head *buffer_list); + #endif /* __LIBXFS_IO_H__ */ diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 13dab58a..ff35c51e 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -382,7 +382,6 @@ roundup_64(uint64_t x, uint32_t y) #define xfs_buf_relse(bp) libxfs_putbuf(bp) #define xfs_buf_get(devp,blkno,len) (libxfs_getbuf((devp), (blkno), (len))) #define xfs_bwrite(bp) libxfs_writebuf((bp), 0) -#define xfs_buf_delwri_submit(bl) (0) #define xfs_buf_oneshot(bp) ((void) 0) #define XBRW_READ LIBXFS_BREAD diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 3282f6de..0d3e6089 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1473,3 +1473,28 @@ libxfs_irele( libxfs_idestroy(ip); kmem_zone_free(xfs_inode_zone, ip); } + +/* + * Write out a buffer list synchronously. + * + * This will take the @buffer_list, write all buffers out and wait for I/O + * completion on all of the buffers. @buffer_list is consumed by the function, + * so callers must have some other way of tracking buffers if they require such + * functionality. + */ +int +xfs_buf_delwri_submit( + struct list_head *buffer_list) +{ + struct xfs_buf *bp, *n; + int error = 0, error2; + + list_for_each_entry_safe(bp, n, buffer_list, b_list) { + list_del_init(&bp->b_list); + error2 = libxfs_writebuf(bp, 0); + if (!error) + error = error2; + } + + return error; +}