Re: [PATCH 15/19] mkfs: don't treat files as though they are block devices

Eric Sandeen
2016-04-20T16:53:25Z

On 4/20/16 9:17 AM, Jan Tulak wrote:
> ​I'm taking it back, one tests fails, most likely it happened when I
> removed patch 17 - xfsprogs: disable truncating of files. If I do
> "mkfs.xfs $file", it doesn't know the old size to recreate it. I'm
> working on a change for this patch to fix this issue, but I'm not
> entirely certain how to proceed. The right place to get the size
> seems to be get_topology(). I could save it into xi.dsize, but then
> libxfs_init() zeroes it.
>
> So I think that I might rather convert the measured size do char
> *dsize and pretend that it is an user-given value. But this looks to
> me more like a hack. On the other side, any other way would require
> further changes in the code to convert the char* to int as soon as
> possible - which does not belong to this patch...
...

> So, what do you think about this?
>
> ​ And before anyone will reply, I found that putting a
> platform_findsizes​ into libxfs_init will fix it too. Which is nice,
> especially because for block devices, the findsizes is already used
> there. So ignore the previous hack. :-)

Huh - if I take your original patchset and simply remove patch 17,
I don't get any problems with "mkfs.xfs file" for an existing file,
it seems to work fine here. So it might be something else...

-Eric