| b4976b49 | 17-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Revert rejection of 64bit enabled ext4 fs
Enable mounting of ext4 fs with 64bit feature, as it is supported now. These had been disabled in 6f94ab6656ceffb3f2a972c8de4c554502b6f2b7.
Signed-of
ext4: Revert rejection of 64bit enabled ext4 fs
Enable mounting of ext4 fs with 64bit feature, as it is supported now. These had been disabled in 6f94ab6656ceffb3f2a972c8de4c554502b6f2b7.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| 688d0e79 | 17-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Use helper function to access group descriptor and its fields
The descriptor size is variable, thus array indices are not generically applicable. The larger group descriptors also contain e.g.
ext4: Use helper function to access group descriptor and its fields
The descriptor size is variable, thus array indices are not generically applicable. The larger group descriptors also contain e.g. high parts of block numbers, which have to be read and written.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| f798b1dd | 17-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Use correct descriptor size when reading the block group descriptor
The correct descriptor size must be used when calculating offsets, and also to read the correct amount of data.
Signed-off-
ext4: Use correct descriptor size when reading the block group descriptor
The correct descriptor size must be used when calculating offsets, and also to read the correct amount of data.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| 9f5dd8b6 | 19-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Add helper functions for block group descriptor field access
The helper functions encapsulate access of the block group descriptors, independent of group descriptor size. The helpers also deal
ext4: Add helper functions for block group descriptor field access
The helper functions encapsulate access of the block group descriptors, independent of group descriptor size. The helpers also deal with the endianess of the fields, and with split fields like free_blocks/ free_blocks_high.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| fc214ef9 | 17-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: determine group descriptor size for 64bit feature
If EXT4_FEATURE_INCOMPAT_64BIT is set, the descriptor can be read from the superblocks, otherwise it defaults to 32.
Signed-off-by: Stefan Br
ext4: determine group descriptor size for 64bit feature
If EXT4_FEATURE_INCOMPAT_64BIT is set, the descriptor can be read from the superblocks, otherwise it defaults to 32.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| b1edcf0d | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Fix memory leak of journal buffer if block is updated multiple times
If the same block is updated multiple times in a row during a single file system operation, gd_index is decremented to use
ext4: Fix memory leak of journal buffer if block is updated multiple times
If the same block is updated multiple times in a row during a single file system operation, gd_index is decremented to use the same journal entry again. Avoid loosing the already allocated buffer.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| de9e8316 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Correct block number handling, empty block vs. error code
read_allocated block may return block number 0, which is just an indicator a chunk of the file is not backed by a block, i.e. it is sp
ext4: Correct block number handling, empty block vs. error code
read_allocated block may return block number 0, which is just an indicator a chunk of the file is not backed by a block, i.e. it is sparse.
During file deletions, just continue with the next logical block, for other operations treat blocknumber <= 0 as an error.
For writes, blocknumber 0 should never happen, as U-Boot always allocates blocks for the whole file. Reading already handles this correctly, i.e. the read buffer is 0-fillled.
Not treating block 0 as sparse block leads to FS corruption, e.g. ./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ; ext4write host 0 0 /2.5GB.file 1 ' The 2.5GB.file from the fs test is actually a sparse file.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| b779e029 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: remove duplicated block release code for extents
The data blocks are identical for files using traditional direct/indirect block allocation scheme and extent trees, thus this code part can be
ext4: remove duplicated block release code for extents
The data blocks are identical for files using traditional direct/indirect block allocation scheme and extent trees, thus this code part can be common. Only the code to deallocate the indirect blocks to record the used blocks has to be seperate, respectively the code to release extent tree index blocks.
Actually the code to release the extent tree index blocks is still missing, but at least add a FIXME at the appropriate place.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| 87f9fdc0 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: initialize full inode for inodes bigger than 128 bytes
Make sure the the extra_isize field (offset 128) is initialized to 0, to mark any extra data as invalid.
Signed-off-by: Stefan Brüns <st
ext4: initialize full inode for inodes bigger than 128 bytes
Make sure the the extra_isize field (offset 128) is initialized to 0, to mark any extra data as invalid.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| 290ce2f9 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Use correct value for inode size even on revision 0 filesystems
fs->inodesz is already correctly (i.e. dependent on fs revision) initialized in ext4fs_mount.
Signed-off-by: Stefan Brüns <stef
ext4: Use correct value for inode size even on revision 0 filesystems
fs->inodesz is already correctly (i.e. dependent on fs revision) initialized in ext4fs_mount.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| 87a40b6e | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Fix memory leak in case of failure
temp_ptr should always be freed, even if the function is left via goto fail.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz
ext4: Fix memory leak in case of failure
temp_ptr should always be freed, even if the function is left via goto fail.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| 0ceef3d3 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Avoid out-of-bounds access of block bitmap
If the blocksize is 1024, count is initialized with 1. Incrementing count by 8 will never match (count == fs->blksz * 8), and ptr may be incremented
ext4: Avoid out-of-bounds access of block bitmap
If the blocksize is 1024, count is initialized with 1. Incrementing count by 8 will never match (count == fs->blksz * 8), and ptr may be incremented beyond the buffer end if the bitmap is filled. Add the startblock offset after the loop.
Remove the second loop, as only the first iteration will be done.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| a9fa0ed1 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: After completely filled group, scan next group from the beginning
The last free block of a block group may be in its middle. After it has been allocated, the next block group should be scanned
ext4: After completely filled group, scan next group from the beginning
The last free block of a block group may be in its middle. After it has been allocated, the next block group should be scanned from its beginning.
The following command triggers the bad behaviour (on a blocksize 1024 fs):
./sandbox/u-boot -c 'i=0; host bind 0 ./disk.raw ; while test $i -lt 260 ; do echo $i; setexpr i $i + 1; ext4write host 0:2 0 /X${i} 0x1450; done ; ext4write host 0:2 0 /X240 0x2000 ; '
When 'X240' is extended from 5200 byte to 8192 byte, the new blocks should start from the first free block (8811), but it uses the blocks 8098-8103 and 16296-16297 -- 8103 + 1 + 8192 = 16296. This can be shown with debugfs, commands 'ffb' and 'stat X240'.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| e9272652 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Do not clear zalloc'ed buffers a second time
zero_buffer is never written, thus clearing it is pointless. journal_buffer is completely initialized by ext4fs_devread (or in case of failure, not
ext4: Do not clear zalloc'ed buffers a second time
zero_buffer is never written, thus clearing it is pointless. journal_buffer is completely initialized by ext4fs_devread (or in case of failure, not used).
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| 398d6fad | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Only update number of of unused inodes if GDT_CSUM feature is set
e2fsck warns about "Group descriptor 0 marked uninitialized without feature set." The bg_itable_unused field is only defined i
ext4: Only update number of of unused inodes if GDT_CSUM feature is set
e2fsck warns about "Group descriptor 0 marked uninitialized without feature set." The bg_itable_unused field is only defined if FEATURE_RO_COMPAT_GDT_CSUM is set, and should be set (kept) zero otherwise.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| b7dd40d0 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Scan all directory blocks when looking up an entry
Scanning only the direct blocks of the directory file may falsely report an existing file as nonexisting, and worse can also lead to creation
ext4: Scan all directory blocks when looking up an entry
Scanning only the direct blocks of the directory file may falsely report an existing file as nonexisting, and worse can also lead to creation of a duplicate entry on file creation.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| 10a7a1b8 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Avoid corruption of directories with hash tree indexes
While directories can be read using the old linear scan method, adding a new file would require updating the index tree (alternatively, t
ext4: Avoid corruption of directories with hash tree indexes
While directories can be read using the old linear scan method, adding a new file would require updating the index tree (alternatively, the whole tree could be removed).
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| a321abd5 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Scan all directory blocks for space when inserting a new entry
Previously, only the last directory block was scanned for available space. Instead, scan all blocks back to front, and if no suff
ext4: Scan all directory blocks for space when inserting a new entry
Previously, only the last directory block was scanned for available space. Instead, scan all blocks back to front, and if no sufficient space is found, eventually append a new block. Blocks are only appended if the directory does not use extents or the new block would require insertion of indirect blocks, as the old code does.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| b96c3c72 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: Do not crash when trying to grow a directory using extents
The following command crashes u-boot: ./sandbox/u-boot -c 'i=0; host bind 0 ./sandbox/test/fs/3GB.ext4.img ; while test $i -lt 200
ext4: Do not crash when trying to grow a directory using extents
The following command crashes u-boot: ./sandbox/u-boot -c 'i=0; host bind 0 ./sandbox/test/fs/3GB.ext4.img ; while test $i -lt 200 ; do echo $i; setexpr i $i + 1; ext4write host 0 0 /foobar${i} 0; done'
Previously, the code updated the direct_block even for extents, and fortunately crashed before pushing garbage to the disk.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
| a0d767e2 | 06-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
ext4: propagate error if creation of directory entry fails
In case the dir entry creation failed, ext4fs_write would later overwrite a random inode, as inodeno was never initialized.
Signed-off-by:
ext4: propagate error if creation of directory entry fails
In case the dir entry creation failed, ext4fs_write would later overwrite a random inode, as inodeno was never initialized.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|