Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp2153647rdb; Sun, 21 Jan 2024 09:37:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0H0tNsYAPrG540Vrddlbs2UmhlIoLE0JhiYemiFQhiIi+QbDLzpnu4pHcIlWkaWn/cEW1 X-Received: by 2002:a6b:c348:0:b0:7bf:4474:3753 with SMTP id t69-20020a6bc348000000b007bf44743753mr5948211iof.25.1705858652384; Sun, 21 Jan 2024 09:37:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705858652; cv=pass; d=google.com; s=arc-20160816; b=TtKGfq/JNOanRoPBfoGDOhe6XBhyHCvDCZ2lznmcxsQ4ShYRM4ZksNNws4xN0KVBLi E9hdNQAaTWNvA2smPFutDcTtqyAaVjUgRGTIkEjMFI9K7lIl19Q+bVfOJZrmhaHBoeKO 9sCgls1i1cLgegrS/sQccdfCiGVqvs4U031mHpA6TJBRGBxpt2CnwniFRQrvWSLB06dT pWrPTpu20mkm18U5Gj0JA7S1r2O81Em61ITvfCFipmUplWfwHEo7MZsd2xNH/qZBXe9q gxJ9pdr78N76+k5BvbDzpWpRXBmyYtYzy/iE9CU93YEd7g8JaZxqSnpsIZus6ko8dDGh l+sQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=H7WKtD/jbDjNkLZF9EblEjk8T8MZDbfyWkkGAZ5M55w=; fh=Qa0Du3tp9W8XPJlojWqG/hiIP9RCqJ6yVRwNsBvO/0A=; b=jJCOb1CPU9A7/0NBGKRCwv8S17uAUNdSGjADjCHb4cHtYXSCCaWHQMGO7/hITyRXpo wONM8FEjXH8Dwssk/W+bOoxNFJr9kGfpTGBTfscdHR1cWOQqhAzYyHQvJ9vekEkbSLx2 aND/pyZRXiBAyeIROFlSSCOYYfD0nVhv5+9U6kRmLJl8J067qMbXyNsw7nw2Fjzu5jbn aFjQGipfIHpFGkSwKwd8gB+1Io+xBPc5pNBDBclck50locc6c6K9E6KAggFBE0AqXtTr r6aa68TJ9pc6ow4+MqInGqGHIcngAa6Rby1wOS+ldd6HdmDwoo2qyTOufiLyQ2MyNtIK k8nQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=HrRdW3N2; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-32142-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t18-20020a170902b21200b001d4df6649fbsi6646047plr.639.2024.01.21.09.37.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 09:37:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32142-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=HrRdW3N2; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-32142-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 05808281FBF for ; Sun, 21 Jan 2024 17:37:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A805C381CF; Sun, 21 Jan 2024 17:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HrRdW3N2" Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7A4B27441 for ; Sun, 21 Jan 2024 17:37:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705858643; cv=none; b=GasbYl/8ZpEqAA1WT0NOaAGQDErZYsizY7QxliCDTCgXM+GBLy62XLfKT/jGPuxsVUeJMZXJp4slvE1ZlrAN1IsjKptwCxnrkSc1I21Hc5etE8t1/GSj/g2Cu5f+AtuN8i+e5F8XM38Bev4WDvnFF26eriN4K9qZz+fIjUTbopc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705858643; c=relaxed/simple; bh=JPM9TnkWt8kGJWfSrJL+0v1d7QDwm7HJm+cbOf/RlIk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PoS/xTPPUHpIclcBTUsJaxTJBBls02j4i6cJNAtWSSTPxzboj3becvPcmV1wkFnmCxYLm9okfsl6Un0z3EJlRRmZN8SyLIb1gh5bxLc6CY/+bmwZ67Lvjjm49aI9buV7xXlzdCynKiZSdiXAH6lc3QbkM+ctmgt5H8cqa0KTND4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=HrRdW3N2; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Sun, 21 Jan 2024 12:37:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705858638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H7WKtD/jbDjNkLZF9EblEjk8T8MZDbfyWkkGAZ5M55w=; b=HrRdW3N2UQCvIkhj7ZC4z4UMFNCXIM9z2n3XAmgKEDQHBP6vaDlnOFz5Np3bZmr0LGJqAZ AtEU92cSPBVM/Xwo6GeIru5HRGQayQ/9lNg57lqZbhmCk2ASOQ2GWnZxLQyMsmf2TrOgxD hSs0A57nIMBMmbrZushLAvjjBatncSg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Kuan-Wei Chiu Cc: colyli@suse.de, bfoster@redhat.com, jserv@ccns.ncku.edu.tw, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bcachefs@vger.kernel.org Subject: Re: [PATCH 2/5] bcachefs: Introduce parent function for sort_cmp_size() Message-ID: <65vkoqenjy52rinrxduonprebumy7beh5fpd5i6ukgg6nr5buv@zybxigfqsj4q> References: <20240121153649.2733274-1-visitorckw@gmail.com> <20240121153649.2733274-3-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Mon, Jan 22, 2024 at 01:05:28AM +0800, Kuan-Wei Chiu wrote: > On Sun, Jan 21, 2024 at 11:17:30AM -0500, Kent Overstreet wrote: > > On Sun, Jan 21, 2024 at 11:36:46PM +0800, Kuan-Wei Chiu wrote: > > > When dealing with array indices, the parent's index can be obtained > > > using the formula (i - 1) / 2. However, when working with byte offsets, > > > this approach is not straightforward. To address this, we have > > > introduced a branch-free parent function that does not require any > > > division operations to calculate the parent's byte offset. > > > > This is a good commit message - but it would be even better if it was a > > function comment on parent() > > > Sure, however, it seems that sort_cmp_size() can be directly replaced > with the sort function from include/linux. Once we decide on the > cleanup tasks, if we still choose to retain this patch, I will make the > adjustments. nice catch - looks like sort_r() is the more recent addition, so that's how that happened.