25 Sep, 2014

1 commit


09 Aug, 2014

1 commit

  • These commands may be used to determine the size of a file without
    actually reading the whole file content into memory. This may be used
    to determine if the file will fit into the memory buffer that will
    contain it. In particular, the DFU code will use it for this purpose
    in the next commit.

    Signed-off-by: Stephen Warren

    Stephen Warren
     

19 Jun, 2014

1 commit

  • ext4fs_allocate_blocks() always allocates at least one block for a file.
    If the file size is zero, this causes total_remaining_blocks to
    underflow, which then causes an apparent hang while 2^32 blocks are
    allocated.

    To solve this, check that total_remaining_blocks is non-zero as part of
    the loop condition (i.e. before each loop) rather than at the end of
    the loop.

    Signed-off-by: Stephen Warren

    Stephen Warren
     

12 Jun, 2014

1 commit

  • Since ALLOC_CACHE_ALIGN_BUFFER declares a char* for filename
    sizeof(filename) is not the size of the buffer. Use the already
    known length instead.

    cc: Uma Shankar
    cc: Manjunatha C Achar
    cc: Marek Vasut
    Signed-off-by: Jeroen Hofstee
    Acked-by: Marek Vasut

    Jeroen Hofstee
     

13 May, 2014

2 commits

  • This bug shows up when file stored on the ext4 file system is updated.

    The ext4fs_delete_file() is responsible for deleting file's (e.g. uImage)
    data.
    However some global data (especially ext4fs_indir2_block), which is used
    during file deletion are left unchanged.

    The ext4fs_indir2_block pointer stores reference to old ext4 double
    indirect allocated blocks. When it is unchanged, after file deletion,
    ext4fs_write_file() uses the same pointer (since it is already initialized
    - i.e. not NULL) to return number of blocks to write. This trunks larger
    file when previous one was smaller.

    Lets consider following scenario:

    1. Flash target with ext4 formatted boot.img (which has uImage [*] on itself)
    2. Developer wants to upload their custom uImage [**]
    - When new uImage [**] is smaller than the [*] - everything works
    correctly - we are able to store the whole smaller file with corrupted
    ext4fs_indir2_block pointer
    - When new uImage [**] is larger than the [*] - theCRC is corrupted,
    since truncation on data stored at eMMC was done.
    3. When uImage CRC error appears, then reboot and LTHOR/DFU reflashing causes
    proper setting of ext4fs_indir2_block() and after that uImage[**]
    is successfully stored (correct uImage [*] metadata is stored at an
    eMMC on the first flashing).

    Due to above the bug was very difficult to reproduce.
    This patch sets default values for all ext4fs_indir* pointers/variables.

    Signed-off-by: Lukasz Majewski

    Łukasz Majewski
     
  • Code responsible for handling situation when ext4 has block size of 1024B
    can be ordered to take less space.

    This patch does that for ext4 common and write files.

    Signed-off-by: Lukasz Majewski

    Łukasz Majewski
     

26 Feb, 2014

1 commit


22 Feb, 2014

1 commit

  • In an ext4 filesystem, the inode corresponding to a file has a 60-byte
    area which contains an extent header structure and up to 4 extent
    structures (5 x 12 bytes).

    For files that need more than 4 extents to be represented (either files
    larger than 4 x 128MB = 512MB or smaller files but very fragmented),
    ext4 creates extent index structures. Each extent index points to a 4KB
    physical block where one extent header and additional 340 extents could
    be stored.

    The current u-boot ext4 code is very inefficient when it tries to load a
    file which has extent indexes. For each logical file block the code will
    read over and over again the same blocks of 4096 bytes from the disk.

    Since the extent tree in a file is always the same, we can cache the
    extent structures in memory before actually starting to read the file.

    This patch creates a simple linked list of structures holding information
    about all the extents used to represent a file. The list is sorted by
    the logical block number (ee_block) so that we can easily find the
    proper extent information for any file block.

    Without this patch, a 69MB file which had just one extent index pointing
    to a block with another 6 extents was read in approximately 3 minutes.
    With this patch applied the same file can be read in almost 20 seconds.

    Signed-off-by: Ionut Nicu

    Ionut Nicu
     

19 Feb, 2014

1 commit


20 Jan, 2014

4 commits

  • For files where we actually have extent indexes following
    an extent header (ext_block->eh_depth != 0), the do/while
    loop from ext4fs_get_extent_block() does not select the
    proper extent index structure.

    For example, if we have:

    ext_block->eh_depth = 1
    ext_block->eh_entries = 1
    fileblock = 0
    index[0].ei_block = 0

    the do/while loop will exit with i set to 0 and the
    ext4fs_get_extent_block() function will return 0, even if
    there was a valid extent index structure following the
    header.

    Signed-off-by: Ionut Nicu
    Signed-off-by: Mathias Rulf

    Ionut Nicu
     
  • Using fs->blksz in ext4fs_get_extent_block() is not
    correct since fs->blksz is not initialized on the
    read path. Use EXT2_BLOCK_SIZE() instead which will
    produce the desired output.

    Signed-off-by: Ionut Nicu
    Signed-off-by: Mathias Rulf

    Ionut Nicu
     
  • Curently, we are using 32 bit multiplication to calculate the offset,
    so the result will always be 32 bit.
    This can silently cause file system corruption when performing a write
    operation on partition larger than 4 GiB.

    This patch address the issue by simply promoting the terms to 64 bit,
    and let compilers decide how to do the multiplication efficiently.

    Signed-off-by: Ma Haijun

    Ma Haijun
     
  • It may cause file system corruption when do a write operation.
    This issue only affects boards that use 32 bit lbaint_t.

    Signed-off-by: Ma Haijun

    Ma Haijun
     

18 Nov, 2013

1 commit


01 Nov, 2013

1 commit


24 Jul, 2013

1 commit


22 Jul, 2013

1 commit

  • Fix reading ext4_extent_header struture on BE machines. Some 16 bit
    fields where converted to 32 bit fields, due to the byte swap on BE
    machines the containing value was corrupted. Therefore reading ext4
    filesystems on BE machines where broken before.

    Signed-off-by: Rommel Custodio
    [sent via git-send-email; rework commit message]
    Signed-off-by: Andreas Bießmann
    Reviewed-by: Simon Glass
    Tested-by: Simon Glass
    Tested-by: Lukasz Majewski

    Rommel Custodio
     

16 Jul, 2013

1 commit

  • With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
    which is required to represent block numbers for storage devices that
    exceed 2TiB (the block size usually is 512B), e.g. recent hard drives

    We now use lbaint_t for partition offset to reflect the lbaint_t change,
    and access partitions beyond or crossing the 2.1TiB limit.
    This required changes to signature of ext4fs_devread(), and type of all
    variables relatives to block sector.

    ext2/ext4 fs uses logical block represented by a 32 bit value. Logical
    block is a multiple of device block sector. To avoid overflow problem
    when calling ext4fs_devread(), we need to cast the sector parameter.

    Signed-off-by: Frédéric Leroy

    Frederic Leroy
     

24 May, 2013

1 commit

  • Commit 50ce4c0 "fs/ext4: Support device block sizes != 512 bytes"
    modified ext4fs_set_blk_dev() to calculate total_sect based on
    get_fs()->dev_desc->log2blksz rather than SECTOR_SIZE. However, this
    value wasn't yet assigned. Move the assignment earlier so the code
    doesn't crash or hang.

    Cc: Egbert Eich
    Tested-by: Tom Rini
    Signed-off-by: Stephen Warren

    Stephen Warren
     

10 May, 2013

1 commit


02 Apr, 2013

1 commit

  • 'bool' is defined in random places. This patch consolidates them into a
    single header file include/linux/types.h, using stdbool.h introduced in C99.

    All other #define, typedef and enum are removed. They are all consistent with
    true = 1, false = 0.

    Replace FALSE, False with false. Replace TRUE, True with true.
    Skip *.py, *.php, lib/* files.

    Signed-off-by: York Sun

    York Sun
     

05 Mar, 2013

2 commits


07 Dec, 2012

4 commits


30 Oct, 2012

1 commit

  • This makes the FAT and ext4 filesystem implementations build if
    CONFIG_FS_{FAT,EXT4} are defined, rather than basing the build on
    whether CONFIG_CMD_{FAT,EXT*} are defined. This will allow the
    filesystems to be built separately from the filesystem-specific commands
    that use them. This paves the way for the creation of filesystem-generic
    commands that used the filesystems, without requiring the filesystem-
    specific commands.

    Minor documentation changes are made for this change.

    The new config options are automatically selected by the old config
    options to retain backwards-compatibility.

    Signed-off-by: Stephen Warren
    Reviewed-by: Benoît Thébaudeau

    Stephen Warren
     

04 Oct, 2012

1 commit


26 Sep, 2012

2 commits


21 Sep, 2012

1 commit

  • DMA buffer cache invalidation requires that buffers have cache-aligned
    buffer locations and sizes. Use memalign() and ALLOC_CACHE_ALIGN_BUFFER()
    to ensure this.

    On Tegra at least, without this fix, the following fail commands fail in
    u-boot-master/ext4, but succeeded at the branch's branch point in
    u-boot/master. With this fix, the commands work again:

    ext2ls mmc 0:1 /
    ext2load mmc 0:1 /boot/zImage

    Cc: Uma Shankar
    Cc: Manjunatha C Achar
    Cc: Iqbal Shareef
    Cc: Hakgoo Lee
    Cc: Wolfgang Denk
    Cc: Tom Rini
    Signed-off-by: Stephen Warren

    Stephen Warren
     

10 Aug, 2012

2 commits