[PATCH 15/19] mkfs: don't treat files as though they are block devices
Jan Tulak
jtulak at redhat.com
Thu Apr 21 04:22:02 CDT 2016
On Wed, Apr 20, 2016 at 6:53 PM, Eric Sandeen <sandeen at sandeen.net> 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 at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>
--
Jan Tulak
jtulak at redhat.com / jan at tulak.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://oss.sgi.com/pipermail/xfs/attachments/20160421/32c156cc/attachment.html>
More information about the xfs
mailing list