question about mkfs.xfs
Hi Eric,
Before commit 16adcb8 in xfsprogs-dev, only "sunit=0,swidth=0" is vaild and will convert
into the default stripe config as expected. After this commit, both "sunit=0,swidth=0"
and "sunit=0,swidth=64" will be forced to convert into the default stripe config.
If either of sunit and swidth is not 0, should we do a forced conversion? I am not sure if we should reject the combination(e.g. sunit=0,swidth=64).
Thanks,
Xiao Yang
Quoted 5 lines · Xiao Yang
Hi Eric,
Before commit 16adcb8 in xfsprogs-dev, only "sunit=0,swidth=0" is vaild and will convert
into the default stripe config as expected.
It behaved the same as the default, because it looked the same as "not set" to all the conditionals in mkfs.
Quoted 4 lines
After this commit, both
"sunit=0,swidth=0"
and "sunit=0,swidth=64" will be forced to convert into the default stripe config.
0,0 should be allowed, to force mkfs to ignore any stripe geometry reported by the device.
Quoted 2 lines
If either of sunit and swidth is not 0, should we do a forced conversion? I am not sure if we should reject the combination(e.g. sunit=0,swidth=64).
I am not sure what you mean by "forced conversion" - can you give specific examples?
However, a stripe unit of 0 with a non-zero stripe width should probably also be rejected, because it has no meaning. I think it was rejected before, and my commit accidentally allowed it again.
It probably needs another test added back in, to check for "both options were specified, but (only) one was zero."
Thanks,
-Eric
Quoted 3 lines
Thanks,
Xiao Yang
Quoted 26 lines · Eric Sandeen
Quoted 5 lines · Xiao Yang
Hi Eric,
Before commit 16adcb8 in xfsprogs-dev, only "sunit=0,swidth=0" is vaild and will convert
into the default stripe config as expected.It behaved the same as the default, because it looked the same as "not set" to all the conditionals in mkfs.
Quoted 4 lines
After this commit, both
"sunit=0,swidth=0"
and "sunit=0,swidth=64" will be forced to convert into the default stripe config.0,0 should be allowed, to force mkfs to ignore any stripe geometry reported by the device.
Quoted 2 lines
If either of sunit and swidth is not 0, should we do a forced conversion? I am not sure if we should reject the combination(e.g. sunit=0,swidth=64).
I am not sure what you mean by "forced conversion" - can you give specific examples?
Quoted 6 lines
However, a stripe unit of 0 with a non-zero stripe width should probably also be rejected, because it has no meaning. I think it was rejected before, and my commit accidentally allowed it again.
It probably needs another test added back in, to check for "both options were specified, but (only) one was zero."
Maybe like this:
mkfs.xfs: if either sunit or swidth is nonzero, the other must be as well
---
mkfs/xfs_mkfs.c +2 -1
@@ -2271,7 +2271,8 @@ _("data stripe width (%lld) is too large of a multiple of the data stripe unit ( dswidth = big_dswidth; } -if (dsunit && (!dswidth || (dswidth % dsunit !=0 ))) { +if ((dsunit && !dswidth) || (!dsunit && dswidth) || + (dsunit && (dswidth % dsunit !=0 ))) {fprintf (stderr,_ ("data stripe width (%d) must be a multiple of the data stripe unit (%d)\n" ), dswidth, dsunit);
which yields:
# mkfs.xfs -f -dsunit=0,swidth=64,file,name=fsfile,size=1g data stripe width (64) must be a multiple of the data stripe unit (0)
# mkfs.xfs -f -dsunit=64,swidth=0,file,name=fsfile,size=1g data stripe width (0) must be a multiple of the data stripe unit (64)
# mkfs.xfs -f -dsunit=64,swidth=7,file,name=fsfile,size=1g data stripe width (7) must be a multiple of the data stripe unit (64)
# mkfs.xfs -f -dsunit=0,swidth=0,file,name=fsfile,size=1g <success>
-Eric
Quoted 15 lines · Eric Sandeen
Quoted 14 lines · Eric Sandeen
Quoted 5 lines · Xiao Yang
Hi Eric,
Before commit 16adcb8 in xfsprogs-dev, only "sunit=0,swidth=0" is vaild and will convert
into the default stripe config as expected.It behaved the same as the default, because it looked the same as "not set" to all the conditionals in mkfs.
Quoted 4 lines
After this commit, both
"sunit=0,swidth=0"
and "sunit=0,swidth=64" will be forced to convert into the default stripe config.
Quoted 7 lines
Quoted 7 lines
0,0 should be allowed, to force mkfs to ignore any stripe geometry reported by the device.
Quoted 2 lines
If either of sunit and swidth is not 0, should we do a forced conversion? I am not sure if we should reject the combination(e.g. sunit=0,swidth=64).
I am not sure what you mean by "forced conversion" - can you give specific examples?
Hi Eric,
Sorry, i didn't describe it clearly.
I meant a stripe unit of 0 with a non-zero stripe width shouldn't behaved the same as "sunit=0,swidth=0.
Quoted 9 lines
Quoted 6 lines
However, a stripe unit of 0 with a non-zero stripe width should probably also be rejected, because it has no meaning. I think it was rejected before, and my commit accidentally allowed it again.
It probably needs another test added back in, to check for "both options were specified, but (only) one was zero."
Maybe like this:
mkfs.xfs: if either sunit or swidth is nonzero, the other must be as well
Thanks for your fix, and it looks good to me.
Thanks,
Xiao Yang
Quoted 38 lines
Signed-off-by Eric Sandeen<[email protected]>---
mkfs/xfs_mkfs.c +2
-1@@ -2271,7 +2271,8 @@ _("data stripe width (%lld) is too large of a multiple of the data stripe unit ( dswidth = big_dswidth; } -if (dsunit&& (!dswidth || (dswidth % dsunit !=0 ))) { +if ((dsunit&& !dswidth) || (!dsunit&& dswidth) || + (dsunit&& (dswidth % dsunit !=0 ))) {fprintf (stderr,_ ("data stripe width (%d) must be a multiple of the data stripe unit (%d)\n" ), dswidth, dsunit);which yields:
# mkfs.xfs -f -dsunit=0,swidth=64,file,name=fsfile,size=1g data stripe width (64) must be a multiple of the data stripe unit (0)# mkfs.xfs -f -dsunit=64,swidth=0,file,name=fsfile,size=1g data stripe width (0) must be a multiple of the data stripe unit (64)# mkfs.xfs -f -dsunit=64,swidth=7,file,name=fsfile,size=1g data stripe width (7) must be a multiple of the data stripe unit (64)# mkfs.xfs -f -dsunit=0,swidth=0,file,name=fsfile,size=1g <success>-Eric
.