Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4667739imd; Tue, 30 Oct 2018 05:47:48 -0700 (PDT) X-Google-Smtp-Source: AJdET5cT9u8MU5bpoLK0u1KkIlmOd9HSs9k/UZiinKjb4MqOaZFXNpmZDoQjoua6/so6BNfUioQn X-Received: by 2002:a63:6781:: with SMTP id b123-v6mr18022950pgc.151.1540903668456; Tue, 30 Oct 2018 05:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540903668; cv=none; d=google.com; s=arc-20160816; b=hy9FBLAGly6qbEX65IUcYZ7bTZXMH7zEpv4Ade3x97z0nWvTKFP5JU3ETYlyhPgmOc SjP+ub5MfwZYt8AEW5wMuxgf3T37cvhjCQSR1exisb3m69Kk3HF+HRBmbLCvxzcVbqCK /lJPDXC41olJTChyJpLB+tkJI9YR6IhAsNOl3Dlsmq9gK/yrEtqh/G1JaWrvFQDhU1fa zs7Q6b4thiH/iuxQ82VQKa2EhPETfl9FMJ4837gfamnbNgXLAtaakjiiz0ZwBYWJxSyi 4Vbkmdhk5jxmR701hG3rogezVNw9luYdiHAqDJoxqKA2p38pcWk8X3Ga0brNG6t8z92K 4XdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=JdYTx3MiwH7N2u0U1MSj5sAC4+Q50EAiSZi6c9u3Plw=; b=DHAE4KQP3Rr4SlwWM/Yf+BoWXaG/MemGhCH21ds1xOtQ7KWeNIhYgAgI6Vsf++TQWO Vjblk0tVTZs6YEOv8psmfK6PMwW6Xa/R2o+/TxEHuWemnSNZMAhuLBkvrDdRNqOV35ud Sa/Z6/YqvfZk0yQXk12Pm/XkH8WT6qiZ5DYKljST9uOYT9aRtkDEafK5+lVn9xHgZFSP ULSiq8Q+6mzxpcRxcvK5IUhz/URaddr/4YHwhvrARfZySSS5F7MBH2pVEK1F5Y3PShaU 1O6s4990mD46cT85JGE5uJ5DUOJ8ofCniSu2r6kz33LK5bS13w1LbLaJpFBPkIEaczND pKZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8-v6si21905332plt.271.2018.10.30.05.47.31; Tue, 30 Oct 2018 05:47:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727818AbeJ3VkJ (ORCPT + 99 others); Tue, 30 Oct 2018 17:40:09 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:49633 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726108AbeJ3VkJ (ORCPT ); Tue, 30 Oct 2018 17:40:09 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id F38C4209C157C; Tue, 30 Oct 2018 20:46:47 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 30 Oct 2018 20:46:40 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH v2] f2fs: fix get_blocktype_secs bug when segs_per_sec is larger than 1 Date: Tue, 30 Oct 2018 20:46:33 +0800 Message-ID: <1540903593-65539-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1540902495-60197-1-git-send-email-yunlong.song@huawei.com> References: <1540902495-60197-1-git-send-email-yunlong.song@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.113.189.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org f2fs_need_SSR uses get_blocktype_secs to calculate needed dirty sections, however, for the case segs_per_sec > 1, when needed segs are smaller than segs_per_sec, it will just return 0, so fix it. Signed-off-by: Yunlong Song --- fs/f2fs/f2fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 56204a8..ef41ea2 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1842,7 +1842,7 @@ static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type) unsigned int segs = (get_pages(sbi, block_type) + pages_per_sec - 1) >> sbi->log_blocks_per_seg; - return segs / sbi->segs_per_sec; + return (segs + sbi->segs_per_sec - 1) / sbi->segs_per_sec; } static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi) -- 1.8.5.2