From patchwork Tue Apr 11 00:13:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 9674367 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 DF0CA600CB for ; Tue, 11 Apr 2017 00:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDD6E223B2 for ; Tue, 11 Apr 2017 00:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F2226907; Tue, 11 Apr 2017 00:13:28 +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=unavailable 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 90711223B2 for ; Tue, 11 Apr 2017 00:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753153AbdDKANS (ORCPT ); Mon, 10 Apr 2017 20:13:18 -0400 Received: from mail.kernel.org ([198.145.29.136]:57622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbdDKANR (ORCPT ); Mon, 10 Apr 2017 20:13:17 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CED8201CE; Tue, 11 Apr 2017 00:13:16 +0000 (UTC) Received: from localhost (c-67-169-35-127.hsd1.ca.comcast.net [67.169.35.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 430E22014A; Tue, 11 Apr 2017 00:13:15 +0000 (UTC) From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 1/4] f2fs: use segment number for get_valid_blocks Date: Mon, 10 Apr 2017 17:13:05 -0700 Message-Id: <20170411001308.12881-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.11.0 X-Virus-Scanned: ClamAV using ClamSMTP 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 to submit a segment number for get_valid_blocks. Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index b8a1bac9355d..39ef9cc0093b 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -80,6 +80,8 @@ GET_SEGNO_FROM_SEG0(sbi, blk_addr))) #define GET_SECNO(sbi, segno) \ ((segno) / (sbi)->segs_per_sec) +#define GET_SEGNO_FROM_SECNO(sbi, secno) \ + ((secno) * (sbi)->segs_per_sec) #define GET_ZONENO_FROM_SEGNO(sbi, segno) \ (((segno) / (sbi)->segs_per_sec) / (sbi)->secs_per_zone) @@ -720,8 +722,8 @@ static inline block_t sum_blk_addr(struct f2fs_sb_info *sbi, int base, int type) static inline bool no_fggc_candidate(struct f2fs_sb_info *sbi, unsigned int secno) { - if (get_valid_blocks(sbi, secno, sbi->segs_per_sec) >= - sbi->fggc_threshold) + if (get_valid_blocks(sbi, GET_SEGNO_FROM_SECNO(sbi, secno), + sbi->segs_per_sec) >= sbi->fggc_threshold) return true; return false; }