Bug 1058608

Summary: [RFE] btrfs-progs: btrfs resize doesn't support T/P/E suffix
Product: Red Hat Enterprise Linux 7 Reporter: Eryu Guan <eguan>
Component: kernelAssignee: Eric Sandeen <esandeen>
kernel sub component: Btrfs QA Contact: XuWang <xuw>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: eguan, esandeen, wangsl.fnst, xzhou
Version: 7.0Keywords: FutureFeature, Reopened
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-3.10.0-167.el7 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 11:39:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1113520    

Description Eryu Guan 2014-01-28 06:54:04 UTC
Description of problem:
Now btrfs filesystem resize <size> /mnt/btrfs doesn't support size with T/P/E suffix, only supports K/M/G.

For a file system that supports 16E fs size, the resize tool doesn't support T/P/E suffix is a bit weird.

I read the code and found that it's kernel dealing with the suffix by memparse() function in lib/cmdline.c, but still filing the RFE bug against btrfs-progs component, since I'm not sure which part we're going to update.

Version-Release number of selected component (if applicable):
btrfs-progs-3.12-3.el7

How reproducible:
always

Steps to Reproduce:
1. btrfs filesystem resize 1T /mnt/btrfs
2.
3.

Actual results:
# resize to 1T failed, EINVAL
[root@hp-dl388g8-01 ~]# btrfs fi re 1T /mnt/btrfs
Resize '/mnt/btrfs' of '1T'
ERROR: unable to resize '/mnt/btrfs' - Invalid argument

# resize to 1024G passed, this is the same as 1T
[root@hp-dl388g8-01 ~]# btrfs fi re 1024G /mnt/btrfs
Resize '/mnt/btrfs' of '1024G'
[root@hp-dl388g8-01 ~]#

Expected results:
resize supports T/P/E suffix

Additional info:

Comment 1 Wang Shilong 2014-03-22 07:26:26 UTC
ok, thanks for reporting, we will fix it.

Comment 3 Eric Sandeen 2014-06-11 18:20:43 UTC
I'll take this, odds are Ric isn't going to fix it ;)

However, it's not super-trivial to fix, and in fact requires something kernelside, due to the tortured, hacky implementation of the resize ioctl, which requires parsing strings from userspace in the kernel driver.

Today (as Eryu pointed out), that parsing is done by a function intended for RAM-scale numbers, so it only goes to gigabytes.

Comment 4 Eric Sandeen 2014-06-13 02:16:35 UTC
The patch has been sent to the btrfs & kernel lists:

    [PATCH v4] lib: add size unit t/p/e to memparse

and akpm has noticed, so I suppose it'll get merged soon.

Comment 5 RHEL Program Management 2014-06-13 02:46:27 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.

Comment 6 Eric Sandeen 2014-06-13 02:49:09 UTC
Hohum, I misfired on dev_ack.

Comment 7 Eric Sandeen 2014-07-03 15:32:40 UTC
FWIW, this is actually a kernel bug.

Comment 8 Eric Sandeen 2014-07-07 15:15:36 UTC
Note, the patch to fix this has still not made it upstream.

Comment 9 Eric Sandeen 2014-08-09 05:07:58 UTC
From e004f3c7780de32fa822f292ebadd985bcadb1e0 Mon Sep 17 00:00:00 2001
From: Gui Hecheng <guihc.fnst.com>
Date: Wed, 6 Aug 2014 16:09:29 -0700
Subject: lib/cmdline.c: add size unit t/p/e to memparse

For modern filesystems such as btrfs, t/p/e size level operations are
common.  add size unit t/p/e parsing to memparse

Signed-off-by: Gui Hecheng <guihc.fnst.com>
Acked-by: David Rientjes <rientjes>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru.com>
Signed-off-by: Andrew Morton <akpm>
Signed-off-by: Linus Torvalds <torvalds>

Comment 11 Jarod Wilson 2014-09-22 17:55:03 UTC
Patch(es) available on kernel-3.10.0-167.el7

Comment 14 XuWang 2014-12-08 07:56:58 UTC
run btrfs-progs regression test case "/btrfs-progs/Regression/bz1058608-resize-support-T_P_E" succesfully in RHEL-7.1-20141204.2 in following job:
https://beaker.engineering.redhat.com/jobs/821711.

Also run some regressions for RHEL7.1(man kernel versions, but one btrfs-progs version):
J:803063 	xfstests-btrfs: RHEL-7.1-20141113.0,s390x 
J:803061 	xfstests-btrfs: RHEL-7.1-20141113.0-ppc64
J:801031 	xfstests-btrfs: RHEL-7.1-20141111.0 
J:798051 	ltp-aiodio-btrfs: RHEL-LE-7.1-20141105.n.2
J:796795 	ltp-btrfs: RHEL-7.1-20141107.n.0, kernel-3.10.0-199.el7
Also I run some cases munually:
/kernel/filesystems/btrfs/degraded-mount-replace--panic for kernel reason
/kernel/filesystems/btrfs/profile-conversion--good
/kernel/filesystems/btrfs/online-resize--good
/kernel/filesystems/btrfs/regression--good
/kernel/filesystems/btrfs/mkfs--good
/kernel/filesystems/btrfs/mount--good
/kernel/filesystems/btrfs/clone--good
/kernel/filesystemd/btrfs/compress--good
/kernel/filesystem/btrfs/defragment--good
/kernel/filesystem/btrfs/online-device-add-delete-balance--good

So I think I can change this but status to verified.

Comment 16 errata-xmlrpc 2015-03-05 11:39:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0290.html