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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E8B1C6FA99 for ; Fri, 10 Mar 2023 11:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229895AbjCJLrh (ORCPT ); Fri, 10 Mar 2023 06:47:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjCJLrg (ORCPT ); Fri, 10 Mar 2023 06:47:36 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7C7110527 for ; Fri, 10 Mar 2023 03:47:35 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 4816D67373; Fri, 10 Mar 2023 12:47:32 +0100 (CET) Date: Fri, 10 Mar 2023 12:47:31 +0100 From: Christoph Hellwig To: Qu Wenruo Cc: Christoph Hellwig , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: Re: [PATCH 13/20] btrfs: simplify the extent_buffer write end_io handler Message-ID: <20230310114731.GA19861@lst.de> References: <20230309090526.332550-1-hch@lst.de> <20230309090526.332550-14-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, Mar 10, 2023 at 04:44:37PM +0800, Qu Wenruo wrote: >> - BUG_ON(!eb); >> - done = atomic_dec_and_test(&eb->io_pages); >> + atomic_dec(&eb->io_pages); >> - if (bio->bi_status || >> - test_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags)) { >> + if (!uptodate) { >> ClearPageUptodate(page); > > There seems to be an existing bug in the endio function for subpage. > > We should call btrfs_page_clear_uptodate() helper. > Or we subpage uptodate bitmap and the page uptodate flag would get out of > sync. Indeed. I'll add a patch to fix this to the beginning of the series for the next round. >> + if (fs_info->nodesize < PAGE_SIZE) >> + btrfs_subpage_clear_writeback(fs_info, page, eb->start, >> + eb->len); >> + else >> + end_page_writeback(page); > > > Here we can just call btrfs_clear_writeback(), which can handle both > subpage and regular cases. Ok.