Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CEABC433E6 for ; Wed, 24 Feb 2021 12:53:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D1D4264F5C; Wed, 24 Feb 2021 12:53:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1D4264F5C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1lEtf7-0002Jz-9c; Wed, 24 Feb 2021 12:53:05 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEtf6-0002Js-Bu for linux-f2fs-devel@lists.sourceforge.net; Wed, 24 Feb 2021 12:53:04 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hf3m5bmrjFNXNyzLVA4zVf+071b0OJY8HVKJHIyF7pQ=; b=BEU8sEHboZCuTjj+FILPWYfqW0 NE7sYuozd55HPV5DxxmrDAfP/VE5rmWNKtVAUDw4GETQcnmZwIF4MoT/YyXfoHB7LuHs1To9v/xHc ydJuBht3bg9/SUTn74d+Zm4BSiR3FnAHrJzGRhhCN49sg/qAVQN9AxeLNZ+esOxd4HSY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hf3m5bmrjFNXNyzLVA4zVf+071b0OJY8HVKJHIyF7pQ=; b=WJG2Ld06Jshq1bHA7n8ty/JUby tkX6n8ee81/AblFYm87t1YqPD9fl806bDroC+0rt1nj/VE9E/6513rs918nSMcOVgLyWZgEt6+oaY tPuM6C/iZTc29LmSJ3V5Jv41ZCieUKHtPdXrHu6BgrwOZEbx9183mvLL48oXyFSb7tGc=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lEtf4-003gRY-Ds for linux-f2fs-devel@lists.sourceforge.net; Wed, 24 Feb 2021 12:53:04 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D75664F56; Wed, 24 Feb 2021 12:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171176; bh=n5JcjEhi872PhCEaGoFNpYBHWSow5ZMF50i74ogSC3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oRAyip9bsEYxJmPE07Q/7A0dj+4Sqd3AGfE8Pb/TNDgahza5Da3jPibTTEJRwA+Qn LDoXdYgY8FYmvvzRqaXbr612RjX9J+SmkEYW830UuwHV4qmoTqhqqD4W5+zSalLvcz 3vKYcdXZGz8+6pT/Jtm0AH5wtdNv6f4essgf+Lvar4QTSi4GoWy1ihfQnh2UHj82S9 2uHquGn0o1zCwOdOQVRFLHpRwKO5MBJ9NsYImlkS36U3i4+vja6KqfvOb6N6y+vq/V LItn80U3z6/4dh6SXbF/5MfghzfA4Ah0Xd0kN9TFH20ZLiSXaOK3m91r2Pbqc5A6Vl wM4kAvB2iR40g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Wed, 24 Feb 2021 07:51:49 -0500 Message-Id: <20210224125212.482485-33-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125212.482485-1-sashal@kernel.org> References: <20210224125212.482485-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-Headers-End: 1lEtf4-003gRY-Ds Subject: [f2fs-dev] [PATCH AUTOSEL 5.10 33/56] f2fs: handle unallocated section and zone on pinned/atgc 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: Sasha Levin , Jaegeuk Kim , 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 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 e81eb0748e2a9..229814b4f4a6c 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.27.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel