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

Jan Tulak
2016-04-21T12:43:45Z

[-- Attachment #1.1: Type: text/plain, Size: 1150 bytes --]

On Thu, Apr 21, 2016 at 11:39 AM, Jan Tulak <jtulak@redhat.com> wrote:

> From: Dave Chinner <dchinner@redhat.com>
>
> THIS PATCH HAS KNOWN ISSUES - it fails xfs/206 and xfs/216 tests, as it
> shrinks a file instead just not using it entirely, when -d size is used.
>

​So the shrinking is happening here:
3127 /*
3128 * If the data area is a file, then grow it out to its final
size
3129 * so that the reads for the end of the device in the mount code
3130 * will succeed.
3131 */
3132 if (xi.disfile && ftruncate64(xi.dfd, dblocks * blocksize) < 0)
{​

Before the patch, xi.disfile was 0 and so it didn't shrink the file to the
size of the new FS.
Now, what is the correct solve to this? Tests are written for the old
behaviour, but this shrinking seems to be an intentional thing.
It seems that the FS works ok even when this truncating is not applied, so
I think that I should remove this chunk (or change it to xi.dcreate=1
only), and keep the old behaviour.

What do you think about it, guys?

Cheers,
Jan

--
Jan Tulak
jtulak@redhat.com / jan@tulak.me

[-- Attachment #1.2: Type: text/html, Size: 3210 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]