Changeset 1196df6 in mainline for uspace/srv/fs/ext4fs


Ignore:
Timestamp:
2012-04-08T09:02:16Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6f413125
Parents:
3b5c119
Message:

extents: hotfix with writing to an existing empty file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext4fs/ext4fs_ops.c

    r3b5c119 r1196df6  
    10971097
    10981098        if (fblock == 0) {
    1099                 rc =  ext4_balloc_alloc_block(inode_ref, &fblock);
    1100                 if (rc != EOK) {
    1101                         ext4fs_node_put(fn);
    1102                         async_answer_0(callid, rc);
    1103                         return rc;
    1104                 }
    1105 
    1106                 rc = ext4_filesystem_set_inode_data_block_index(inode_ref, iblock, fblock);
    1107                 if (rc != EOK) {
    1108                         ext4_balloc_free_block(inode_ref, fblock);
    1109                         ext4fs_node_put(fn);
    1110                         async_answer_0(callid, rc);
    1111                         return rc;
    1112                 }
     1099
     1100                if (ext4_superblock_has_feature_incompatible(
     1101                                fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) &&
     1102                                (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
     1103
     1104                        uint32_t tmp_iblock = 0;
     1105                        do {
     1106                                rc = ext4_filesystem_append_inode_block(inode_ref, &fblock, &tmp_iblock);
     1107                                if (rc != EOK) {
     1108                                        ext4fs_node_put(fn);
     1109                                        async_answer_0(callid, rc);
     1110                                        return rc;
     1111                                }
     1112                        } while (tmp_iblock < iblock);
     1113
     1114                } else {
     1115                        rc =  ext4_balloc_alloc_block(inode_ref, &fblock);
     1116                        if (rc != EOK) {
     1117                                ext4fs_node_put(fn);
     1118                                async_answer_0(callid, rc);
     1119                                return rc;
     1120                        }
     1121
     1122                        rc = ext4_filesystem_set_inode_data_block_index(inode_ref, iblock, fblock);
     1123                        if (rc != EOK) {
     1124                                ext4_balloc_free_block(inode_ref, fblock);
     1125                                ext4fs_node_put(fn);
     1126                                async_answer_0(callid, rc);
     1127                                return rc;
     1128                        }
     1129                }
     1130
     1131                flags = BLOCK_FLAGS_NOREAD;
    11131132                inode_ref->dirty = true;
    1114 
    1115                 flags = BLOCK_FLAGS_NOREAD;
    11161133        }
    11171134
Note: See TracChangeset for help on using the changeset viewer.