Changeset 840e227 in mainline
- Timestamp:
- 2012-06-03T15:08:33Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 85a4350
- Parents:
- ca47f656
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_filesystem.c
rca47f656 r840e227 56 56 rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096); 57 57 if (rc != EOK) { 58 EXT4FS_DBG("block init error: \%d", rc); 58 59 return rc; 59 60 } … … 64 65 if (rc != EOK) { 65 66 block_fini(fs->device); 67 EXT4FS_DBG("superblock read error: \%d", rc); 66 68 return rc; 67 69 } … … 71 73 if (block_size > EXT4_MAX_BLOCK_SIZE) { 72 74 block_fini(fs->device); 75 EXT4FS_DBG("get blocksize error: \%d", rc); 73 76 return ENOTSUP; 74 77 } … … 78 81 if (rc != EOK) { 79 82 block_fini(fs->device); 83 EXT4FS_DBG("block cache init error: \%d", rc); 80 84 return rc; 81 85 } … … 98 102 99 103 if (state != EXT4_SUPERBLOCK_STATE_VALID_FS) { 104 block_cache_fini(fs->device); 105 block_fini(fs->device); 106 EXT4FS_DBG("invalid state error"); 100 107 return ENOTSUP; 101 108 } … … 105 112 rc = ext4_superblock_write_direct(fs->device, fs->superblock); 106 113 if (rc != EOK) { 114 block_cache_fini(fs->device); 115 block_fini(fs->device); 116 EXT4FS_DBG("state write error: \%d", rc); 107 117 return rc; 108 118 } … … 1103 1113 int rc; 1104 1114 1105 EXT4FS_DBG("");1106 1107 1115 // Handle extents separately 1108 1116 if (ext4_superblock_has_feature_incompatible( … … 1159 1167 int ext4_filesystem_add_orphan(ext4_inode_ref_t *inode_ref) 1160 1168 { 1169 1170 EXT4FS_DBG("adding orphan \%u", inode_ref->index); 1171 1161 1172 uint32_t next_orphan = ext4_superblock_get_last_orphan( 1162 1173 inode_ref->fs->superblock); … … 1180 1191 int ext4_filesystem_delete_orphan(ext4_inode_ref_t *inode_ref) 1181 1192 { 1193 1194 EXT4FS_DBG("adding orphan \%u", inode_ref->index); 1195 1182 1196 int rc; 1183 1197 … … 1185 1199 uint32_t last_orphan = ext4_superblock_get_last_orphan( 1186 1200 inode_ref->fs->superblock); 1187 assert(last_orphan > 0); 1188 1189 uint32_t next_orphan = ext4_inode_get_deletion_time(inode_ref->inode); 1201 1202 assert (last_orphan != 0); 1203 1204 ext4_inode_ref_t *current; 1205 rc = ext4_filesystem_get_inode_ref(inode_ref->fs, last_orphan, ¤t); 1206 if (rc != EOK) { 1207 return rc; 1208 } 1209 1210 uint32_t next_orphan = ext4_inode_get_deletion_time(current->inode); 1190 1211 1191 1212 // Check if the head is the target 1192 1213 if (last_orphan == inode_ref->index) { 1193 1214 ext4_superblock_set_last_orphan(inode_ref->fs->superblock, next_orphan); 1194 ext4_inode_set_deletion_time(inode_ref->inode, 0);1195 inode_ref->dirty = true;1215 // ext4_inode_set_deletion_time(inode_ref->inode, 0); 1216 // inode_ref->dirty = true; 1196 1217 return EOK; 1197 1218 } 1198 1199 ext4_inode_ref_t *current;1200 rc = ext4_filesystem_get_inode_ref(inode_ref->fs, last_orphan, ¤t);1201 if (rc != EOK) {1202 return rc;1203 }1204 1205 next_orphan = ext4_inode_get_deletion_time(current->inode);1206 1219 1207 1220 bool found = false; … … 1214 1227 next_orphan = ext4_inode_get_deletion_time(inode_ref->inode); 1215 1228 ext4_inode_set_deletion_time(current->inode, next_orphan); 1229 // ext4_inode_set_deletion_time(inode_ref->inode, 0); 1230 // inode_ref->dirty = true; 1216 1231 current->dirty = true; 1217 1232 found = true; … … 1229 1244 } 1230 1245 1231 if (found) {1232 ext4_inode_set_deletion_time(inode_ref->inode, 0);1233 }1234 1235 1246 rc = ext4_filesystem_put_inode_ref(current); 1236 1247 if (rc != EOK) { … … 1240 1251 if (!found) { 1241 1252 return ENOENT; 1242 } 1243 1244 return EOK;1253 } else { 1254 return EOK; 1255 } 1245 1256 } 1246 1257
Note:
See TracChangeset
for help on using the changeset viewer.