Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Upstream e2fsprogs already have changes regarding discard. There is a change of mke2fs parameters to be consistent with discard/nodiscard mount options and also the change to inform user about the ongoing discard, so mke2fs does not look like it is stuck doing nothing.
Additional info:
This will require to backport upstream commits
commit 6fcd6f84c235f4bf2bd9770f172837da9982eb6e
Author: Eric Sandeen <sandeen>
Date: Fri Aug 20 16:41:14 2010 -0500
mke2fs: use lazy inode init on some discard-able devices
If a device supports discard -and- returns 0s for discarded blocks,
then we can skip the inode table initialization -and- the inode table
zeroing at mkfs time, and skip the lazy init as well since they are
already zeroed out.
Signed-off-by: Eric Sandeen <sandeen>
Signed-off-by: Theodore Ts'o <tytso>
commit 0bc85dfb384b470e6170268c8436fcbe58317cbe
Author: Lukas Czerner <lczerner>
Date: Thu Nov 18 14:38:39 2010 +0100
mke2fs: Deprecate -K option, introduce discard/nodiscard
It would be nice to have consistent "discard" options in every system
tool (mount, fsck, mkfs) taking advantage of discards. Also "discard"
and "nodiscard" is more descriptive instead of just "-K" and can be
easily defaulted and it is something we can not do with "-K".
With this commit you need to specify extended option like this:
./mke2fs -T <fstype> -E nodiscard <device>
in order make a filesystem without discarding the device first. And
./mke2fs -T <fstype> -E discard <device>
respectively.
-K option is with this commit deprecated and should not be used anymore.
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: "Theodore Ts'o" <tytso>
commit 7fe5ff3c1e06c4705a7a709a7ed34f02c5a02fd8
Author: Lukas Czerner <lczerner>
Date: Thu Nov 18 14:38:41 2010 +0100
mke2fs: Add discard option into mke2fs.conf
Allow to specify discard in mke2fs.conf. Also change the way how to
specify default value for lazy_itable_init. It is better to have all
this defaulting done in the same place so do it in definition (as we do
with discard).
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: "Theodore Ts'o" <tytso>
commit e90a59ed434d6c5e38dd148aa4ba5b22b8f7eb24
Author: Lukas Czerner <lczerner>
Date: Thu Nov 18 03:38:36 2010 +0000
e2fsprogs: Add discard function into struct_io_manager
In order to provide generic "discard" function for all e2fsprogs tools
add a discard function prototype into struct_io_manager. Specific
function for specific io managers can be crated that way.
This commit also creates unix_discard function which uses BLKDISCARD
ioctl to discard data blocks on the block device and bind it into
unit_io_manager structure to be available for all e2fsprogs tools.
Note that BLKDISCARD is still Linux specific ioctl, however other
unix systems may provide similar functionality. So far the
unix_discard() remains linux specific hence is embedded in #ifdef
__linux__ macro.
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: Theodore Ts'o <tytso>
commit d866599ab4955858b1541f0891b1b165ba66493a
Author: Lukas Czerner <lczerner>
Date: Thu Nov 18 03:38:37 2010 +0000
e2fsprogs: Add CHANNEL_FLAGS_DISCARD_ZEROES flag for io_manager
When the device have discard support and simultaneously discard zeroes
data (and it is properly advertised), then we can take advantage of such
behavior in several e2fsprogs tools.
Add new flag CHANNEL_FLAGS_DISCARD_ZEROES for struct_io_channel so
each io_manager can take advantage of this. The flag is properly set
according to BLKDISCARDZEROES ioctl in unix_open.
Also remove old mke2fs_discard_zeroes_data() function and substitute it
with helper which test this flag.
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: Theodore Ts'o <tytso>
commit efa1a355a1e4142b2d057be06931eb8fc0903ba3
Author: Lukas Czerner <lczerner>
Date: Thu Nov 18 03:38:38 2010 +0000
e2fsck: Discard free data and inode blocks.
In Pass 5 when we are checking block and inode bitmaps we have great
opportunity to discard free space and unused inodes on the device,
because bitmaps has just been verified as valid. This commit takes
advantage of this opportunity and discards both, all free space and
unused inodes.
I have added new set of options, 'nodiscard' and 'discard'. When the
underlying devices does not support discard, or discard ends with an
error, or when any kind of error occurs on the filesystem, no further
discard attempt will be made and the e2fsck will behave as it would
with nodiscard option provided.
As an addition, when there is any not-yet-zeroed inode table and
discard zeroes data, then inode table is marked as zeroed.
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: Theodore Ts'o <tytso>
commit 7361c08e5da18c8774ffda94931c500490d51846
Author: Lukas Czerner <lczerner>
Date: Thu Nov 18 03:38:40 2010 +0000
mke2fs: Use unix_discard() for discards
There is generic discard function in struct_io_manager, or in
unix_io_manager to be specific. So use this instead of
mke2fs_discard_blocks().
Since mke2fs_discard_blocks() is not used anymore (and should not be)
remove it.
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: Theodore Ts'o <tytso>
commit 855a77a19704ef7e0acd542cce19a6e8ee07582d
Author: Lukas Czerner <lczerner>
Date: Tue Feb 1 17:56:41 2011 +0100
mke2fs: Simple man page nodiscard option correction
It is not true that 'nodiscard' is set as default, so remove this
sentence. The default is 'discard' and it is properly documented in man
page.
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: Theodore Ts'o <tytso>
commit 7d9e31655fca48e9d6c2647ad443124113508b73
Author: Lukas Czerner <lczerner>
Date: Mon Jan 24 20:52:00 2011 +0100
mke2fs: Display progress report during the device discard
For some time now we are doing initial discard of the device prior to
filesystem creation. However, there is no feedback for the user and
hence on some devices with slow TRIM implementation it may appear that
mke2fs is stuck.
This commit introduce new function mke2fs_discard_device(), which is a
wrapper for io_channel_discard(). The discard is done in chunks of
2GB, which seems reasonably well for both slow and fast devices, and
discard progress is reported back to the user.
I gave up on doing fancy things like align discard according to
discard_alignment, checking for discard granularity and computing
estimate time. First of all, because it would require either new ioctl
to retrieve those information or use of libudev library, none of it
seems to be worth it. Regarding discard_granularity, I doubt there is
any sane device with discard granularity that big it would affect this.
Signed-off-by: Lukas Czerner <lczerner>
Signed-off-by: Theodore Ts'o <tytso>
commit aa07cb79b0a38d9d8407c5631624ef8534bdde3f
Author: Theodore Ts'o <tytso>
Date: Sun Feb 27 20:09:54 2011 -0500
mke2fs: If the device supports discard, don't print an error message
Check to see if the device supports discard before starting the
progress bar, and then printing an error about inappropriate ioctl for
device (when creating a file system image to a file, for example).
Also, add a function signature in the ext2_io.h header file for
io_channel_discard() and fix an extra, uneeded argument in mke2fs's
call to that function.
Signed-off-by: "Theodore Ts'o" <tytso>
commit 8185ab9f38f0e9cd06feab9d8e59d059bde84bf6
Author: Andreas Dilger <adilger>
Date: Tue Jun 7 10:22:29 2011 -0600
mke2fs: Don't erase flash device if "-n" is given
If "mke2fs -n" is used, there should be no changes to the underlying
device. Unfortunately, when the "discard" option was added in commit
c7cd908be59f48c66b4f3ac9a631ffe3dde4f1ab, it did not check for the "-n"
flag, and will discard all data on a flash device even if "-n" is given.
Check for the "noaction" flag before discarding any filesystem data.
Signed-off-by: Andreas Dilger <adilger>
Reviewed-by: Eric Sandeen <sandeen>
Signed-off-by: Theodore Ts'o <tytso>
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHBA-2011-1735.html
Description of problem: Upstream e2fsprogs already have changes regarding discard. There is a change of mke2fs parameters to be consistent with discard/nodiscard mount options and also the change to inform user about the ongoing discard, so mke2fs does not look like it is stuck doing nothing. Additional info: This will require to backport upstream commits commit 6fcd6f84c235f4bf2bd9770f172837da9982eb6e Author: Eric Sandeen <sandeen> Date: Fri Aug 20 16:41:14 2010 -0500 mke2fs: use lazy inode init on some discard-able devices If a device supports discard -and- returns 0s for discarded blocks, then we can skip the inode table initialization -and- the inode table zeroing at mkfs time, and skip the lazy init as well since they are already zeroed out. Signed-off-by: Eric Sandeen <sandeen> Signed-off-by: Theodore Ts'o <tytso> commit 0bc85dfb384b470e6170268c8436fcbe58317cbe Author: Lukas Czerner <lczerner> Date: Thu Nov 18 14:38:39 2010 +0100 mke2fs: Deprecate -K option, introduce discard/nodiscard It would be nice to have consistent "discard" options in every system tool (mount, fsck, mkfs) taking advantage of discards. Also "discard" and "nodiscard" is more descriptive instead of just "-K" and can be easily defaulted and it is something we can not do with "-K". With this commit you need to specify extended option like this: ./mke2fs -T <fstype> -E nodiscard <device> in order make a filesystem without discarding the device first. And ./mke2fs -T <fstype> -E discard <device> respectively. -K option is with this commit deprecated and should not be used anymore. Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: "Theodore Ts'o" <tytso> commit 7fe5ff3c1e06c4705a7a709a7ed34f02c5a02fd8 Author: Lukas Czerner <lczerner> Date: Thu Nov 18 14:38:41 2010 +0100 mke2fs: Add discard option into mke2fs.conf Allow to specify discard in mke2fs.conf. Also change the way how to specify default value for lazy_itable_init. It is better to have all this defaulting done in the same place so do it in definition (as we do with discard). Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: "Theodore Ts'o" <tytso> commit e90a59ed434d6c5e38dd148aa4ba5b22b8f7eb24 Author: Lukas Czerner <lczerner> Date: Thu Nov 18 03:38:36 2010 +0000 e2fsprogs: Add discard function into struct_io_manager In order to provide generic "discard" function for all e2fsprogs tools add a discard function prototype into struct_io_manager. Specific function for specific io managers can be crated that way. This commit also creates unix_discard function which uses BLKDISCARD ioctl to discard data blocks on the block device and bind it into unit_io_manager structure to be available for all e2fsprogs tools. Note that BLKDISCARD is still Linux specific ioctl, however other unix systems may provide similar functionality. So far the unix_discard() remains linux specific hence is embedded in #ifdef __linux__ macro. Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: Theodore Ts'o <tytso> commit d866599ab4955858b1541f0891b1b165ba66493a Author: Lukas Czerner <lczerner> Date: Thu Nov 18 03:38:37 2010 +0000 e2fsprogs: Add CHANNEL_FLAGS_DISCARD_ZEROES flag for io_manager When the device have discard support and simultaneously discard zeroes data (and it is properly advertised), then we can take advantage of such behavior in several e2fsprogs tools. Add new flag CHANNEL_FLAGS_DISCARD_ZEROES for struct_io_channel so each io_manager can take advantage of this. The flag is properly set according to BLKDISCARDZEROES ioctl in unix_open. Also remove old mke2fs_discard_zeroes_data() function and substitute it with helper which test this flag. Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: Theodore Ts'o <tytso> commit efa1a355a1e4142b2d057be06931eb8fc0903ba3 Author: Lukas Czerner <lczerner> Date: Thu Nov 18 03:38:38 2010 +0000 e2fsck: Discard free data and inode blocks. In Pass 5 when we are checking block and inode bitmaps we have great opportunity to discard free space and unused inodes on the device, because bitmaps has just been verified as valid. This commit takes advantage of this opportunity and discards both, all free space and unused inodes. I have added new set of options, 'nodiscard' and 'discard'. When the underlying devices does not support discard, or discard ends with an error, or when any kind of error occurs on the filesystem, no further discard attempt will be made and the e2fsck will behave as it would with nodiscard option provided. As an addition, when there is any not-yet-zeroed inode table and discard zeroes data, then inode table is marked as zeroed. Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: Theodore Ts'o <tytso> commit 7361c08e5da18c8774ffda94931c500490d51846 Author: Lukas Czerner <lczerner> Date: Thu Nov 18 03:38:40 2010 +0000 mke2fs: Use unix_discard() for discards There is generic discard function in struct_io_manager, or in unix_io_manager to be specific. So use this instead of mke2fs_discard_blocks(). Since mke2fs_discard_blocks() is not used anymore (and should not be) remove it. Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: Theodore Ts'o <tytso> commit 855a77a19704ef7e0acd542cce19a6e8ee07582d Author: Lukas Czerner <lczerner> Date: Tue Feb 1 17:56:41 2011 +0100 mke2fs: Simple man page nodiscard option correction It is not true that 'nodiscard' is set as default, so remove this sentence. The default is 'discard' and it is properly documented in man page. Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: Theodore Ts'o <tytso> commit 7d9e31655fca48e9d6c2647ad443124113508b73 Author: Lukas Czerner <lczerner> Date: Mon Jan 24 20:52:00 2011 +0100 mke2fs: Display progress report during the device discard For some time now we are doing initial discard of the device prior to filesystem creation. However, there is no feedback for the user and hence on some devices with slow TRIM implementation it may appear that mke2fs is stuck. This commit introduce new function mke2fs_discard_device(), which is a wrapper for io_channel_discard(). The discard is done in chunks of 2GB, which seems reasonably well for both slow and fast devices, and discard progress is reported back to the user. I gave up on doing fancy things like align discard according to discard_alignment, checking for discard granularity and computing estimate time. First of all, because it would require either new ioctl to retrieve those information or use of libudev library, none of it seems to be worth it. Regarding discard_granularity, I doubt there is any sane device with discard granularity that big it would affect this. Signed-off-by: Lukas Czerner <lczerner> Signed-off-by: Theodore Ts'o <tytso> commit aa07cb79b0a38d9d8407c5631624ef8534bdde3f Author: Theodore Ts'o <tytso> Date: Sun Feb 27 20:09:54 2011 -0500 mke2fs: If the device supports discard, don't print an error message Check to see if the device supports discard before starting the progress bar, and then printing an error about inappropriate ioctl for device (when creating a file system image to a file, for example). Also, add a function signature in the ext2_io.h header file for io_channel_discard() and fix an extra, uneeded argument in mke2fs's call to that function. Signed-off-by: "Theodore Ts'o" <tytso> commit 8185ab9f38f0e9cd06feab9d8e59d059bde84bf6 Author: Andreas Dilger <adilger> Date: Tue Jun 7 10:22:29 2011 -0600 mke2fs: Don't erase flash device if "-n" is given If "mke2fs -n" is used, there should be no changes to the underlying device. Unfortunately, when the "discard" option was added in commit c7cd908be59f48c66b4f3ac9a631ffe3dde4f1ab, it did not check for the "-n" flag, and will discard all data on a flash device even if "-n" is given. Check for the "noaction" flag before discarding any filesystem data. Signed-off-by: Andreas Dilger <adilger> Reviewed-by: Eric Sandeen <sandeen> Signed-off-by: Theodore Ts'o <tytso>