xfs
[Top] [All Lists]

mkfs: a possible bad

To: xfs@xxxxxxxxxxx
Subject: mkfs: a possible bad
From: Jan Tulak <jtulak@xxxxxxxxxx>
Date: Wed, 17 Jun 2015 10:28:38 -0400 (EDT)
Cc: Dave Chinner <david@xxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <919039035.15967379.1434550287476.JavaMail.zimbra@xxxxxxxxxx>
Thread-index: JJ+tUwcuiSIwZyfJO+iHYk2BBfeQ1A==
Thread-topic: mkfs: a possible bad
Hi,
I'm looking into mkfs/xfs_mkfs.c and I wonder, is "if (xi.dbsize > sectorsize)" 
correct?
It is a check for:
Warning: the data subvolume sector size %u is less than the sector size 
reported by the device (%u).

But psectorsize is assigned to sectorsize, not to xi.dbsize, so the two values 
seems to be swapped in the condition (and as arguments of the printf too).
I think this gone without noticing because usually, when creating a partition, 
the two values are the same. So even if the condition is wrong, nothing 
happens. 
And when -bsize=X is passed, then it is catched earlier and nothing happens 
again.

Only when I apply a patch that changes how mkfs acts when it gets a file 
instead of a block device, I start to see the warning, although physical sector 
size is 512 and block size is set to 4096. The numbers are swapped in the 
warning too...

I tried to run ./check -g quick and it seems that the change breaks nothing.

Cheers,
Jan

-- 
Jan Tulak
jtulak@xxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>