Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6051953pxu; Wed, 23 Dec 2020 12:05:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbjCp6MYqF2LHuW+GDvdhXIIkk2EH7YfUS4loMHqOGigyR0AjMj4WDEb70g+UTH5xvNHti X-Received: by 2002:a05:6402:13d1:: with SMTP id a17mr25978038edx.202.1608753908644; Wed, 23 Dec 2020 12:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608753908; cv=none; d=google.com; s=arc-20160816; b=H66HXCKlwi/Ozbbl2au3pVVWnFEw/yRCODEabwitmdcauUXvHfIFIbPJ6iR8PxNGFB WS2rVeHEJsq5nwpsWlbNnH/zaatNmZ9h44nDYhOiLaaHkNQDhE6LEcDC3NMHFW7LSwNB TUxIt2Glja89OqPmmteu64W8mgAWZhnUrBk/o4Qb7Cbi9O0ZliSJ73zeR/zpZZhJ8z7i F+iuBVw5A6RaVFSW1/mKC05l8ifLKIbw7ImzYjwqns0Q1O3aDKVNTQBTpgTL1qiGUW0F 8zDipFC9FenQI2Ye5jv29A/B88e9D7NrI7yZmQxrubr807APjmHh7ew4rLrY0wguBbjp WVTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZHCX7+4uOB3+eEPtEoMeS+65nc2tXCWaBIaKV7jYxkM=; b=dw1MgM6olcRyTqalVm2HuNQMc2yqhFAGNaf9dfsmXXCjre3NAAtIr8feco6N2RyV9B 2opDLQJXoEVIGpvPfDGkDrg35ixaK0+n2Gp16g7p1LjnW8iZZBqp0dCldb/inu49G/yv rFJB3MKNmsGFoLpxBRnqB2cL+B3lR5WdW919fRRftyf0l72mpb9NtlSVhTl9/0Mb64Ua WOEg2H2xQrOFjjxEoeBvUaERI471Ovq4U9ACrhbMYGMGR/h+YiiQX0HPsJ2S8PpPE/7K vjEorUgGCAi6ZxOFk+esjunmtjOg8a3CrnX+yqoMK9mfi2s3DVCjnU3v5eiQFZG+qdUq Ez6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iqJNWX99; 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 pw18si12215607ejb.163.2020.12.23.12.04.46; Wed, 23 Dec 2020 12:05:08 -0800 (PST) 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=iqJNWX99; 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 S1728530AbgLWUDd (ORCPT + 99 others); Wed, 23 Dec 2020 15:03:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:36618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728017AbgLWUDc (ORCPT ); Wed, 23 Dec 2020 15:03:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 119F820575; Wed, 23 Dec 2020 20:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608753772; bh=OzQGdhwS/4twVbEa/nGXLGrUFMVqdR1IXK6igwQCBaY=; h=From:To:Cc:Subject:Date:From; b=iqJNWX99Qx764DXvmwDVsolI1kGuOUhAJqcvb7dobdR0xZeRJ2LqiPRSICKTeRnw7 ulDaoNW/8Qjfpc/RmXhH06bY/kLQImUlj9Hrmd+EeEizahP1aXYWjhW3w+rSE8VYPe JU4ryaZkcNRjaehLC3EvmquVhYqys9v8eqBLGs4YuGNSHvyjT+AGX0yM9EAFKUm+Up llJQuEw3x7Ctcj4mItL68MWklO+C6i9AqLCrflvkQxZctYttOv+tvbhSDIVYS3l2r2 ItJymhgjrFzjDfvgSUYf7ahJ4pdoeP/sXzVQEYcTDTAixDBI8c+08vXVHMSLrwSdH1 QoGd5L1ZYUU0g== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Jaegeuk Kim Subject: [PATCH] f2fs: handle unallocated section and zone on pinned/atgc Date: Wed, 23 Dec 2020 12:02:42 -0800 Message-Id: <20201223200242.2078243-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we have large section/zone, unallocated segment makes them corrupted. E.g., - Pinned file: -1 119304647 119304647 - ATGC data: -1 119304647 119304647 Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index e81eb0748e2a..229814b4f4a6 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -101,11 +101,11 @@ static inline void sanity_check_seg_type(struct f2fs_sb_info *sbi, #define BLKS_PER_SEC(sbi) \ ((sbi)->segs_per_sec * (sbi)->blocks_per_seg) #define GET_SEC_FROM_SEG(sbi, segno) \ - ((segno) / (sbi)->segs_per_sec) + (((segno) == -1) ? -1: (segno) / (sbi)->segs_per_sec) #define GET_SEG_FROM_SEC(sbi, secno) \ ((secno) * (sbi)->segs_per_sec) #define GET_ZONE_FROM_SEC(sbi, secno) \ - ((secno) / (sbi)->secs_per_zone) + (((secno) == -1) ? -1: (secno) / (sbi)->secs_per_zone) #define GET_ZONE_FROM_SEG(sbi, segno) \ GET_ZONE_FROM_SEC(sbi, GET_SEC_FROM_SEG(sbi, segno)) -- 2.29.2.729.g45daf8777d-goog