diff options
| author | gkostka <kostka.grzegorz@gmail.com> | 2015-10-19 21:59:58 +0200 |
|---|---|---|
| committer | gkostka <kostka.grzegorz@gmail.com> | 2015-10-20 09:52:04 +0200 |
| commit | ab0173e089599dd60fdbe1da4fa9ed00e71ae54f (patch) | |
| tree | d511a1740b5f4c48879cc814f953afd5d4a1a0ed | |
| parent | 0c4612983ad9651b72390f4525f52234e5062a8f (diff) | |
Move allocation fail output condition to the end of the write loop
| -rw-r--r-- | lwext4/ext4.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lwext4/ext4.c b/lwext4/ext4.c index 531649d..8283657 100644 --- a/lwext4/ext4.c +++ b/lwext4/ext4.c @@ -1531,16 +1531,6 @@ int ext4_fwrite(ext4_file *f, const void *buf, size_t size, size_t *wcnt) fblock_count++; } - if (rr != EOK) { - if (fblock_count == 1) { - /*ext4_fs_append_inode_block has failed and no - * more blocks shold be written. But node size - * should be updated.*/ - r = rr; - goto out_fsize; - } - } - r = ext4_blocks_set_direct(f->mp->fs.bdev, u8_buf, fblock_start, fblock_count); if (r != EOK) @@ -1555,6 +1545,14 @@ int ext4_fwrite(ext4_file *f, const void *buf, size_t size, size_t *wcnt) fblock_start = fblock; fblock_count = 1; + + if (rr != EOK) { + /*ext4_fs_append_inode_block has failed and no + * more blocks might be written. But node size + * should be updated.*/ + r = rr; + goto out_fsize; + } } /*Stop write back cache mode*/ |
