Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979922pxb; Fri, 5 Mar 2021 04:40:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDz/tcn2WRh+7Nh9Wfy/I21ggNDteYUkLvfTUL1SRXK/UggWUnMZXB0hzuYYl3cG3+Jc4q X-Received: by 2002:aa7:cd8c:: with SMTP id x12mr9103973edv.355.1614948037212; Fri, 05 Mar 2021 04:40:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614948037; cv=none; d=google.com; s=arc-20160816; b=sFB42sNM0XEe4x6CQcGklHDtWkoBLfTIa9bk+fGca9+j6G9qwrc3HvVlAfs1sT7Vmd ENadZGVZ/IQlYNjzBV9TD8xAtDDuK85eKI3osOXKcCTPhbhIn9UOQF9/FsoiNbo5+kH5 3Q4kdTZETB1RwaKnhNWN2gHklEAcrPAwJrGjNHcN1Ca2nQUX7zNWxI852TxxrxrbAij/ SiAM5JHWumuuzElhbcJ0P/mqfPISCxXlRIQSEHLE88UtKdZPjpRLHmvj1FdCl0hNM0e8 jpQ6m8Of3vTkIEH4Ay3OCt+N25HxWUcPpjx4KiPpb6WH3MrJqkjSmrnKWtKM2KRBHtz+ HHKg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kOnJ7E1fEzSM/wwFLS20XwF9QcnLTHiivdhZA0d+OzI=; b=RWj6btEGlbfJv63OY7JGyZplfoH8Nfr3oxXp+BhnYGdkZ4MG3XTPhvgI8TyRVTCAh2 +ba2dlMKnF6HS3tCk0fRjpDH9//t8U93/CEDLyTjnmtCcjqRBpvgqpvDm3lbBmajx2dW CNMHSg8FsHtqDcb+TlsDh9+R3hQyN4jBJFu9ZGTfsgFNTXfJOjF9DMO6F7/Sqhc5Deq4 1MZdNQ+e8iSGTeQroIrtAizBKYXehS37ndJWo41acVEfzwIYHufr/N3+OcafcfdaZOm4 oMFBNKi6Nbg0UUzq8+heWAHh70ealFnriOeVjONhG2TspFIsZAdmNQiKJMFJJagpjuXR p7IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=stFnT5Vm; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a89si1601552ede.326.2021.03.05.04.40.14; Fri, 05 Mar 2021 04:40:37 -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=@linuxfoundation.org header.s=korg header.b=stFnT5Vm; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232463AbhCEMjT (ORCPT + 99 others); Fri, 5 Mar 2021 07:39:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:52180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233120AbhCEMij (ORCPT ); Fri, 5 Mar 2021 07:38:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 81CFE64FF0; Fri, 5 Mar 2021 12:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947919; bh=+V+HTcDCMoaRpk6wPrRYH6eJGGDKrbgfBuNSuZOh4WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stFnT5Vm4FEjnMjL0jrgPkWu5LRbgBEqemTMb2H5q/bCbd04Gr7NNVZgyn11obZhi RJGLWmoaSNWULLTEztS9Uh//rCsMWFGPTl91NI6wX+byuWc2/VMXWpd2EzXawbu1/L sFPGECzyyIlL68K7CtVa147VMZB3mToNeGDlSRMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.19 35/52] f2fs: handle unallocated section and zone on pinned/atgc Date: Fri, 5 Mar 2021 13:22:06 +0100 Message-Id: <20210305120855.383671900@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120853.659441428@linuxfoundation.org> References: <20210305120853.659441428@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jaegeuk Kim [ Upstream commit 632faca72938f9f63049e48a8c438913828ac7a9 ] If we have large section/zone, unallocated segment makes them corrupted. E.g., - Pinned file: -1 119304647 119304647 - ATGC data: -1 119304647 119304647 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- 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 9c2a55ad61bc..1f5db4cbc499 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -91,11 +91,11 @@ #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.30.1