| 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: | Wed, 20 Apr 2016 11:51:06 +0200 |
| Cc: | xfs-oss <xfs@xxxxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <CACj3i722h=WVW-637__y6fi4EekAxxB=cwL8y+F1r1LFk-Z5rw@xxxxxxxxxxxxxx> |
| 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> |
â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... Diff of the change: @@ -999,7 +999,7 @@ static void get_topology( Â Â Â Â Â Â Â Â fd = open(dfile, flags, 0666); Â Â Â Â Â Â Â Â if (fd >= 0) { - Â Â Â Â Â Â Â Â Â Â Â platform_findsizes(dfile, fd, &dummy, &ft->lsectorsize); + Â Â Â Â Â Â Â Â Â Â Â platform_findsizes(dfile, fd, &xi->dsize, &ft->lsectorsize); Â Â Â Â Â Â Â Â Â Â Â Â close(fd); Â Â Â Â Â Â Â Â Â Â Â Â ft->psectorsize = ft->lsectorsize; Â Â Â Â Â Â Â Â } else @@ -2273,6 +2273,18 @@ _("Minimum block size for CRC enabled filesystems is %d bytes.\n"), Â Â Â Â memset(&ft, 0, sizeof(ft)); Â Â Â Â get_topology(&xi, &ft, force_overwrite); + Â Â Â /* + Â Â Â Â* If it is an existing file and we have no info about it + Â Â Â Â* like in case of "mkfs.xfs some-file", we need to save the size + Â Â Â Â* of the file to somewhere where it can be read later. + Â Â Â Â*/ + Â Â Â if (xi.disfile && !xi.dcreat && xi.dsize) { + Â Â Â Â Â Â Â long long num = xi.dsize * ft.lsectorsize; + Â Â Â Â Â Â Â int length = snprintf(NULL, 0,"%lld", num); + Â Â Â Â Â Â Â dsize = calloc( length + 1 ,sizeof(char)); + Â Â Â Â Â Â Â sprintf(dsize, "%lld", num); + Â Â Â } + Â Â Â Â if (!ssflag) { Â Â Â Â Â Â Â Â /* Â Â Â Â Â Â Â Â Â* Unless specified manually on the command line use the So, what do you think about this? Thanks, Jan |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [XFS] Any process to a particular XFS device hung in D state forever., Hugo Kuo |
|---|---|
| Next by Date: | Re: [XFS] Any process to a particular XFS device hung in D state forever., Brian Foster |
| Previous by Thread: | Re: [PATCH 15/19] mkfs: don't treat files as though they are block devices, Jan Tulak |
| Next by Thread: | Re: [PATCH 15/19] mkfs: don't treat files as though they are block devices, Jan Tulak |
| Indexes: | [Date] [Thread] [Top] [All Lists] |