1254b44a | 28-Sep-2015 |
Benoît Thébaudeau <benoit@wsystem.com> |
fs/fat/fat_write: Fix management of empty files
Overwriting an empty file not created by U-Boot did not work, and it could even corrupt the FAT. Moreover, creating empty files or emptying existing f
fs/fat/fat_write: Fix management of empty files
Overwriting an empty file not created by U-Boot did not work, and it could even corrupt the FAT. Moreover, creating empty files or emptying existing files allocated a cluster, which is not standard.
Fix this by always keeping empty files clusterless as specified by Microsoft (the start cluster must be set to 0 in the directory entry in that case), and by supporting overwriting such files.
Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
show more ...
|
5e1a860e | 28-Sep-2015 |
Benoît Thébaudeau <benoit@wsystem.com> |
fs/fat/fat_write: Fix curclust/newclust mix-up
curclust was used instead of newclust in the debug() calls and in one CHECK_CLUST() call, which could skip a failure case.
Signed-off-by: Benoît Théba
fs/fat/fat_write: Fix curclust/newclust mix-up
curclust was used instead of newclust in the debug() calls and in one CHECK_CLUST() call, which could skip a failure case.
Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
show more ...
|
1d7f2ece | 28-Sep-2015 |
Benoît Thébaudeau <benoit@wsystem.com> |
fs/fat/fat_write: Merge calls to set_cluster()
set_contents() had uselessly split calls to set_cluster(). Merge these calls, which removes some cases of set_cluster() being called with a size of zer
fs/fat/fat_write: Merge calls to set_cluster()
set_contents() had uselessly split calls to set_cluster(). Merge these calls, which removes some cases of set_cluster() being called with a size of zero.
Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
show more ...
|
d56b2015 | 04-Sep-2015 |
Stephen Warren <swarren@nvidia.com> |
ext4: fix leak in check_filename()
root_first_block_buffer should be free()d in all cases, not just when an error occurs. Fix the success exit path of the function to do this.
Signed-off-by: Stephe
ext4: fix leak in check_filename()
root_first_block_buffer should be free()d in all cases, not just when an error occurs. Fix the success exit path of the function to do this.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
934b14f2 | 04-Sep-2015 |
Stephen Warren <swarren@nvidia.com> |
ext4: free allocations by parse_path()
parse_path() malloc()s the entries in the array it's passed. Those allocations must be free()d by the caller, ext4fs_get_parent_inode_num(). Add code to do thi
ext4: free allocations by parse_path()
parse_path() malloc()s the entries in the array it's passed. Those allocations must be free()d by the caller, ext4fs_get_parent_inode_num(). Add code to do this.
For this to work, all the array entries must be dynamically allocated, rather than a mix of dynamic and static allocations. Fix parse_path() not to over-write arr[0] with a pointer to statically allocated data.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
676505f5 | 04-Sep-2015 |
Stephen Warren <swarren@nvidia.com> |
ext4: avoid calling ext4fs_mount() twice, which leaks
ext4_write_file() is only called from the "fs" layer, which calls both ext4fs_mount() and ext4fs_close() before/after calling ext4_write_file().
ext4: avoid calling ext4fs_mount() twice, which leaks
ext4_write_file() is only called from the "fs" layer, which calls both ext4fs_mount() and ext4fs_close() before/after calling ext4_write_file(). Fix ext4_write_file() not to call ext4fs_mount() again, since the mount operation malloc()s some RAM which is leaked when a second mount call over-writes the pointer to that data, if no intervening close call is made.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
0a04ed86 | 03-Sep-2015 |
Łukasz Majewski <l.majewski@samsung.com> |
FIX: fat: Provide correct return code from disk_{read|write} to upper layers
It is very common that FAT code is using following pattern: if (disk_{read|write}() < 0) return -1;
Up till now
FIX: fat: Provide correct return code from disk_{read|write} to upper layers
It is very common that FAT code is using following pattern: if (disk_{read|write}() < 0) return -1;
Up till now the above code was dead, since disk_{read|write) could only return value >= 0. As a result some errors from medium layer (i.e. eMMC/SD) were not caught.
The above behavior was caused by block_{read|write|erase} declared at struct block_dev_desc (@part.h). It returns unsigned long, where 0 indicates error and > 0 indicates that medium operation was correct.
This patch as error regards 0 returned from block_{read|write|erase} when nr_blocks is grater than zero. Read/Write operation with nr_blocks=0 should return 0 and hence is not considered as an error.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Test HW: Odroid XU3 - Exynos 5433
show more ...
|
10d3ac34 | 30-Jun-2015 |
Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> |
JFFS2: Use merge sort when parsing filesystem
When building the file system the existing code does an insertion into a linked list. It attempts to speed this up by keeping a pointer to where the las
JFFS2: Use merge sort when parsing filesystem
When building the file system the existing code does an insertion into a linked list. It attempts to speed this up by keeping a pointer to where the last entry was inserted but it's still slow.
Now the nodes are just inserted into the list without searching through for the correct place. This unsorted list is then sorted once using mergesort after all the entries have been added to the list. This speeds up the scanning of the flash file system considerably.
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
show more ...
|
54a88384 | 30-Jun-2015 |
Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> |
JFFS2: Use CLEANMARKER to reduce scanning time
If a sector has a CLEANMARKER at the beginning, it indicates that the entire sector has been erased. Therefore, if this is found, we can skip the entir
JFFS2: Use CLEANMARKER to reduce scanning time
If a sector has a CLEANMARKER at the beginning, it indicates that the entire sector has been erased. Therefore, if this is found, we can skip the entire block. This was not being done before this patch.
The code now does the same as the kernel does when encountering a CLEANMARKER. It still checks that the next few words are FFFFFFFF, and if so, the block is assumed to be empty, and so is skipped.
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
show more ...
|
081adef7 | 30-Jun-2015 |
Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> |
JFFS2: Change scansize to match linux kernel
The scan code is similar to the linux kernel, but the kernel defines a much smaller size to scan through before deciding a sector is blank. Assuming that
JFFS2: Change scansize to match linux kernel
The scan code is similar to the linux kernel, but the kernel defines a much smaller size to scan through before deciding a sector is blank. Assuming that what is in the kernel is OK, make these two match.
On its own, this change makes no difference to scanning of any sectors which have a clean marker at the beginning, since the entire sector is not blank.
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
show more ...
|
2d6d93a2 | 30-Jun-2015 |
Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> |
JFFS2: Improve speed reading flash files
jffs2_1pass_read_inode() would read the entire data for each node in the filesystem, regardless of whether it was part of the file to be loaded or not. By on
JFFS2: Improve speed reading flash files
jffs2_1pass_read_inode() would read the entire data for each node in the filesystem, regardless of whether it was part of the file to be loaded or not. By only reading the header data for an inode, and then reading the data only when it is found to be part of the file to be loaded, much copying of data is saved.
jffs2_1pass_list_inodes() read each inode for every file in the directory into a buffer. By using NULL as a buffer pointer, NOR flash simply returns a pointer, and therefore avoids a memory copy.
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
show more ...
|
891224a5 | 30-Jun-2015 |
Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> |
JFFS2: Only list each directory entry once
If multiple versions of a file exist, only the most recent version should be used. The scheme to write 0 for the inode in older versions did not work, sinc
JFFS2: Only list each directory entry once
If multiple versions of a file exist, only the most recent version should be used. The scheme to write 0 for the inode in older versions did not work, since this would have required writing to flash.
The only time this caused an issue was listing a directory, where older versions of the file would still be seen. Since the directory entries are sorted, just look at the next entry in the list, and if it's the same move to that entry instead.
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
show more ...
|
225cf4cd | 30-Jun-2015 |
Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> |
JFFS2: Speed up and fix comparison functions
Copying complete nodes from flash can be slow if the flash is slow to read. By only reading the data needed, the sorting operation can be made much faste
JFFS2: Speed up and fix comparison functions
Copying complete nodes from flash can be slow if the flash is slow to read. By only reading the data needed, the sorting operation can be made much faster.
The directory entry comparison function also had a two bugs. First, it did not ensure the name was copied, so the name comparison may have been faulty (although it would have worked with NOR flash). Second, setting the ino to zero to ignore the entry did not work, since this was either writing to a temporary buffer, or (for NOR flash) directly to flash. Either way, the change was not remembered.
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
show more ...
|