Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4128704ybi; Tue, 11 Jun 2019 01:14:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvRjundV6aiGQUDOxW9ZYle5QtpOu5vrMfouwM8I0LkQyPoofABPKBFlbqfn0qWVuJowVy X-Received: by 2002:a17:90a:5884:: with SMTP id j4mr26646286pji.142.1560240856104; Tue, 11 Jun 2019 01:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560240856; cv=none; d=google.com; s=arc-20160816; b=EYRh6FleHVKCxBND1LKn7lwHwdf4ayc6zqWgkkVRXdEO2sLezaHzJmvvYST/mNGzoe nuawje+fhJvo4o2QMPBv0G+u5bRcNNG6JpAT41Ez6IGykd+YF7Lg0bhJyE+aHFwF8Tkq sTbFE3EDrklIoLeLWVLQF4iBl/BZM7mbxGxFDY5bQkxV4FXz8kx/+Yc9FRlA/o1JuUnW e+M53WsedaKiWsiw1+OTsKwiMk1Z0KxWObsGmozQXAanXzr9+rR/bjz3sOR9fvMpRPji Afs612r5gvc0FI72L0bN1jP4TG8sFZnjTb0Z1Cd5HQeTpi0yVm4XQojnUujwK93JtHa/ kfiw== 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=o2jfCEJesc93HtEpieuWYXYfehD/Tp/wLvyH6w3psCA=; b=ENy+VgNZ1v4I8cV55wSK8PSFvv0xVfLu3gZcTZ0copwtHbH2fFwJMElcvphRqQ5kUA 09i7S39kfGFTB9Uzegusj39XAa9M21J4je8WmjoEGJ9c3g0I/DgNFu11yb+Du4DANviD A2dV37yGkrqjGMMav8WlkZQO3hCWHLleDbosSsdKhSsWLU79wHVj/qus4XvcOoRMIbwd mj2BTmXQLQK9HOmqbPPagi6GT2rNYnIDFxG+iCkmClurqp8w1k9QpvLF9TGbLTyFfUEH 8Ww4Y5kuaLYcitsUUN+9FyFhBK/IS3d1rF+d8LkKyumwVxdMUroFmJZaf5V3lcVz4ux3 S5fA== 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 t4si8486962pgj.219.2019.06.11.01.14.00; Tue, 11 Jun 2019 01:14:16 -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 S2404624AbfFKILH (ORCPT + 99 others); Tue, 11 Jun 2019 04:11:07 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:18545 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404432AbfFKILH (ORCPT ); Tue, 11 Jun 2019 04:11:07 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 47CABB653578D8FD9F97; Tue, 11 Jun 2019 16:04:57 +0800 (CST) Received: from [10.134.22.195] (10.134.22.195) by smtp.huawei.com (10.3.19.208) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 11 Jun 2019 16:04:49 +0800 Subject: Re: [PATCH v8 1/1] f2fs: ioctl for removing a range from F2FS To: sunqiuyang , , , CC: References: <20190605033325.47628-1-sunqiuyang@huawei.com> From: Chao Yu Message-ID: Date: Tue, 11 Jun 2019 16:04:49 +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: <20190605033325.47628-1-sunqiuyang@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 2019/6/5 11:33, sunqiuyang wrote: > From: Qiuyang Sun > > This ioctl shrinks a given length (aligned to sections) from end of the > main area. Any cursegs and valid blocks will be moved out before > invalidating the range. > > This feature can be used for adjusting partition sizes online. > -- > Changlog v1 ==> v2: > > Sahitya Tummala: > - Add this ioctl for f2fs_compat_ioctl() as well. > - Fix debugfs status to reflect the online resize changes. > - Fix potential race between online resize path and allocate new data > block path or gc path. > > Others: > - Rename some identifiers. > - Add some error handling branches. > - Clear sbi->next_victim_seg[BG_GC/FG_GC] in shrinking range. > -- > Changelog v2 ==> v3: > Implement this interface as ext4's, and change the parameter from shrunk > bytes to new block count of F2FS. > -- > Changelog v3 ==> v4: > - During resizing, force to empty sit_journal and forbid adding new > entries to it, in order to avoid invalid segno in journal after resize. > - Reduce sbi->user_block_count before resize starts. > - Commit the updated superblock first, and then update in-memory metadata > only when the former succeeds. > - Target block count must align to sections. > -- > Changelog v4 ==> v5: > Write checkpoint before and after committing the new superblock, w/o > CP_FSCK_FLAG respectively, so that the FS can be fixed by fsck even if > resize fails after the new superblock is committed. > -- > Changelog v5 ==> v6: > - In free_segment_range(), reduce granularity of gc_mutex. > - Add protection on curseg migration. > -- > Changelog v6 ==> v7: > - Add freeze_bdev() and thaw_bdev() for resize fs. > - Remove CUR_MAIN_SECS and use MAIN_SECS directly for allocation. > - Recover super_block and FS metadata when resize fails. > -- > Changelog v7 ==> v8: > - No need to clear CP_FSCK_FLAG in update_ckpt_flags(). > - Clean up the sb and fs metadata update functions for resize_fs. > > Signed-off-by: Qiuyang Sun > Signed-off-by: Chao Yu > Signed-off-by: Sahitya Tummala Reviewed-by: Chao Yu Qiuyang, could you please add one f2fs individual testcase in fstest suit to do simple test with this ioctl. e.g. - mkfs & mount - fragment image - resizefs ioctl - check fs size via statfs - umount & fsck - maybe mount & check again Thanks,