Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp14544lqg; Thu, 29 Feb 2024 17:55:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXYcrJ5XJUGUzkice+KD2UZDis/gHC+VWZfzjhNz2b3BvYhTkdo5jHq6iLcJsk5v3gjN9l3Dy4yrzoU4H00vgUYLV4c46SyNSNBaNUrdw== X-Google-Smtp-Source: AGHT+IFJ8x08DCFG5+VB3/J+xNGlgo6D8agJiCrVpeRcexWWeFdMRfLJvl1vmdiduYSsnlV+dXVn X-Received: by 2002:a05:620a:1459:b0:787:f44e:896a with SMTP id i25-20020a05620a145900b00787f44e896amr373464qkl.71.1709258131239; Thu, 29 Feb 2024 17:55:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709258131; cv=pass; d=google.com; s=arc-20160816; b=EyVYTbHd3j4zO303IvZ4f43mYrwOqV9Q1F+stEarUt7sKmGJFnT6RrUdDmFnFsF5km AVhEFc4b3gnBZlVF4U/5OQO5VEqg3FxXQQio5Cjru6VjWAy3KDBD431rDDv4MiW8SuVd GN2q4nWvpmxuh48QKfMoAsp4lojmD8JYJwhcXP2G2XQAZCqcdeCOkOY9xYpVhbpZEN6W YbfWvqLj+Go9QUxBIBBQ65Omfq+KKEk7gdSYbEkz0nr79fvhi3YHl2NRAe++1LXjt51x FyRE/pfUQTC/0u4Mw6Wl9iuG1etZY/2dmX01k3ulNfQL4LeaAnkTLX3nDxEAmPcx51NN 8oiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=UfFhyJQV5J+KQw+ms+53IAuCxU/uP7woEMPVcWwZEZQ=; fh=+FZvTH9RYPl1jqwLPmbii3Jy3z9K+XrD3La6EON3E5A=; b=BTD8AE/zooKgyiAn1dxZtG7+axFGplzaM+P7yaa6ZheTm6jaNYfkfFK4F/GbzxJA0r hNtpbDfHJwS9sMaInuliU0ys5N/fXN8sqTdf+Fm+vIckqO4wD1ZyFZBcPV/QctyFc20g sGF9jJzIuU7OddK8E84HIW82t1QLALRcQjWHzhi6PUQZlCeZRS3hVPRRc9fF+3bUJ3fH TEjNN7PgW6T0Tn7jYz2D2bQ0r6RhRN93NimyAG6/bUnS1lx/aEPdFXKW8rCnGvUM0RII zljcln9BwWxXFzapg2XYMQZnb5iWHREzJ4sZ7eg35uIgZcHdf+hTKw4Ybqim7nEoZMQt mrhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="gY/nZbu3"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87803-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 xz20-20020a05620a5e1400b00787ec0d7144si2687443qkn.359.2024.02.29.17.55.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 17:55:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87803-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=@kernel.org header.s=k20201202 header.b="gY/nZbu3"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87803-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 A32CB1C20E6B for ; Fri, 1 Mar 2024 01:55:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27AD6364BC; Fri, 1 Mar 2024 01:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gY/nZbu3" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 54DA72BAF0 for ; Fri, 1 Mar 2024 01:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709258123; cv=none; b=KLzHd7VGh0YNsHbmOYNWWzqElZPlhHzZIpu8Y+ldMfg1J++CBdQA+cG1AYX75BzMTUl8HAUQvIMqk1ChcLUoe+Lx5UvokLeXG4AVKfgFPg20AJ0m5bbtyZqIuR/M54r+dMx1y+xlh4dve6Dk5Y7v8AqbgxavCYwPv4tdwrhddxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709258123; c=relaxed/simple; bh=cbqoixCcz2zE8+F9Pz2JkEG1qy/+t8gYH7RfdkUJYUw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=B5ABLYWXNbb1ae0OaYUUrjQKXsPIr1eibaxcgH9OZS0OTEg00/YIlSEsEY0A3WdHZ1eZKCE4un54v68Z1fdmw2YOQIMo93KeQAuYB0YnJxD1Vd34u4U5lH+59qJNfXAXJj2kHKSmW7c5RK+yuucFemlPHgwz61bxvfcsKsOVGMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gY/nZbu3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDC31C433C7; Fri, 1 Mar 2024 01:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709258122; bh=cbqoixCcz2zE8+F9Pz2JkEG1qy/+t8gYH7RfdkUJYUw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=gY/nZbu3L7l92Zt1PCeX1GhBMup6uD9QPIRva9ZiDGX97+d0l1EYQJofw1vcRB/1H y9YkGZt5rxsFIbyVDuSiWwW36SDZf1wSiPIHG3H7mXbVJbDo6cfCRumFVZS56qANjF UpO5U9w0NDrEMSRedjunrhhkfRHljnZu1Cf1aPSsKjBp9+7uTfST23NDCzbxjqPWj1 JVhyN5JackZIzxecSMsGRUVFUqTgGE4FpMaK6uVi+srfHD1E0W6R7EFGZzVMWgb/ts OOyJOSMg8rElxld5nLthF613+gRap9DLo7rXD6LXOSDNz7Ca8DnNVv+7UNqayhX9nB A3sqpI/zI1XJQ== Message-ID: <3325fdb0-1f21-4ba9-919a-09fa0206f7c5@kernel.org> Date: Fri, 1 Mar 2024 09:55:14 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [f2fs-dev] [PATCH 1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks() Content-Language: en-US To: Daeho Jeong Cc: jaegeuk@kernel.org, Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20240226013208.2389246-1-chao@kernel.org> <2b81aa6f-db51-4a7c-97ab-2af2c2fea056@kernel.org> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/3/1 1:41, Daeho Jeong wrote: > On Thu, Feb 29, 2024 at 2:11 AM Chao Yu wrote: >> >> Jaegeuk, Daeho, >> >> Any comments on this serials? >> >> Thanks, > > No functional difference here, since start_blk is always aligned with > the section address. You're right. > However, this is more clear in itself. Thanks for the review! One more thing is, I found that fallocate() on pinned file will preallocate aligned w/ section-size which is about several hundred megabyte for ZUFS case, since commit e1175f022911 ("f2fs: fix to align to section for fallocate() on pinned file"). It looks not make sense, especially for logcat case which actually want to preallocate 2MB space, so, what about reverting commit e1175f022911 and looking for other solution to avoid GCing on fragmented pinned file. What do you think? Thanks, > > Reviewed-by: Daeho Jeong > > Thanks, > >> >> On 2024/2/26 9:32, Chao Yu wrote: >>> In f2fs_migrate_blocks(), when traversing blocks in last section, >>> blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it. >>> >>> Signed-off-by: Chao Yu >>> --- >>> fs/f2fs/data.c | 5 +++-- >>> 1 file changed, 3 insertions(+), 2 deletions(-) >>> >>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c >>> index c21b92f18463..0c728e82d936 100644 >>> --- a/fs/f2fs/data.c >>> +++ b/fs/f2fs/data.c >>> @@ -3841,13 +3841,14 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk, >>> struct f2fs_sb_info *sbi = F2FS_I_SB(inode); >>> unsigned int blkofs; >>> unsigned int blk_per_sec = BLKS_PER_SEC(sbi); >>> + unsigned int end_blk = start_blk + blkcnt - 1; >>> unsigned int secidx = start_blk / blk_per_sec; >>> unsigned int end_sec; >>> int ret = 0; >>> >>> if (!blkcnt) >>> return 0; >>> - end_sec = secidx + (blkcnt - 1) / blk_per_sec; >>> + end_sec = end_blk / blk_per_sec; >>> >>> f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); >>> filemap_invalidate_lock(inode->i_mapping); >>> @@ -3857,7 +3858,7 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk, >>> >>> for (; secidx <= end_sec; secidx++) { >>> unsigned int blkofs_end = secidx == end_sec ? >>> - (blkcnt - 1) % blk_per_sec : blk_per_sec - 1; >>> + end_blk % blk_per_sec : blk_per_sec - 1; >>> >>> f2fs_down_write(&sbi->pin_sem); >>> >> >> >> _______________________________________________ >> Linux-f2fs-devel mailing list >> Linux-f2fs-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel