xfs
[Top] [All Lists]

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

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 15/19] mkfs: don't treat files as though they are block devices
From: Jan Tulak <jtulak@xxxxxxxxxx>
Date: Thu, 21 Apr 2016 11:22:02 +0200
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <5717B3F7.2030904@xxxxxxxxxxx>
References: <1458818136-56043-1-git-send-email-jtulak@xxxxxxxxxx> <1458818136-56043-16-git-send-email-jtulak@xxxxxxxxxx> <5706FA7C.7020103@xxxxxxxxxxx> <CACj3i73JEzCj-4kp3=H9mjXCKYgcOUYCOyq-aZSWZFXUih+0MA@xxxxxxxxxxxxxx> <CACj3i722h=WVW-637__y6fi4EekAxxB=cwL8y+F1r1LFk-Z5rw@xxxxxxxxxxxxxx> <CACj3i71Ff2KS682DRP8zG76ee6rhz3X-NZKst1qsruMZKWaHJA@xxxxxxxxxxxxxx> <CACj3i73jk5HjRuRRF7hnX0WoOv0amq-CduAwoHbhoT-=+hTREA@xxxxxxxxxxxxxx> <5717B3F7.2030904@xxxxxxxxxxx>
On Wed, Apr 20, 2016 at 6:53 PM, Eric Sandeen <sandeen@xxxxxxxxxxx> wrote:
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,
âand revert this patch to the Dave's version.
â
Â
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...

âI bisected it and the issue was really caused by this patch in Dave's version. But luckily, the fix is as simple as:

@@ -278,6 +278,8 @@ libxfs_init(libxfs_init_t *a)
            a->ddev= libxfs_device_open(dname, a->dcreat, flags,
                          a->setblksize);
            a->dfd = libxfs_device_to_fd(a->ddev);
+ Â Â Â Â Â Â Â Â Â Â Â platform_findsizes(dname, a->dfd, &a->dsize,
+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &a->dbsize);
        } else {
            if (!check_open(dname, flags, &rawfile, &blockfile))
                goto done;â

â(and dtto for log/rt variants).â

I'm going to send for review what I have, and work on the remaining issues in the meantime.Â

Unless I find something else, the last thing to fix is that it changes the size of the file on -d size=xxx, even when O_TRUNCATE is not used (that is, no -d file is specified). Old behaviour was to keep the file size and just don't use the entire file. This affects xfs/206 and xfs/216.

Jan
Â

-Eric

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



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