Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp978288pxb; Thu, 9 Sep 2021 16:58:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykDhRgjcF5iLnc9m8wT9cPODH8WX1uJAeHyS5RtzkJ/kb7T/hDBrRQIPSy85jN3RBnq0Hw X-Received: by 2002:a05:6638:3eb:: with SMTP id s11mr2053232jaq.67.1631231937787; Thu, 09 Sep 2021 16:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631231937; cv=none; d=google.com; s=arc-20160816; b=Hd0U9dbH/DGy3a8nBg+NELzyFqlm6Ds6/3db6FWSiGWsBRU6bhzmDECcgqe5n21Kb/ beH5h+GmZxSQwcQaB28X/PRCoTi5i/ykYvT2bFFrg5qbnDNWbZSu2buvQgWZPWQoTCh1 iVHtBbt5gRzAa4IlUWRJmJiIAHEqNEdAeLBz/y8rkKeVjkF/BCiKJJQOsC2yl2/9nbq7 vNcuEhHn9MMUBensJFT4T0EjIDyDyOvcpI8cPWUKYfKl5E94tyQQ48/Z8L+CQkkQKo1R NnQ8Nk1l8eOyiY7XNJZnERoYEZvtlVcb4EE4SjUVOu18L2GtS5oqxkv518aJO5Rx7FMs EQeA== 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=xeYN+ZSzEiG6/fLNatOIqFXgBa99FJbQLnWYzAdUC3M=; b=O/9hvVNKChIOew2+P5D/4/yTsK+eZweJzx5IKmR6Io/gXCZ1J6OOl2lvX5L/8H9orN IQFGm5eq3SxVsZ3+Vc0MgUJFDtpBnh3XtonnjZ8Qz9wgcS6UlMOx7Uw9kdFEK5pokAzH NnmIqGxakmRoQ8K8xAg2UPeuC5D/2+UBoJmtu4Kdxsz3YH1dqEa11GVh+eY6NT/wK6Np u3HZdvTtqzJ+My0/UEmPpyQQKbgx8+y2InSGM7mXU6N+5bXt1CUcr3tF9PrEa52L7c7p 1TjI3g3cYRDlvYGw+X8b+nC/9G3bMN7cJBkCMdOT2WDSM22umPlRswgtF2AJ/3wqMJJ9 IjMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QRrio1fz; 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 f11si3106852iok.80.2021.09.09.16.58.46; Thu, 09 Sep 2021 16:58:57 -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=QRrio1fz; 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 S229508AbhIIXwJ (ORCPT + 99 others); Thu, 9 Sep 2021 19:52:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:60924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbhIIXwI (ORCPT ); Thu, 9 Sep 2021 19:52:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CFE3961101; Thu, 9 Sep 2021 23:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631231458; bh=DQNK28TOeDI5KHJpmRRR0Z4mB4pizyslewVn/qlEKPo=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=QRrio1fzenwWgX6Chhm0F9E6aA/MLYtTo/Gf9lc2XRxuYjHai/9/11KSIM3Hdx7Z+ 7fQ/ZDn/4Wq9jYQVu4OUoOOv+sQ3c2VmXdgtz1u+RrTZ6sRuLP/8ZD0qC7WV14Dw3c XvbN6ZZddtTBir/x6x+ZSRsBuB5JIpM3T76vl6COdqCfX/UY102tPl+mBdkkJqI3Au +l59v3N4bp3SXEQED1e/z2g+VDyw1mTdeGa8Kc0YMTKxVJPJz2TI3WyTGCQFvQT2jx D/yVRXXT+sDctnL5HeZfIwPWWxYU/DjZVopU4Hj3Nj2mfSIlGQa0N3d8UNlUCtmJqZ M6ulAt/tmp71Q== 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: Fri, 10 Sep 2021 07:50:57 +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/8 2:12, Daeho Jeong wrote: > On Fri, Sep 3, 2021 at 11:45 PM Chao Yu wrote: >> >> 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. >> > > Chao, > > Do you have any decent idea to pass the left hole size to the next > segment which will be allocated? Daeho, I guess we can record left hole size in seg->fragment_remained_hole. Thanks, > > Thanks, > >> Thanks, >> >>>