From patchwork Fri Dec 22 03:41:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao Xiang X-Patchwork-Id: 10128745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 12E3B60390 for ; Fri, 22 Dec 2017 03:42:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00BDD29BE1 for ; Fri, 22 Dec 2017 03:42:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E95A729EBC; Fri, 22 Dec 2017 03:42:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74F7329BE1 for ; Fri, 22 Dec 2017 03:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755486AbdLVDmb convert rfc822-to-8bit (ORCPT ); Thu, 21 Dec 2017 22:42:31 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:2063 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755501AbdLVDm3 (ORCPT ); Thu, 21 Dec 2017 22:42:29 -0500 Received: from dggemi405-hub.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id BDE88C178B74; Fri, 22 Dec 2017 11:42:24 +0800 (CST) Received: from DGGEMI505-MBS.china.huawei.com ([169.254.2.37]) by dggemi405-hub.china.huawei.com ([10.3.17.143]) with mapi id 14.03.0361.001; Fri, 22 Dec 2017 11:41:55 +0800 From: "Gaoxiang (OS)" To: Jaegeuk Kim , "chao@kernel.org" , "Yuchao (T)" CC: "linux-f2fs-devel@lists.sourceforge.net" , "linux-fsdevel@vger.kernel.org" Subject: [f2fs-dev] [PATCH] resize.f2fs: fix max_nat_bitmap_size miscalculatation Thread-Topic: [f2fs-dev] [PATCH] resize.f2fs: fix max_nat_bitmap_size miscalculatation Thread-Index: AdN61pjVKAVCC7oNS9aGwlwPRBqv/g== Date: Fri, 22 Dec 2017 03:41:54 +0000 Message-ID: <9047C53C18267742AB12E43B65C7F9F70BCB8B7F@dggemi505-mbs.china.huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-imapappendstamp: dggemi307-cas.china.huawei.com (14.03.0336.000) x-originating-ip: [10.151.23.176] MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes max_nat_bitmap_size miscalculatation Signed-off-by: Gao Xiang --- fsck/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsck/resize.c b/fsck/resize.c index 6c3eeab..4f3844c 100644 --- a/fsck/resize.c +++ b/fsck/resize.c @@ -61,7 +61,7 @@ static int get_new_sb(struct f2fs_super_block *sb) * When sit is too large, we should expand cp area. It requires more pages for cp. */ if (max_sit_bitmap_size > - (CHECKSUM_OFFSET - sizeof(struct f2fs_checkpoint) + 65)) { + (CHECKSUM_OFFSET - sizeof(struct f2fs_checkpoint) + 1 - 64)) { max_nat_bitmap_size = CHECKSUM_OFFSET - sizeof(struct f2fs_checkpoint) + 1; set_sb(cp_payload, F2FS_BLK_ALIGN(max_sit_bitmap_size)); } else {