Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1102767pxb; Fri, 3 Sep 2021 23:54:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDh1plYMs6CQmXfiwxkQIAGbQJ9c29h/+WLfV04Ui4lGRe17I6s4a4dvi0uBQA6BMbY8fX X-Received: by 2002:a17:906:b08e:: with SMTP id x14mr2916757ejy.40.1630738446518; Fri, 03 Sep 2021 23:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630738446; cv=none; d=google.com; s=arc-20160816; b=o98QFzl5p430ACr9yzkdOIXnd9xrxlicQ7hJeOBzMBD++UHSkU+C9rXhOUUVrY7Tyf jVSrIEWW6pupp7smu8dGho2cKuiGxU5Le0YwEzhfNr3UGsEzB+wh8Trc2R6Vi5waMF2Y d4P53KtsgWyO5per7ICElfGRatboOvJanteD/zA1rB227w1id51ULakvI7GRvhqIhOUw bnzyOH+m1XcrLVUvnW3Oww7dMYhU7WHXqfBtxQDerJ9qPRyp4qqIWDyb9B8mP3bUvJ3H 2UA70SWQxS231OqkdkOz+OwlhCeZmkr2wgoAHr0PIdk/aHFmO+9vM6J3F6pcC3WTKfHS Joyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=gP7CuZ73md+XZFc4jrK3TMBwcdA8vbKuHyFXB9aHllo=; b=oIzaQT7tCby8TaON1YFW2bLYblUiKpcLH2WcnvjxrBFoSVE2rX07XafU7vZmYRdM9i 23ZKaal7Uxoyo1rDwuBcSuFcvHGX6bk356TYQvzynylYdCySpawBBllv80M7EPudzLv1 j2MW1Pl9GtJEdME39O3eQm8ovOOh7vc7AUYTXOc9NwFWor2rAys9Vor2FKxSlx5eZM4T c2lhzxJFhLP/lPrskCfj1JBwY5SzHVCY1w4zD9B/hDhaDQkPUmfWIR7oc9Xl6W71UOzS 2Z5S29hu5tn2WYnZPM1Qhk92sIzAN2jBGoPAg9ZcGc5a0/YfXsr2HR4dvLL7LB2MSIKi Z5cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ov4Hln9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp12si1749117ejc.300.2021.09.03.23.53.41; Fri, 03 Sep 2021 23:54:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ov4Hln9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233093AbhIDGqK (ORCPT + 99 others); Sat, 4 Sep 2021 02:46:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:46222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231984AbhIDGqJ (ORCPT ); Sat, 4 Sep 2021 02:46:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C19AF600AA; Sat, 4 Sep 2021 06:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630737908; bh=MVOIlssJq/adoFt1cVqsv0+pamI8JoDpoucmm2TnnT8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Ov4Hln9BpfKu0DjBJI3KZqVqJJNzWRI0yJIK37hm/aBrNMiJmsy0ImSH8jnst4IDW 7ank/wzMZ8keOv+hFx/QH7uh200t43fUUVA/1lZQFL82zEJZb+frtukVPTsy4ar9y9 3kVhWWim0ug1ewDrty4aAdTW0HQmsGJUmPxMnOJKx2u2gznG/rCxaNWgQeuf0gZj3d /7VTXWoSylVtg5H4ef5ckVvakvW2mo6mLekI6jMs7mzmfTqKOtGIzg/2dVDnHvMOgX diBu8DiXcVTFGCOYYI3EPinoJ+qqMt3oNOFg7hlcFcDvsg6FY1OO4C6UAZJHW3hE3v sHRsiRyrnWbXg== Subject: Re: [f2fs-dev] [PATCH v4] f2fs: introduce fragment allocation mode mount option To: Daeho Jeong Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong References: <20210902172404.3517626-1-daeho43@gmail.com> <9ab17089-accc-c3a3-a5dc-007fc4eeaa20@kernel.org> <8f8e4695-4062-60c4-0f91-2a1f6a5b0a11@kernel.org> From: Chao Yu Message-ID: Date: Sat, 4 Sep 2021 14:45:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/4 12:40, Daeho Jeong wrote: >> As a per curseg field. >> >>> Maybe, we run into the same race condition issue you told before for >>> fragment_remained_chunk. >>> Could you clarify this more? >> >> e.g. >> >> F2FS_OPTION(sbi).fs_mode = FS_MODE_FRAGMENT_FIXED_BLK >> fragment_chunk_size = 384 >> fragment_hole_size = 384 >> >> When creating hole: >> >> - f2fs_allocate_data_block >> - __refresh_next_blkoff >> chunk locates in [0, 383] of current segment >> seg->next_blkoff = 384 >> sbi->fragment_remained_chunk = 0 >> then we will reset sbi->fragment_remained_chunk to 384 >> and move seg->next_blkoff forward to 768 (384 + 384) >> - __has_curseg_space() returns false >> - allocate_segment() allocates new current segment >> >> So, for such case that hole may cross two segments, hole size may be truncated >> to left size of previous segment. > > First, sbi->fragment_remained_chunk should be seg->fragment_remained_chunk. Oh, correct. > I understand what you mean, so you mean we need to take the leftover > "hole" size over to the next segment? > In the example, the leftover hole size will be (384 - (512-384)). Do > you want to take this over to the next segment? Yes, the left 256 block-sized hole should be created before next chunk in next opened segment. Thanks, >