Message ID | 20240223025403.1180558-1-chao@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-77691-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp350324dyb; Thu, 22 Feb 2024 18:54:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVnIhkr1XOEppJZzbG7DdEsvb7RbBkWwkIR81G034XFUjIaddd/hBlZTKmOx/sRgNw0q9Xzf0XktqBNI/4IE899fIoafg== X-Google-Smtp-Source: AGHT+IHMXdWYN4nvZMH+9pBfTdKq+tJfh0BsEvwLMLmK216+0hAHGcqKZHXT2/r0jRl67MMc+izw X-Received: by 2002:a05:620a:1909:b0:787:28c3:b323 with SMTP id bj9-20020a05620a190900b0078728c3b323mr998706qkb.62.1708656863821; Thu, 22 Feb 2024 18:54:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708656863; cv=pass; d=google.com; s=arc-20160816; b=EW+HVsXaY8zvL9kiVSQ4GJue3XJ2dOoleXXzR5L3XGtQbCf5dgA4YIQjhAsJpiFqS/ 86091Z6ed2GdHhzxCXSq2U6UxF1QkugBkgHRdYzJrR8EfjIkPvknNDPqtc62q0icwK1e 8bliTZXW0kk9xsNfOrHmSxe/4HrhhW9BdN0l3Zgj4z41v4m4eGHqZslX1qPSCI6pKAd6 YBBI+/dpvi3DUlAjyvOCHzWieUPA6h59B4a3YY0rYNFMhYvyB39BoNhTSQ2v62LqEFad ChhkfS4kXCI1CesN/1LRaj36mhhPE9ZaStIL2cXWVdNmzXSt3zYc6YeVTDvoI2O+cWcv g2uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=qtA3eltSePaTBgB6QYbPO9ANNSqGG8hN5MM4sC7tRSc=; fh=X1/oBJvTGJUQ0YtRp03u+3tPfRw/dXXALWynfOSlfQQ=; b=e3xSRz/2F1VxlkRQPlaZTKr29Ybk9SAmiYJYrsbaaAFCFshLPll2X14nusEm+OrtHX z58iKX0frhDfsCaFl6SPB2EtTUIWSCJeSrxVKwp5sVu5igtCLoENcUp8k9Vd4P+fQCEH sPzTtK1UU2YfLm5Kr9dEYa7OEusYdTr4x2o0hixdemGVq+S9Bl7BF2vYE7ZTjPcWEc6E OvRVSoq+i9i5Vq1ZdxdXFDGyXYlGSDQdSl+c4t4dkFQGleSJBFmXtGvIC+eA1Mgilzvq 8J6hDul5alJ4zU6nf2DxmfGVqXEytCMWEdJe7/WWaELfu/oxK4HAorvuz+8kY/4p8o2s Isdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FH6omqY0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77691-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77691-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ea12-20020a05620a488c00b007877aaee9casi7685138qkb.435.2024.02.22.18.54.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 18:54:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77691-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FH6omqY0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77691-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77691-ouuuleilei=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 9929D1C21CAA for <ouuuleilei@gmail.com>; Fri, 23 Feb 2024 02:54:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0B3D111BE; Fri, 23 Feb 2024 02:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FH6omqY0" 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 4997611185 for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 02:54:10 +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=1708656851; cv=none; b=m/027FHn6M6LavKW2P60SMxNkyQSNDbRpWq+t1DD4GHjgMvMRJstnXyOZweVXx4VzXWxCXGOs9nw1WjgsIh950t1pmjUiH9z+cMbARPPcE2R8OCD+j+1FrnqlL8d8kH3Zjd+ZTUg+54K3sMubt7499iVzfygUMPVsNIO5EsYmjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708656851; c=relaxed/simple; bh=MtfIvW3ZInRpl5iX8uy2azMoMXfPseve2FHzcWCecMY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=i1OEVnfnJg8EPfk2ra0vjK2gZ9KgBpDI9S0mz1Z5uLm7uNOSXA1bTvgQsolDsyWVHqNQG7ilb+KwDfd3sQK7Sx8CbO0z/vgHzoCPapSHvDqbZPcUYjD2kB+zD7iZtceAhAZ7niJmI/FilAT5460ueMmBIL7hhor3FaA+y4Iiq2A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FH6omqY0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C2DCC433C7; Fri, 23 Feb 2024 02:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708656850; bh=MtfIvW3ZInRpl5iX8uy2azMoMXfPseve2FHzcWCecMY=; h=From:To:Cc:Subject:Date:From; b=FH6omqY0SODN7lStTxvDfIWw8IYve+dQJ55KIhtdpcLxcL0VzlW3FT8NTghAq0Ci+ 7HBjwq/UTV8RTUWZTu/r+CwK7DTelSMsLFlIxDcuRQt/rdwkdQpg71xO+wYXhBQ90O G5/kUPbkiOynTfIJN1Pvu/p9d3FK/+v2GnZ0IQvS6q8PLdoLKEH4h8q2c4lLESZm8M vQJHGsg+NonHzD2REEYQ+UMi1QaNIJ/XDgGLWtxrs8SOJmEkLQPbIC5ACduYeBdMSm WoP43snOalEKqDxHHfwKYOWR1R1zdQqMXyubCC0uz0KT706RvB++ugxxv77bidCyFV kSStx7lgMlo8A== From: Chao Yu <chao@kernel.org> To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org> Subject: [PATCH] f2fs: fix to use correct segment type in f2fs_allocate_data_block() Date: Fri, 23 Feb 2024 10:54:03 +0800 Message-Id: <20240223025403.1180558-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791656579961619874 X-GMAIL-MSGID: 1791656579961619874 |
Series |
f2fs: fix to use correct segment type in f2fs_allocate_data_block()
|
|
Commit Message
Chao Yu
Feb. 23, 2024, 2:54 a.m. UTC
@type in f2fs_allocate_data_block() indicates log header's type, it
can be CURSEG_COLD_DATA_PINNED or CURSEG_ALL_DATA_ATGC, rather than
type of data/node, however IS_DATASEG()/IS_NODESEG() only accept later
one, fix it.
Fixes: 093749e296e2 ("f2fs: support age threshold based garbage collection")
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/segment.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 02/23, Chao Yu wrote: > @type in f2fs_allocate_data_block() indicates log header's type, it > can be CURSEG_COLD_DATA_PINNED or CURSEG_ALL_DATA_ATGC, rather than > type of data/node, however IS_DATASEG()/IS_NODESEG() only accept later > one, fix it. > > Fixes: 093749e296e2 ("f2fs: support age threshold based garbage collection") > Signed-off-by: Chao Yu <chao@kernel.org> > --- > fs/f2fs/segment.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index d0209ea77dd2..76422f50e6cc 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -3505,12 +3505,12 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, > locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); > locate_dirty_segment(sbi, GET_SEGNO(sbi, *new_blkaddr)); > > - if (IS_DATASEG(type)) > + if (IS_DATASEG(se->type)) We have se only when type is CURSEG_ALL_DATA_ATGC. We may need to change IS_DATASEG()? > atomic64_inc(&sbi->allocated_data_blocks); > > up_write(&sit_i->sentry_lock); > > - if (page && IS_NODESEG(type)) { > + if (page && IS_NODESEG(se->type)) { > fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg)); > > f2fs_inode_chksum_set(sbi, page); > -- > 2.40.1
On 2024/2/24 4:52, Jaegeuk Kim wrote: > On 02/23, Chao Yu wrote: >> @type in f2fs_allocate_data_block() indicates log header's type, it >> can be CURSEG_COLD_DATA_PINNED or CURSEG_ALL_DATA_ATGC, rather than >> type of data/node, however IS_DATASEG()/IS_NODESEG() only accept later >> one, fix it. >> >> Fixes: 093749e296e2 ("f2fs: support age threshold based garbage collection") >> Signed-off-by: Chao Yu <chao@kernel.org> >> --- >> fs/f2fs/segment.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >> index d0209ea77dd2..76422f50e6cc 100644 >> --- a/fs/f2fs/segment.c >> +++ b/fs/f2fs/segment.c >> @@ -3505,12 +3505,12 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, >> locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); >> locate_dirty_segment(sbi, GET_SEGNO(sbi, *new_blkaddr)); >> >> - if (IS_DATASEG(type)) >> + if (IS_DATASEG(se->type)) > > We have se only when type is CURSEG_ALL_DATA_ATGC. We may need to change Oops, correct. > IS_DATASEG()? Sure, I guess one other way is to use curseg->seg_type, let me know if you prefer to change IS_DATASEG(). Thanks, > >> atomic64_inc(&sbi->allocated_data_blocks); >> >> up_write(&sit_i->sentry_lock); >> >> - if (page && IS_NODESEG(type)) { >> + if (page && IS_NODESEG(se->type)) { >> fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg)); >> >> f2fs_inode_chksum_set(sbi, page); >> -- >> 2.40.1
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d0209ea77dd2..76422f50e6cc 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3505,12 +3505,12 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); locate_dirty_segment(sbi, GET_SEGNO(sbi, *new_blkaddr)); - if (IS_DATASEG(type)) + if (IS_DATASEG(se->type)) atomic64_inc(&sbi->allocated_data_blocks); up_write(&sit_i->sentry_lock); - if (page && IS_NODESEG(type)) { + if (page && IS_NODESEG(se->type)) { fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg)); f2fs_inode_chksum_set(sbi, page);