Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5544361imd; Tue, 30 Oct 2018 20:41:41 -0700 (PDT) X-Google-Smtp-Source: AJdET5frNbeOvR+OvkRZW2c77MiS4l2+myUqOoZM0EX2Jxj1h9fe1iJGAqOC+s6fZwTowIwi5hhe X-Received: by 2002:a63:82c6:: with SMTP id w189mr1483374pgd.344.1540957301378; Tue, 30 Oct 2018 20:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540957301; cv=none; d=google.com; s=arc-20160816; b=I3sjEu7Wu2XhN8yNNIEKqEw0a1zCvtkJp/q4iu2XOblT1NbZNxFt1G1Oo00pPlMmiY O43JndATxHw3xGNtLwJL5c2JWalS+/mrGururFZVspi6vfRvewtXMzGQpwiNuhTsBLGB GnB7nguOisYm1hBb+Nr60atfWvXYeOplXnSL8P+pFgojh6yIY+gCpAvprY2duebrr/t4 PMLq41DbmG1tUavbqv2WXyXAwZ6l05roVSMEevMszyORB785Eaq7Z10kTnkkpK6dRe3K dO147uFmzlpUzdS6xd00C0KXb15x4EAQl5WaHjveP3CQXpWs4BJgZ9snotr4dRd7IO+s OjNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=zExTnQRsn/7RG/1oOqZjueHWZA5UmeSKfWuMpKducBs=; b=ulFM9gXUowF5kVO1tzTS3WoW50mCz/DDiwvPYZIF01XfdRFK47nXG2Wt3tKMz3wCqm r6a1TCykg+0Eb94UQbp+FXjxCZQFUjH/hyVfiSDRy7CqprcoHTVT5pPM/0IFbFCbLxfk /lNIezEzH7Imj1nbnEX5T30Bc2lFU6mg6ij9PpQFF69CCDu0RwrLjfovTGdBJ1YdJ8OG bLenAhRREZrj16R2eaqq8+XhFOO0T7s8WyrOTOtmUcIf6s0MaL47qfp92toSVvAsXppp 9gXigBK0AGTVEfGUoQN6Pki+raHrEqq37K3eY41A/R4ahN0uWHNdcom4M560Nafc6bLS d+fg== 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 h184-v6si28075169pfb.146.2018.10.30.20.41.26; Tue, 30 Oct 2018 20:41:41 -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 S1729089AbeJaMbS (ORCPT + 99 others); Wed, 31 Oct 2018 08:31:18 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14162 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728578AbeJaMbS (ORCPT ); Wed, 31 Oct 2018 08:31:18 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DB3B7B138A889; Wed, 31 Oct 2018 11:35:03 +0800 (CST) Received: from [127.0.0.1] (10.134.22.195) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Wed, 31 Oct 2018 11:34:56 +0800 Subject: Re: [PATCH v2] f2fs: fix get_blocktype_secs bug when segs_per_sec is larger than 1 To: Yunlong Song , , , CC: , , , , , References: <1540902495-60197-1-git-send-email-yunlong.song@huawei.com> <1540903593-65539-1-git-send-email-yunlong.song@huawei.com> From: Chao Yu Message-ID: <251de9ca-79b1-d509-13dc-87f80554a60d@huawei.com> Date: Wed, 31 Oct 2018 11:34:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1540903593-65539-1-git-send-email-yunlong.song@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/30 20:46, Yunlong Song wrote: > 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; roundup(segs, sbi->segs_per_sec)? Thanks, > } > > static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi) >