Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1811896imm; Thu, 12 Jul 2018 08:12:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdA4EEO8tfuh2HXLwd3+z+kZkTDQhGpVfHNkNBbiwjlg2AdE5i+vD4fBZmw4ZS/9KE0Q2/q X-Received: by 2002:a65:620b:: with SMTP id d11-v6mr2502424pgv.429.1531408333023; Thu, 12 Jul 2018 08:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531408333; cv=none; d=google.com; s=arc-20160816; b=tuPQjeAMtGod1WmOWc1+SitDwSlu+h4eak7mtXrJv+y7cUKNS0pvDLM5AD2NQIEgXo AwigNAaPmLkQxXlYb+vegQVBhcorLNyVR9UpqPEwznsWO79KhOdVmAQ5Z2i5rfPfipw+ dSWkQv5oTizyBGo6L8g6REXi3KAXJDAQ1rmL5vZkNrMXwtPKinicoegI6xLq0Ywm8urz bJCVDBk0GktrqhkCkdrzYYY86dnmP4CjlNb1njKCrMrBKglGVFKNOUZKQ+N/gEHXvx6/ 96z+c/P+oGNgmo5K6xbngvAArltYcunisU1qoKtTc85zJhfPy/UkBcYMlQKoeRmuPVj2 LCSQ== 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:arc-authentication-results; bh=dTnFg8sErHNqOCeiVrtmDzFV+4DddLkff4iSFO0Nj5k=; b=yRe4uQGHg59Rw31s9nukgI1ttuEDUx1T+KHD6WN69+GZ+mGtdFGlVwhwoagtedFiel QbSkivdRE/IWUXCJa+RhTSi9LKNBCg4nDY0F7nMhEpoOeVxczPqnfcukP0PE4Qey07wn Tcqqlg+z1M6Ey3W4D+R+ifnDxurjGY3Dpsc3b+RZl344B8U172OG9qEqxi/GAo+735tE 3n5i6z+M+Mv3F58hvTT/0IdwZ4U7s6wSmrF/6wTOtlPPPlhlj+R5UVPoD0t4lRIibRJf O7zB+HkJtD1NkkxwDMM6vz8+kQVlY5Zwx1zNZbI2HKCahjvbEXZzZ7s1KVSKsjWGKgRp YGgw== 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 q61-v6si21960862plb.93.2018.07.12.08.11.45; Thu, 12 Jul 2018 08:12:12 -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 S1732751AbeGLPUq (ORCPT + 99 others); Thu, 12 Jul 2018 11:20:46 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:58001 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732744AbeGLPUq (ORCPT ); Thu, 12 Jul 2018 11:20:46 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A61DAA980310; Thu, 12 Jul 2018 23:10:39 +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.382.0; Thu, 12 Jul 2018 23:10:32 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH 4/5] f2fs: disable small discard in lfs mode Date: Thu, 12 Jul 2018 23:09:29 +0800 Message-ID: <1531408170-45758-5-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1531408170-45758-1-git-send-email-yunlong.song@huawei.com> References: <1531408170-45758-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 In lfs mode, it is better to send the discard of the overall section each time to avoid missing alignment with flash. Signed-off-by: Yunlong Song --- fs/f2fs/segment.c | 3 ++- fs/f2fs/sysfs.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index fd38b61..f6c20e0 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1766,7 +1766,8 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi) atomic_set(&dcc->issing_discard, 0); atomic_set(&dcc->discard_cmd_cnt, 0); dcc->nr_discards = 0; - dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg; + dcc->max_discards = test_opt(sbi, LFS) ? 0 : + MAIN_SEGS(sbi) << sbi->log_blocks_per_seg; dcc->undiscard_blks = 0; dcc->root = RB_ROOT; dcc->rbtree_check = false; diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 2e7e611..4b6c457 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -271,6 +271,10 @@ static ssize_t __sbi_store(struct f2fs_attr *a, return count; } + if (!strcmp(a->attr.name, "max_small_discards") && + test_opt(sbi, LFS)) + return -EINVAL; + *ui = t; if (!strcmp(a->attr.name, "iostat_enable") && *ui == 0) -- 1.8.5.2