Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1476662lqa; Mon, 29 Apr 2024 09:27:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHrZQ5IVDdEnJwGkIqV/UCo/aarA9kmgdTPOUUUzt2pky3/1fmh7TU8dzBN/uJYZqLd1Xk+7leowY6qSY57+BHd6X9qChgBOb1pj8A3A== X-Google-Smtp-Source: AGHT+IFpWaGAY54MQX9p8X+T7Fx+LXJFxhJ0AlOmPNrF/pep9dVjBJgxzS05mXlyi2llr62IMdZW X-Received: by 2002:a05:6214:f27:b0:6a0:cc01:5c7b with SMTP id iw7-20020a0562140f2700b006a0cc015c7bmr4776711qvb.24.1714408060397; Mon, 29 Apr 2024 09:27:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714408060; cv=pass; d=google.com; s=arc-20160816; b=aTRCyG8H9XBjU4g4beu2WvE2THZH+lraL+SWRjPCStpT+Qx9G30YsqzSWskZTjqkZI PIDvxt6K5/Jd5YZq8BOXHyznvYF8dagsoxx409RTMz4lk0onRK5b+U/KZ07zzKbCGLLm 4MA84LCWSKwvU7CqWZc8ueDLoYisS4bOijJNdyH24uOq9p1Q+qgQMjBx4vbqMrrd8Lbv BBjpXxYZozeGqU1An4tbml/6A2aKSX4ixE15bd6EQS9LdVWCbp2Rn9m3QKurd59ZzPMd MhTnufIidX3hFCZAUEM26kHobaw61a+MJXU0usxD8bHJKa27mZGbeCngjYpFkCLaB/H5 1ioA== 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:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=DA0UakU/4/IzIxfK8LkcUEKuRjE5564S3GFhJSkZNCI=; fh=ovAgdFVieY83eUtAxqNKHARa80ahbuasIVUXxZnTEmc=; b=ispKZHY/fcQPDbcqs67Im9M+KnHIUV1x0EgJgeLWZJshRjeBT3S0zI/zpaxlLc9v6Q pvFu64srSqB7hdOrPUPzTubSY78aqUgIIktGUmmwoJOvtnLMt3h+GkG8udGqhiIpxtIr 5YWROqt371CyiDMB+fVyZJuW0D/NDezl8XOdlehBsuGzVLUf1+8KcT+xSfTuXSWFFbe5 /R2ezSINzxy3h9zHt2YYj9D3nuUPL169ekwkdo5suEKjaDt+/M/qPlKoEP/ArhlyJOfy mKo+dPmzr2Vj7xNqbK/rW56ueg7Kdam5gp8222JihMbtAAAqq+mMSIh7D5HB0mzIqPAL tqAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Oa/2UJmv"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Oa/2UJmv"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-2237-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2237-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gs3-20020a056214226300b006a0caf728afsi3403762qvb.30.2024.04.29.09.27.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 09:27:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2237-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Oa/2UJmv"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Oa/2UJmv"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-2237-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2237-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 15E491C2039A for ; Mon, 29 Apr 2024 16:27:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 511A184D1D; Mon, 29 Apr 2024 16:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="Oa/2UJmv"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="pM8rDZ55"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="Oa/2UJmv"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="pM8rDZ55" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04F2084A30; Mon, 29 Apr 2024 16:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714408050; cv=none; b=faZBGbo+hMd+9PdK58qqdYImgHwSGNkTKGsIbJ0854Yejk1jge3uCcJsHMJZflYotQrX+6nLdc879jQfjD55dHSpHUP0xpJhgZ52lg+PMlYBhTOFqCdfy13eyUwz9Iyjl5fGvCSMYpr3zUjZEaAG/wNk4RRAU7rlQNMlyJ+FA0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714408050; c=relaxed/simple; bh=P9PlTcI0sAwPhQz/iv/gS1BiAKtJJIPZh4QaaugdsM8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kcMnhbrrSCuX/E/f8uq4A7vOuBuEqrb5cy76/aZz7LnHlLEmo+4TQPfK9J1PQm/MiPt4jGUVZlbIQJIvB/wAFdCrUPWsBlLW7cJvc6UFNLaIaONV03zhn6VrEK0OdrC027R4EV/6vuv0p4QdcyR1d7mLX0NaKRTR5krR9hYVqyg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=Oa/2UJmv; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=pM8rDZ55; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=Oa/2UJmv; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=pM8rDZ55; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7FDBC33938; Mon, 29 Apr 2024 16:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714408046; h=from:from:reply-to: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=DA0UakU/4/IzIxfK8LkcUEKuRjE5564S3GFhJSkZNCI=; b=Oa/2UJmvnUZV4aHfO8rPcxUWLGwR0jF8UPRGPbJmvbw5hdLvHekfa6imNlfft1DJV+6Er1 Rm2LnaItDQ7KWDBHtnwTdsKrwijOLuHl3RaYGAmaHcIOlD1/cegDuRHhUpWuLcMeXmkQqr 4Ckjyx6EEf65hwAsdKeIBMwbalpwIzc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714408046; h=from:from:reply-to: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=DA0UakU/4/IzIxfK8LkcUEKuRjE5564S3GFhJSkZNCI=; b=pM8rDZ550zjK+fM4380W1eoh+8M9z1CqTS2Rnb0fyb47JAc3QC3thPcGHnqudgBgTh3OSx CKb3yuL+n0qxI/Cw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714408046; h=from:from:reply-to: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=DA0UakU/4/IzIxfK8LkcUEKuRjE5564S3GFhJSkZNCI=; b=Oa/2UJmvnUZV4aHfO8rPcxUWLGwR0jF8UPRGPbJmvbw5hdLvHekfa6imNlfft1DJV+6Er1 Rm2LnaItDQ7KWDBHtnwTdsKrwijOLuHl3RaYGAmaHcIOlD1/cegDuRHhUpWuLcMeXmkQqr 4Ckjyx6EEf65hwAsdKeIBMwbalpwIzc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714408046; h=from:from:reply-to: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=DA0UakU/4/IzIxfK8LkcUEKuRjE5564S3GFhJSkZNCI=; b=pM8rDZ550zjK+fM4380W1eoh+8M9z1CqTS2Rnb0fyb47JAc3QC3thPcGHnqudgBgTh3OSx CKb3yuL+n0qxI/Cw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6EA29139DE; Mon, 29 Apr 2024 16:27:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id fmL+Gm7KL2aCMgAAD6G6ig (envelope-from ); Mon, 29 Apr 2024 16:27:26 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id DF5B2A082F; Mon, 29 Apr 2024 18:27:25 +0200 (CEST) Date: Mon, 29 Apr 2024 18:27:25 +0200 From: Jan Kara To: Zhang Yi Cc: Jan Kara , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [PATCH v2 5/9] ext4: make ext4_es_insert_delayed_block() insert multi-blocks Message-ID: <20240429162725.rzj43hscw6to7xed@quack3> References: <20240410034203.2188357-1-yi.zhang@huaweicloud.com> <20240410034203.2188357-6-yi.zhang@huaweicloud.com> <20240429091638.bghtdkbufbmhlw3r@quack3> Precedence: bulk X-Mailing-List: linux-ext4@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-Spam-Level: X-Spamd-Result: default: False [-3.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[9]; RCVD_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_LAST(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,huawei.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] X-Spam-Score: -3.80 X-Spam-Flag: NO On Mon 29-04-24 20:09:46, Zhang Yi wrote: > On 2024/4/29 17:16, Jan Kara wrote: > > On Wed 10-04-24 11:41:59, Zhang Yi wrote: > >> From: Zhang Yi > >> > >> Rename ext4_es_insert_delayed_block() to ext4_es_insert_delayed_extent() > >> and pass length parameter to make it insert multi delalloc blocks once a > >> time. For the case of bigalloc, expand the allocated parameter to > >> lclu_allocated and end_allocated. lclu_allocated indicates the allocate > >> state of the cluster which containing the lblk, end_allocated represents > >> the end, and the middle clusters must be unallocated. > >> > >> Signed-off-by: Zhang Yi ... > >> @@ -2112,13 +2124,22 @@ void ext4_es_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk, > >> es2 = NULL; > >> } > >> > >> - if (allocated) { > >> - err3 = __insert_pending(inode, lblk, &pr); > >> + if (lclu_allocated) { > >> + err3 = __insert_pending(inode, lblk, &pr1); > >> if (err3 != 0) > >> goto error; > >> - if (pr) { > >> - __free_pending(pr); > >> - pr = NULL; > >> + if (pr1) { > >> + __free_pending(pr1); > >> + pr1 = NULL; > >> + } > >> + } > >> + if (end_allocated) { > > > > So there's one unclear thing here: What if 'lblk' and 'end' are in the same > > cluster? We don't want two pending reservation structures for the cluster. > > __insert_pending() already handles this gracefully but perhaps we don't > > need to allocate 'pr2' in that case and call __insert_pending() at all? I > > think it could be easily handled by something like: > > > > if (EXT4_B2C(lblk) == EXT4_B2C(end)) > > end_allocated = false; > > > > at appropriate place in ext4_es_insert_delayed_extent(). > > > > I've done the check "EXT4_B2C(lblk) == EXT4_B2C(end)" in the caller > ext4_insert_delayed_blocks() in patch 8, becasue there is no need to check > the allocation state if they are in the same cluster, so it could make sure > that end_allocated is always false when 'lblk' and 'end' are in the same > cluster. So I suppose check and set it here again maybe redundant, how about > add a wanging here in ext4_es_insert_delayed_extent(), like: > > WARN_ON_ONCE((EXT4_B2C(sbi, lblk) == EXT4_B2C(sbi, end)) && > end_allocated); > > and modify the 'lclu_allocated/end_allocated' parameter comments, note that > end_allocated should always be set to false if the extent is in one cluster. > Is it fine? Yes, that is a good solution as well! Honza -- Jan Kara SUSE Labs, CR