Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4650822imd; Tue, 30 Oct 2018 05:32:01 -0700 (PDT) X-Google-Smtp-Source: AJdET5elDCnP/D33hhTXL3xB2oLjkYwClEqNbCjuvqNgMf7DpK35k21XsJmeuynH83EPa0wdE5C1 X-Received: by 2002:a63:8e43:: with SMTP id k64mr17723848pge.346.1540902721717; Tue, 30 Oct 2018 05:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540902721; cv=none; d=google.com; s=arc-20160816; b=IkQuydOne1+jyp5jDTFxSDR5GqcrBVUlv3+KioOX7gK44QDoZ6mMqfZaptVA41NoKE pN0Q1ACOJ877nZjqAYRBzsA8Wj4PbkqGgfNd6TC1gNJbM04V8ozGn3Nz2i2zzVg0S03U WdmD6KMXr7i791WbLgnP2ED/AFCYQfcTI3RgmD/SGBEXqUYBJNJDcsxsVuUyUxh/ot73 gM+jvR69ItnE2B8PcRNlHKBvJzzSXH3V6YOaoIe4+yzfME/r57NAcd4C+p18iQ3tfXgF TgfFeX35ZSLv3dj94ujvFMhrbK3sCPVzBkaVH0Fetw57J2woNYSkjf0f/uJMLQVH6KKd TLsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=XzXLhKd58U7sTVcslMt8E/TBmfFTksgJTeqSunkW3Rw=; b=0CsGm8GwhIZS8vly8x8y1CpPQPVRxjBO9Ykhm0MWtTvVBeaCVF1PleQ6sAQfWm9iVZ HmxkC5Xuo6YMwXausd9SFOqpKq8Fushgt5VCBRrc1e5YSNDLPcjuF8NTAkATeEVCsqnF v8mgWr5sLHV11CnPDXxZD8fu6iFPshNL5e8TyBnXv3+SkDLGCwcol0WDu42TffuVaaWr LbaFixhNPBPxUi2bdRlbMUE/092J2gWnQHBIF2m8czeoB6qKySNJv3iQ86I5FmKYbqFj C9qIkXQrBW3eS+kO/DSLUaFLXPP7XcCScGhJ/E4a7VxFQs8M7M8H07s03cq3/+IZlXxb ZysQ== 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 p15-v6si24730972pgr.336.2018.10.30.05.31.45; Tue, 30 Oct 2018 05:32:01 -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 S1727377AbeJ3VVt (ORCPT + 99 others); Tue, 30 Oct 2018 17:21:49 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:44039 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726761AbeJ3VVs (ORCPT ); Tue, 30 Oct 2018 17:21:48 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A4892BBE4DC84; Tue, 30 Oct 2018 20:28:29 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.408.0; Tue, 30 Oct 2018 20:28:22 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH] f2fs: fix get_blocktype_secs bug when segs_per_sec is larger than 1 Date: Tue, 30 Oct 2018 20:28:15 +0800 Message-ID: <1540902495-60197-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 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..d47417b 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 + 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