ref: ab0173e089599dd60fdbe1da4fa9ed00e71ae54f
parent: 0c4612983ad9651b72390f4525f52234e5062a8f
author: gkostka <[email protected]>
date: Mon Oct 19 17:59:58 EDT 2015
Move allocation fail output condition to the end of the write loop
--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -1531,16 +1531,6 @@
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 @@
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*/