Changeset 840e227 in mainline for uspace/lib/ext4/libext4_filesystem.c


Ignore:
Timestamp:
2012-06-03T15:08:33Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
85a4350
Parents:
ca47f656
Message:

added debug error messages and modified delete orphan function (will be deleted probably)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_filesystem.c

    rca47f656 r840e227  
    5656        rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
    5757        if (rc != EOK) {
     58                EXT4FS_DBG("block init error: \%d", rc);
    5859                return rc;
    5960        }
     
    6465        if (rc != EOK) {
    6566                block_fini(fs->device);
     67                EXT4FS_DBG("superblock read error: \%d", rc);
    6668                return rc;
    6769        }
     
    7173        if (block_size > EXT4_MAX_BLOCK_SIZE) {
    7274                block_fini(fs->device);
     75                EXT4FS_DBG("get blocksize error: \%d", rc);
    7376                return ENOTSUP;
    7477        }
     
    7881        if (rc != EOK) {
    7982                block_fini(fs->device);
     83                EXT4FS_DBG("block cache init error: \%d", rc);
    8084                return rc;
    8185        }
     
    98102
    99103        if (state != EXT4_SUPERBLOCK_STATE_VALID_FS) {
     104                block_cache_fini(fs->device);
     105                block_fini(fs->device);
     106                EXT4FS_DBG("invalid state error");
    100107                return ENOTSUP;
    101108        }
     
    105112        rc = ext4_superblock_write_direct(fs->device, fs->superblock);
    106113        if (rc != EOK) {
     114                block_cache_fini(fs->device);
     115                block_fini(fs->device);
     116                EXT4FS_DBG("state write error: \%d", rc);
    107117                return rc;
    108118        }
     
    11031113        int rc;
    11041114
    1105         EXT4FS_DBG("");
    1106 
    11071115        // Handle extents separately
    11081116        if (ext4_superblock_has_feature_incompatible(
     
    11591167int ext4_filesystem_add_orphan(ext4_inode_ref_t *inode_ref)
    11601168{
     1169
     1170        EXT4FS_DBG("adding orphan \%u", inode_ref->index);
     1171
    11611172        uint32_t next_orphan = ext4_superblock_get_last_orphan(
    11621173                        inode_ref->fs->superblock);
     
    11801191int ext4_filesystem_delete_orphan(ext4_inode_ref_t *inode_ref)
    11811192{
     1193
     1194        EXT4FS_DBG("adding orphan \%u", inode_ref->index);
     1195
    11821196        int rc;
    11831197
     
    11851199        uint32_t last_orphan = ext4_superblock_get_last_orphan(
    11861200                        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, &current);
     1206        if (rc != EOK) {
     1207                return rc;
     1208        }
     1209
     1210        uint32_t next_orphan = ext4_inode_get_deletion_time(current->inode);
    11901211
    11911212        // Check if the head is the target
    11921213        if (last_orphan == inode_ref->index) {
    11931214                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;
    11961217                return EOK;
    11971218        }
    1198 
    1199         ext4_inode_ref_t *current;
    1200         rc = ext4_filesystem_get_inode_ref(inode_ref->fs, last_orphan, &current);
    1201         if (rc != EOK) {
    1202                 return rc;
    1203         }
    1204 
    1205         next_orphan = ext4_inode_get_deletion_time(current->inode);
    12061219
    12071220        bool found = false;
     
    12141227                        next_orphan = ext4_inode_get_deletion_time(inode_ref->inode);
    12151228                        ext4_inode_set_deletion_time(current->inode, next_orphan);
     1229//                      ext4_inode_set_deletion_time(inode_ref->inode, 0);
     1230//                      inode_ref->dirty = true;
    12161231                        current->dirty = true;
    12171232                        found = true;
     
    12291244        }
    12301245
    1231         if (found) {
    1232                 ext4_inode_set_deletion_time(inode_ref->inode, 0);
    1233         }
    1234 
    12351246        rc = ext4_filesystem_put_inode_ref(current);
    12361247        if (rc != EOK) {
     
    12401251        if (!found) {
    12411252                return ENOENT;
    1242         }
    1243 
    1244         return EOK;
     1253        } else {
     1254                return EOK;
     1255        }
    12451256}
    12461257
Note: See TracChangeset for help on using the changeset viewer.