From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E54CC4345F for ; Mon, 29 Apr 2024 17:42:19 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1s1V17-0006DQ-N4; Mon, 29 Apr 2024 17:42:18 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1s1V16-0006DG-H2 for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Apr 2024 17:42:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=h/Y42jh5LPtII17/c/+XlyPq8CoeyYRBRQ4ZWFpNvvk=; b=EvQ8xtvmnERxIr2AbjC2gtczFK RzXU7abcXn7q3vr7q99u3h8UPyj4UtSLDktiVcow5PesjDjwnMiuVY6i3P4EJm42N8+5soC2hVSBd ziVBfOtVvgmQifPVw2Xv2zsZScFUivl4CyBaP+qko4ZZuJ3EgBX3QdVRSe3+9UHvO90k=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=h/Y42jh5LPtII17/c/+XlyPq8CoeyYRBRQ4ZWFpNvvk=; b=AG4i0IFYBM8MDpvtIcmirtPe93 Ql5CTivDxoagUHwnYOiMu8RgmCk1sxQJJ+30wu9TlyDvswkHcFzV2KDmvx+EI2QdnBrccRDZUL37B AYPsPhhZoaPTenTIzg0kb2rFDZ7WjAV82QqvWjZegLeJ+iXUnutDA/tinFsGzR08OBr4=; Received: from sin.source.kernel.org ([145.40.73.55]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1s1V15-0004zO-8A for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Apr 2024 17:42:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BA408CE0B4F; Mon, 29 Apr 2024 17:42:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A87AC113CD; Mon, 29 Apr 2024 17:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714412522; bh=yakMz0hoQgUZe2Te30CXUQdBv3i+eTPVugrRBpkhO2s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hStxyTpTfnLBwdqXiQlRLFW8Gl4zI5C6dALu44IQL4xttAJBcsC0KeMCg64+Z5sE+ tuI3LnRRLRjzcKrrpkoZLah4tCBrUMBIAHmHc1qsw4hTQiY6eKfZQLzf5eJmX/kEIR lJOXCx1PWz2LAqI/xLrs6NkArYbrGPygrxThyBEpZkEZZ/JlKLjily3ZqfT0Q3IGqj aMMxG9u6JcNWQE9372Cc2ZFWqrmHRX288M4QrkKLQjCbqT7r4HXIwEHnoF5nMDweGW yWa1hm85jn1rsQAnbXD1QsKVtkz7TnxkHTiy6FPIqs0FPijcGLJ/BzUvg9HKqQwDrX de+oih0b1BRRw== Date: Mon, 29 Apr 2024 17:42:01 +0000 From: Jaegeuk Kim To: Wu Bo Message-ID: References: <20240426104156.321701-1-bo.wu@vivo.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1s1V15-0004zO-8A Subject: Re: [f2fs-dev] [PATCH] f2fs: fix block migration when section is not aligned to pow2 X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wu Bo , linux-kernel@vger.kernel.org, Liao Yuanhong , linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 04/29, Jaegeuk Kim wrote: > On 04/26, Wu Bo wrote: > > As for zoned-UFS, f2fs section size is forced to zone size. And zone > > size may not aligned to pow2. > > > > Fixes: 859fca6b706e ("f2fs: swap: support migrating swapfile in aligned write mode") > > Signed-off-by: Liao Yuanhong > > Signed-off-by: Wu Bo > > --- > > fs/f2fs/data.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > > index d9494b5fc7c1..7ff5ad3fd5dc 100644 > > --- a/fs/f2fs/data.c > > +++ b/fs/f2fs/data.c > > @@ -3904,7 +3904,6 @@ static int check_swap_activate(struct swap_info_struct *sis, > > int nr_extents = 0; > > unsigned long nr_pblocks; > > unsigned int blks_per_sec = BLKS_PER_SEC(sbi); > > - unsigned int sec_blks_mask = BLKS_PER_SEC(sbi) - 1; > > unsigned int not_aligned = 0; > > int ret = 0; > > > > @@ -3942,8 +3941,8 @@ static int check_swap_activate(struct swap_info_struct *sis, > > pblock = map.m_pblk; > > nr_pblocks = map.m_len; > > > > - if ((pblock - SM_I(sbi)->main_blkaddr) & sec_blks_mask || > > - nr_pblocks & sec_blks_mask || > > + if ((pblock - SM_I(sbi)->main_blkaddr) % blks_per_sec || > > + nr_pblocks % blks_per_sec || > > Modified a bit to address udiv issue like below. Let's see. Ok, I took v2 instead of this. > > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -3923,8 +3923,8 @@ static int check_swap_activate(struct swap_info_struct *sis, > sector_t highest_pblock = 0; > int nr_extents = 0; > unsigned long nr_pblocks; > + u32 align; > unsigned int blks_per_sec = BLKS_PER_SEC(sbi); > - unsigned int sec_blks_mask = BLKS_PER_SEC(sbi) - 1; > unsigned int not_aligned = 0; > int ret = 0; > > @@ -3961,10 +3961,10 @@ static int check_swap_activate(struct swap_info_struct *sis, > > pblock = map.m_pblk; > nr_pblocks = map.m_len; > + div_u64_rem(nr_pblocks, blks_per_sec, &align); > > - if ((pblock - SM_I(sbi)->main_blkaddr) & sec_blks_mask || > - nr_pblocks & sec_blks_mask || > - !f2fs_valid_pinned_area(sbi, pblock)) { > + if ((pblock - SM_I(sbi)->main_blkaddr) % blks_per_sec || > + align || !f2fs_valid_pinned_area(sbi, pblock)) { > bool last_extent = false; > > not_aligned++; > > > !f2fs_valid_pinned_area(sbi, pblock)) { > > bool last_extent = false; > > > > -- > > 2.25.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 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 584DD126F1E for ; Mon, 29 Apr 2024 17:42:03 +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=1714412523; cv=none; b=bSujPgWIGXnc8oGK95gVIP0jj3yos5XBgLjsGNOkeixYoc/D7kn3ZnAS1P/9HI38Joda2Q5lHafn8QgIQxqT700JQvhpHk7jQ8iz4Ro3x7RwoHYjBoqKITxmtBOg4wIXRFug5YYbrobYNbv7cyJf2cAug1thSuUYhUw5HFtJ1b0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714412523; c=relaxed/simple; bh=yakMz0hoQgUZe2Te30CXUQdBv3i+eTPVugrRBpkhO2s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SO6o3uoKYc9w3cPMaeqUsW5CFtKsLUT2AOsqZp5fa9lfKctfrDcEl8p0DSCovO0bO3aAtwmKql1fUadtuHB6hh5+KcWt/9uvtVpXCNbXygnqpZWEl32GkgAbLY84bkOJNhEWZsB/2McITIRhqd4VHtlZyNt68z1mC9yo4WY4+E0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hStxyTpT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hStxyTpT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A87AC113CD; Mon, 29 Apr 2024 17:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714412522; bh=yakMz0hoQgUZe2Te30CXUQdBv3i+eTPVugrRBpkhO2s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hStxyTpTfnLBwdqXiQlRLFW8Gl4zI5C6dALu44IQL4xttAJBcsC0KeMCg64+Z5sE+ tuI3LnRRLRjzcKrrpkoZLah4tCBrUMBIAHmHc1qsw4hTQiY6eKfZQLzf5eJmX/kEIR lJOXCx1PWz2LAqI/xLrs6NkArYbrGPygrxThyBEpZkEZZ/JlKLjily3ZqfT0Q3IGqj aMMxG9u6JcNWQE9372Cc2ZFWqrmHRX288M4QrkKLQjCbqT7r4HXIwEHnoF5nMDweGW yWa1hm85jn1rsQAnbXD1QsKVtkz7TnxkHTiy6FPIqs0FPijcGLJ/BzUvg9HKqQwDrX de+oih0b1BRRw== Date: Mon, 29 Apr 2024 17:42:01 +0000 From: Jaegeuk Kim To: Wu Bo Cc: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Wu Bo , Liao Yuanhong Subject: Re: [PATCH] f2fs: fix block migration when section is not aligned to pow2 Message-ID: References: <20240426104156.321701-1-bo.wu@vivo.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: On 04/29, Jaegeuk Kim wrote: > On 04/26, Wu Bo wrote: > > As for zoned-UFS, f2fs section size is forced to zone size. And zone > > size may not aligned to pow2. > > > > Fixes: 859fca6b706e ("f2fs: swap: support migrating swapfile in aligned write mode") > > Signed-off-by: Liao Yuanhong > > Signed-off-by: Wu Bo > > --- > > fs/f2fs/data.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > > index d9494b5fc7c1..7ff5ad3fd5dc 100644 > > --- a/fs/f2fs/data.c > > +++ b/fs/f2fs/data.c > > @@ -3904,7 +3904,6 @@ static int check_swap_activate(struct swap_info_struct *sis, > > int nr_extents = 0; > > unsigned long nr_pblocks; > > unsigned int blks_per_sec = BLKS_PER_SEC(sbi); > > - unsigned int sec_blks_mask = BLKS_PER_SEC(sbi) - 1; > > unsigned int not_aligned = 0; > > int ret = 0; > > > > @@ -3942,8 +3941,8 @@ static int check_swap_activate(struct swap_info_struct *sis, > > pblock = map.m_pblk; > > nr_pblocks = map.m_len; > > > > - if ((pblock - SM_I(sbi)->main_blkaddr) & sec_blks_mask || > > - nr_pblocks & sec_blks_mask || > > + if ((pblock - SM_I(sbi)->main_blkaddr) % blks_per_sec || > > + nr_pblocks % blks_per_sec || > > Modified a bit to address udiv issue like below. Let's see. Ok, I took v2 instead of this. > > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -3923,8 +3923,8 @@ static int check_swap_activate(struct swap_info_struct *sis, > sector_t highest_pblock = 0; > int nr_extents = 0; > unsigned long nr_pblocks; > + u32 align; > unsigned int blks_per_sec = BLKS_PER_SEC(sbi); > - unsigned int sec_blks_mask = BLKS_PER_SEC(sbi) - 1; > unsigned int not_aligned = 0; > int ret = 0; > > @@ -3961,10 +3961,10 @@ static int check_swap_activate(struct swap_info_struct *sis, > > pblock = map.m_pblk; > nr_pblocks = map.m_len; > + div_u64_rem(nr_pblocks, blks_per_sec, &align); > > - if ((pblock - SM_I(sbi)->main_blkaddr) & sec_blks_mask || > - nr_pblocks & sec_blks_mask || > - !f2fs_valid_pinned_area(sbi, pblock)) { > + if ((pblock - SM_I(sbi)->main_blkaddr) % blks_per_sec || > + align || !f2fs_valid_pinned_area(sbi, pblock)) { > bool last_extent = false; > > not_aligned++; > > > !f2fs_valid_pinned_area(sbi, pblock)) { > > bool last_extent = false; > > > > -- > > 2.25.1