Bug 203707 - [patch] make makefs(8) more compatible with geom_uncompress
Summary: [patch] make makefs(8) more compatible with geom_uncompress
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Enji Cooper
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-10-11 19:40 UTC by Eugene Grosbein
Modified: 2015-11-09 09:03 UTC (History)
5 users (show)

See Also:


Attachments
new option -r roundup (2.36 KB, patch)
2015-10-11 19:40 UTC, Eugene Grosbein
no flags Details | Diff
new option -r roundup (2.90 KB, patch)
2015-10-11 20:57 UTC, Eugene Grosbein
no flags Details | Diff
option -r replaced with -R (2.90 KB, patch)
2015-10-20 19:15 UTC, Eugene Grosbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein 2015-10-11 19:40:40 UTC
Created attachment 161924 [details]
new option -r roundup

While trying to run FreeBSD/mips on some device having very small flash media, one is forced to compress file system with mkulzma(8) utility. It is desirable to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8) and big compression block size like 65535 bytes to mkulzma at the same time. Then one obtains very good comression ratios (like 75% and more) but faces the following problem.

geom_uncompress kernel module reports GEOM provider size rounded up to its compression block size. Generally, this changes original media size and now it fails to match the size of embedded UFS file system that leads to other problems, f.e. geom_label kernel module does not like this and skips the file system while tasting the GEOM and looking for UFS label.

This makes it impossible to refer to the file system using known UFS label instead of something like /dev/map/rootfs.uncompress.

The following patch introduces new command line option "-r roundup" for makefs that makes it round up the image to specified block size. Hence, geom_uncompress does not change GEOM media size for images rounded that way and geom_label accepts such GEOMs just fine.

With the patch applied, one can use following commands:

makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs
mkulzma -s 65536 -o fs.img.ulzma fs.img
Comment 1 Eugene Grosbein 2015-10-11 20:57:21 UTC
Created attachment 161926 [details]
new option -r roundup

update patch with missing hunk
Comment 2 Sean Bruno freebsd_committer freebsd_triage 2015-10-11 22:42:49 UTC
I suspect this is correct.  I'll give a few days for Adrian/Marcel to comment, else I'll commit.
Comment 3 Adrian Chadd freebsd_committer freebsd_triage 2015-10-11 23:11:09 UTC
(In reply to Sean Bruno from comment #2)

I think it's fine. It's a shortcoming of "stuff", but it's fine for now.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-10-13 02:33:04 UTC
A commit references this bug:

Author: adrian
Date: Tue Oct 13 02:32:15 UTC 2015
New revision: 289203
URL: https://svnweb.freebsd.org/changeset/base/289203

Log:
  makefs: introduce a new option to specify what to round the resulting
  image up to.

  From ticket:

  While trying to run FreeBSD/mips on some device having very small flash media,
  one is forced to compress file system with mkulzma(8) utility. It is desirable
  to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
  and big compression block size like 65535 bytes to mkulzma at the same time.
  Then one obtains very good comression ratios (like 75% and more) but faces
  the following problem.

  geom_uncompress kernel module reports GEOM provider size rounded up to its
  compression block size. Generally, this changes original media size and now
  it fails to match the size of embedded UFS file system that leads to other
  problems, f.e. geom_label kernel module does not like this and skips the
  file system while tasting the GEOM and looking for UFS label.

  This makes it impossible to refer to the file system using known UFS label
  instead of something like /dev/map/rootfs.uncompress.

  The following patch introduces new command line option "-r roundup" for makefs
  that makes it round up the image to specified block size. Hence, geom_uncompress
  does not change GEOM media size for images rounded that way and geom_label
  accepts such GEOMs just fine.

  With the patch applied, one can use following commands:

  $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs
  $ mkulzma -s 65536 -o fs.img.ulzma fs.img

  PR:		bin/203707
  Submitted by:	<eugen@grosbein.net>

Changes:
  head/usr.sbin/makefs/ffs.c
  head/usr.sbin/makefs/makefs.8
  head/usr.sbin/makefs/makefs.c
  head/usr.sbin/makefs/makefs.h
Comment 5 Ed Maste freebsd_committer freebsd_triage 2015-10-20 19:09:53 UTC
Note that NetBSD's makefs already has -r assigned:
>-r When merging multiple directories replace duplicate files with the last found.
We should choose a different option for this flag
Comment 6 Eugene Grosbein 2015-10-20 19:15:19 UTC
Created attachment 162260 [details]
option -r replaced with -R

Mechanicaly change -r to -R.
Comment 7 Eugene Grosbein 2015-10-20 19:16:40 UTC
(In reply to Ed Maste from comment #5)

I've attached same patch with -r replaced to -R. Original patch should be rolled back before applying this one.
Comment 8 Ed Maste freebsd_committer freebsd_triage 2015-10-20 19:32:13 UTC
> I've attached same patch with -r replaced to -R. Original patch should
> be rolled back before applying this one.

Thank you. I've mentioned the conflicting makefs options on the NetBSD tech-userlevel list, with a hope that -D, -R, and -p will not be used for other purposes until we can sync makefs both ways.
Comment 9 Enji Cooper freebsd_committer freebsd_triage 2015-10-25 22:12:52 UTC
Bulk taking makefs bugs.
Comment 10 commit-hook freebsd_committer freebsd_triage 2015-10-30 05:56:23 UTC
A commit references this bug:

Author: ngie
Date: Fri Oct 30 05:55:57 UTC 2015
New revision: 290180
URL: https://svnweb.freebsd.org/changeset/base/290180

Log:
  Follow up to roundup feature addition in r289203

  - Rename -r to -R to avoid the clash with makefs -r in NetBSD
  - Note that -R is an FFS-specific option because it's not implemented
    in cd9660 today
  - Rename the roundup variable to "roundup-size" in the manpage and help
    text for consistency with other variables.
  - Bump .Dd (missed in r289203)

  PR: 203707
  MFC after: 1 week
  X-MFC with: r289203
  Differential Revision: https://reviews.freebsd.org/D3959
  Reviewed by: adrian (earlier patch), emaste
  Sponsored by: EMC / Isilon Storage Division

Changes:
  head/usr.sbin/makefs/makefs.8
  head/usr.sbin/makefs/makefs.c
Comment 11 commit-hook freebsd_committer freebsd_triage 2015-11-09 09:00:11 UTC
A commit references this bug:

Author: ngie
Date: Mon Nov  9 08:59:56 UTC 2015
New revision: 290589
URL: https://svnweb.freebsd.org/changeset/base/290589

Log:
  MFC r289203,r290180:

  r289203 (by adrian):

  makefs: introduce a new option to specify what to round the resulting
  image up to.

  From ticket:

  While trying to run FreeBSD/mips on some device having very small flash media,
  one is forced to compress file system with mkulzma(8) utility. It is desirable
  to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
  and big compression block size like 65535 bytes to mkulzma at the same time.
  Then one obtains very good comression ratios (like 75% and more) but faces
  the following problem.

  geom_uncompress kernel module reports GEOM provider size rounded up to its
  compression block size. Generally, this changes original media size and now
  it fails to match the size of embedded UFS file system that leads to other
  problems, f.e. geom_label kernel module does not like this and skips the
  file system while tasting the GEOM and looking for UFS label.

  This makes it impossible to refer to the file system using known UFS label
  instead of something like /dev/map/rootfs.uncompress.

  The following patch introduces new command line option "-r roundup" for makefs
  that makes it round up the image to specified block size. Hence, geom_uncompress
  does not change GEOM media size for images rounded that way and geom_label
  accepts such GEOMs just fine.

  With the patch applied, one can use following commands:

  $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs
  $ mkulzma -s 65536 -o fs.img.ulzma fs.img

  PR:		bin/203707
  Submitted by:	<eugen@grosbein.net>

  r290180:

  Follow up to roundup feature addition in r289203

  - Rename -r to -R to avoid the clash with makefs -r in NetBSD
  - Note that -R is an FFS-specific option because it's not implemented
    in cd9660 today
  - Rename the roundup variable to "roundup-size" in the manpage and help
    text for consistency with other variables.
  - Bump .Dd (missed in r289203)

  PR: 203707
  Differential Revision: https://reviews.freebsd.org/D3959
  Reviewed by: adrian (earlier patch), emaste
  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/10/
  stable/10/usr.sbin/makefs/ffs.c
  stable/10/usr.sbin/makefs/makefs.8
  stable/10/usr.sbin/makefs/makefs.c
  stable/10/usr.sbin/makefs/makefs.h
Comment 12 commit-hook freebsd_committer freebsd_triage 2015-11-09 09:00:13 UTC
A commit references this bug:

Author: ngie
Date: Mon Nov  9 08:59:56 UTC 2015
New revision: 290589
URL: https://svnweb.freebsd.org/changeset/base/290589

Log:
  MFC r289203,r290180:

  r289203 (by adrian):

  makefs: introduce a new option to specify what to round the resulting
  image up to.

  From ticket:

  While trying to run FreeBSD/mips on some device having very small flash media,
  one is forced to compress file system with mkulzma(8) utility. It is desirable
  to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
  and big compression block size like 65535 bytes to mkulzma at the same time.
  Then one obtains very good comression ratios (like 75% and more) but faces
  the following problem.

  geom_uncompress kernel module reports GEOM provider size rounded up to its
  compression block size. Generally, this changes original media size and now
  it fails to match the size of embedded UFS file system that leads to other
  problems, f.e. geom_label kernel module does not like this and skips the
  file system while tasting the GEOM and looking for UFS label.

  This makes it impossible to refer to the file system using known UFS label
  instead of something like /dev/map/rootfs.uncompress.

  The following patch introduces new command line option "-r roundup" for makefs
  that makes it round up the image to specified block size. Hence, geom_uncompress
  does not change GEOM media size for images rounded that way and geom_label
  accepts such GEOMs just fine.

  With the patch applied, one can use following commands:

  $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs
  $ mkulzma -s 65536 -o fs.img.ulzma fs.img

  PR:		bin/203707
  Submitted by:	<eugen@grosbein.net>

  r290180:

  Follow up to roundup feature addition in r289203

  - Rename -r to -R to avoid the clash with makefs -r in NetBSD
  - Note that -R is an FFS-specific option because it's not implemented
    in cd9660 today
  - Rename the roundup variable to "roundup-size" in the manpage and help
    text for consistency with other variables.
  - Bump .Dd (missed in r289203)

  PR: 203707
  Differential Revision: https://reviews.freebsd.org/D3959
  Reviewed by: adrian (earlier patch), emaste
  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/10/
  stable/10/usr.sbin/makefs/ffs.c
  stable/10/usr.sbin/makefs/makefs.8
  stable/10/usr.sbin/makefs/makefs.c
  stable/10/usr.sbin/makefs/makefs.h
Comment 13 commit-hook freebsd_committer freebsd_triage 2015-11-09 09:03:15 UTC
A commit references this bug:

Author: ngie
Date: Mon Nov  9 09:02:31 UTC 2015
New revision: 290590
URL: https://svnweb.freebsd.org/changeset/base/290590

Log:
  MFstable/10 r290589:

  MFC r289203,r290180:

  r289203 (by adrian):

  makefs: introduce a new option to specify what to round the resulting
  image up to.

  From ticket:

  While trying to run FreeBSD/mips on some device having very small flash media,
  one is forced to compress file system with mkulzma(8) utility. It is desirable
  to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
  and big compression block size like 65535 bytes to mkulzma at the same time.
  Then one obtains very good comression ratios (like 75% and more) but faces
  the following problem.

  geom_uncompress kernel module reports GEOM provider size rounded up to its
  compression block size. Generally, this changes original media size and now
  it fails to match the size of embedded UFS file system that leads to other
  problems, f.e. geom_label kernel module does not like this and skips the
  file system while tasting the GEOM and looking for UFS label.

  This makes it impossible to refer to the file system using known UFS label
  instead of something like /dev/map/rootfs.uncompress.

  The following patch introduces new command line option "-r roundup" for makefs
  that makes it round up the image to specified block size. Hence, geom_uncompress
  does not change GEOM media size for images rounded that way and geom_label
  accepts such GEOMs just fine.

  With the patch applied, one can use following commands:

  $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs
  $ mkulzma -s 65536 -o fs.img.ulzma fs.img

  PR:		bin/203707
  Submitted by:	<eugen@grosbein.net>

  r290180:

  Follow up to roundup feature addition in r289203

  - Rename -r to -R to avoid the clash with makefs -r in NetBSD
  - Note that -R is an FFS-specific option because it's not implemented
    in cd9660 today
  - Rename the roundup variable to "roundup-size" in the manpage and help
    text for consistency with other variables.
  - Bump .Dd (missed in r289203)

  PR: 203707
  Differential Revision: https://reviews.freebsd.org/D3959
  Reviewed by: adrian (earlier patch), emaste
  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/9/
_U  stable/9/usr.sbin/
_U  stable/9/usr.sbin/makefs/
  stable/9/usr.sbin/makefs/ffs.c
  stable/9/usr.sbin/makefs/makefs.8
  stable/9/usr.sbin/makefs/makefs.c
  stable/9/usr.sbin/makefs/makefs.h
Comment 14 commit-hook freebsd_committer freebsd_triage 2015-11-09 09:03:17 UTC
A commit references this bug:

Author: ngie
Date: Mon Nov  9 09:02:31 UTC 2015
New revision: 290590
URL: https://svnweb.freebsd.org/changeset/base/290590

Log:
  MFstable/10 r290589:

  MFC r289203,r290180:

  r289203 (by adrian):

  makefs: introduce a new option to specify what to round the resulting
  image up to.

  From ticket:

  While trying to run FreeBSD/mips on some device having very small flash media,
  one is forced to compress file system with mkulzma(8) utility. It is desirable
  to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
  and big compression block size like 65535 bytes to mkulzma at the same time.
  Then one obtains very good comression ratios (like 75% and more) but faces
  the following problem.

  geom_uncompress kernel module reports GEOM provider size rounded up to its
  compression block size. Generally, this changes original media size and now
  it fails to match the size of embedded UFS file system that leads to other
  problems, f.e. geom_label kernel module does not like this and skips the
  file system while tasting the GEOM and looking for UFS label.

  This makes it impossible to refer to the file system using known UFS label
  instead of something like /dev/map/rootfs.uncompress.

  The following patch introduces new command line option "-r roundup" for makefs
  that makes it round up the image to specified block size. Hence, geom_uncompress
  does not change GEOM media size for images rounded that way and geom_label
  accepts such GEOMs just fine.

  With the patch applied, one can use following commands:

  $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs
  $ mkulzma -s 65536 -o fs.img.ulzma fs.img

  PR:		bin/203707
  Submitted by:	<eugen@grosbein.net>

  r290180:

  Follow up to roundup feature addition in r289203

  - Rename -r to -R to avoid the clash with makefs -r in NetBSD
  - Note that -R is an FFS-specific option because it's not implemented
    in cd9660 today
  - Rename the roundup variable to "roundup-size" in the manpage and help
    text for consistency with other variables.
  - Bump .Dd (missed in r289203)

  PR: 203707
  Differential Revision: https://reviews.freebsd.org/D3959
  Reviewed by: adrian (earlier patch), emaste
  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/9/
_U  stable/9/usr.sbin/
_U  stable/9/usr.sbin/makefs/
  stable/9/usr.sbin/makefs/ffs.c
  stable/9/usr.sbin/makefs/makefs.8
  stable/9/usr.sbin/makefs/makefs.c
  stable/9/usr.sbin/makefs/makefs.h