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 1BE55C77B7E for ; Thu, 25 May 2023 12:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235904AbjEYMeh (ORCPT ); Thu, 25 May 2023 08:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232039AbjEYMeg (ORCPT ); Thu, 25 May 2023 08:34:36 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DA0B98 for ; Thu, 25 May 2023 05:34:35 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 906D168D07; Thu, 25 May 2023 14:34:31 +0200 (CEST) Date: Thu, 25 May 2023 14:34:31 +0200 From: Christoph Hellwig To: Johannes Thumshirn Cc: Christoph Hellwig , Chris Mason , Josef Bacik , David Sterba , Naohiro Aota , "linux-btrfs@vger.kernel.org" Subject: Re: [PATCH 11/14] btrfs: atomically insert the new extent in btrfs_split_ordered_extent Message-ID: <20230525123431.GA8594@lst.de> References: <20230524150317.1767981-1-hch@lst.de> <20230524150317.1767981-12-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 Thu, May 25, 2023 at 12:30:41PM +0000, Johannes Thumshirn wrote: > I wonder if we couldn't reduce the code duplication between btrfs_split_ordered_extent > and the new insert_ordered_extent function. The different lock ordering currently makes > it impossible, though. The interesting thing about the split case is that we really want to do a removal and two inserts in an atomic fashion. In the end there's not really much code in insert_ordered_extent anyway, and the decision where to split up btrfs_alloc_ordered_extent was at least partially based on that tradeoff.