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 D3077C54E4F for ; Mon, 26 Feb 2024 01:32:37 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rePrA-0006WT-MW; Mon, 26 Feb 2024 01:32:37 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rePr8-0006WM-MA for linux-f2fs-devel@lists.sourceforge.net; Mon, 26 Feb 2024 01:32:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uIDhPLNiisO8kLje9+ppC9Q2Qs4N6ZNlTlkoeo5OPkw=; b=GQUqS4wZlP2cKwGb5lYx0Phg2W 3IxUrDn68NYrnqvXSPX15AzNpEsJmsumS5aA/qBoMMF/+bOQTQtlqjN/3942p0PGROQ5Ftq6iv2Ju nOeE2cvwr667OSsjFH3KvBOvSk2bQJLenIsDSLDZ/bE3TuLkWsQHtSXzBkU1xgqNpLLk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=uIDhPLNiisO8kLje9+ppC9Q2Qs4N6ZNlTlkoeo5OPkw=; b=J feFeapFlmr4tkipoPimKri6AwEVHe0tkstYzDAs9TgMxcyzz2vWTRh72nh2HD+XSanT8pGsOgQkSc hZx68fSAouOqOn2/O03xvs9lsDWxekQQbGbkBiS1Jz6nPE/hnHMMxTYLy+oVeC2dQ29g4XZW2kOir QgMfj3/0kwOlEK4c=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rePr4-0007wM-OK for linux-f2fs-devel@lists.sourceforge.net; Mon, 26 Feb 2024 01:32:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 54CF460DF3 for ; Mon, 26 Feb 2024 01:32:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E958C433C7; Mon, 26 Feb 2024 01:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708911140; bh=JC2tKZVI/N9NKXwRhcw37ItMYVdb46EEQNkTvwv2vU0=; h=From:To:Cc:Subject:Date:From; b=Sz8sjKAET+isPNL/4a4fFdhhgcMkhiNGh9nDOKbXa6M+bIqIqS/gJVLGUZt6kfd7U SM6tD2+qQrobZhW2CxqSvTkKSogfCArlGO5sLq10ZoNJ4ftQcU3PHCNZkcdMUjQRLT Rt5u70cfST75BOH4CAKDNkOdDeWq35f8VPOcUS8UMFQoi4eI+Xto7tlwLPA7XaS9qF qrt/yiu4dFYNzVNu1+2LcnQ7WFDzX1zUzcnE76vkZV4XPaNvyV1A9Ki0dJZqU0Bvzh hJKKTjm9B3Ol/u/2KtJPswTuPIFu6dGqdsdIO7zNpPTumy2iHJ7pj+zQVSZvE0tL81 LogR/jchMm3Wg== From: Chao Yu To: jaegeuk@kernel.org Date: Mon, 26 Feb 2024 09:32:05 +0800 Message-Id: <20240226013208.2389246-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1rePr4-0007wM-OK Subject: [f2fs-dev] [PATCH 1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks() 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: linux-kernel@vger.kernel.org, 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 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); -- 2.40.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 99B8F4C91 for ; Mon, 26 Feb 2024 01:32:20 +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=1708911140; cv=none; b=DdfKZFRpIvm++ivQYVy6OsXsfOqSgwrL3Z4Cz5FetwKyNyywZ9cEW2xIcH2DHDY3Vrgwoasxab7Khnp4+TLbHK4x48iA1l7uN5nfSW7cOvtW1Wt5GZG8Mpmb48gEYprwfIlJOdwyYeOcYRyqRuw69ia4QtbvJXJumaeWgoqIJVc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708911140; c=relaxed/simple; bh=JC2tKZVI/N9NKXwRhcw37ItMYVdb46EEQNkTvwv2vU0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=p9EhI/S2+KAhhiyBYUm4SSMDD6ZQBg/pPfigi8n4AkZhkUc/ucm+QEVBxPzWr8wK7pcj37IJ55qMbVZ4966ImIDBd4qKIOu9BlYKeaGW0sdlMuEZitQ/rbrmtKj43EQWJtWd08OtCpFqzEkyF6BpAMULku6Z8rIoFjWyNMqxx4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sz8sjKAE; 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="Sz8sjKAE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E958C433C7; Mon, 26 Feb 2024 01:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708911140; bh=JC2tKZVI/N9NKXwRhcw37ItMYVdb46EEQNkTvwv2vU0=; h=From:To:Cc:Subject:Date:From; b=Sz8sjKAET+isPNL/4a4fFdhhgcMkhiNGh9nDOKbXa6M+bIqIqS/gJVLGUZt6kfd7U SM6tD2+qQrobZhW2CxqSvTkKSogfCArlGO5sLq10ZoNJ4ftQcU3PHCNZkcdMUjQRLT Rt5u70cfST75BOH4CAKDNkOdDeWq35f8VPOcUS8UMFQoi4eI+Xto7tlwLPA7XaS9qF qrt/yiu4dFYNzVNu1+2LcnQ7WFDzX1zUzcnE76vkZV4XPaNvyV1A9Ki0dJZqU0Bvzh hJKKTjm9B3Ol/u/2KtJPswTuPIFu6dGqdsdIO7zNpPTumy2iHJ7pj+zQVSZvE0tL81 LogR/jchMm3Wg== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH 1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks() Date: Mon, 26 Feb 2024 09:32:05 +0800 Message-Id: <20240226013208.2389246-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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); -- 2.40.1