Changeset 82d7816 in mainline


Ignore:
Timestamp:
2011-11-24T21:16:11Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
14e9272
Parents:
3d4fd2c
Message:

some debug messages + death code removal

File:
1 edited

Legend:

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

    r3d4fd2c r82d7816  
    382382int ext4fs_destroy_node(fs_node_t *fn)
    383383{
     384        EXT4FS_DBG("");
     385
    384386        int rc;
    385387
     
    443445        rc = ext4fs_has_children(&has_children, cfn);
    444446        if (rc != EOK) {
     447                EXT4FS_DBG("\%s error: \%u", name, rc);
    445448                return rc;
    446449        }
     
    448451        // Cannot unlink non-empty node
    449452        if (has_children) {
     453                EXT4FS_DBG("\%s is not empty", name);
    450454                return ENOTEMPTY;
    451455        }
     
    456460        rc = ext4_directory_remove_entry(fs, parent, name);
    457461        if (rc != EOK) {
     462                EXT4FS_DBG("\%s removing entry failed: \%u", name, rc);
    458463                return rc;
    459464        }
     
    463468
    464469        uint32_t lnk_count = ext4_inode_get_links_count(child_inode_ref->inode);
     470        EXT4FS_DBG("link count before == \%u", lnk_count);
    465471        lnk_count--;
    466         ext4_inode_set_links_count(child_inode_ref->inode, lnk_count);
    467 
    468         child_inode_ref->dirty = true;
    469 
    470 //      EXT4FS_DBG("links count = \%u", lnk_count);
     472
    471473
    472474        // If directory - handle links from parent
    473475        if (lnk_count <= 1 && ext4fs_is_directory(cfn)) {
    474476
    475 //              EXT4FS_DBG("directory will be removed, lnlk_count = \%u", lnk_count);
    476 
    477477                if (lnk_count) {
    478                         lnk_count = ext4_inode_get_links_count(child_inode_ref->inode);
    479478                        lnk_count--;
    480                         ext4_inode_set_links_count(child_inode_ref->inode, lnk_count);
    481                 }
    482 
    483 //              ext4_inode_ref_t *parent_inode_ref = EXT4FS_NODE(pfn)->inode_ref;
    484 //              uint32_t parent_lnk_count = ext4_inode_get_links_count(
    485 //                              parent_inode_ref->inode);
    486 //
    487 //              EXT4FS_DBG("directory will be removed, parent link count = \%u", parent_lnk_count);
    488 //
    489 //              parent_lnk_count--;
    490 //              ext4_inode_set_links_count(parent_inode_ref->inode, parent_lnk_count);
    491 //
    492 //              parent_inode_ref->dirty = true;
    493         }
     479                }
     480
     481                ext4_inode_ref_t *parent_inode_ref = EXT4FS_NODE(pfn)->inode_ref;
     482
     483                EXT4FS_DBG("parent index = \%u", parent_inode_ref->index);
     484
     485                uint32_t parent_lnk_count = ext4_inode_get_links_count(
     486                                parent_inode_ref->inode);
     487
     488                EXT4FS_DBG("directory will be removed, parent link count = \%u", parent_lnk_count);
     489
     490                parent_lnk_count--;
     491                ext4_inode_set_links_count(parent_inode_ref->inode, parent_lnk_count);
     492
     493                parent_inode_ref->dirty = true;
     494        }
     495
     496        ext4_inode_set_links_count(child_inode_ref->inode, lnk_count);
     497        child_inode_ref->dirty = true;
     498
     499        EXT4FS_DBG("link count after == \%u", lnk_count);
    494500
    495501        return EOK;
     
    567573{
    568574        ext4fs_node_t *enode = EXT4FS_NODE(fn);
    569         unsigned count = ext4_inode_get_links_count(enode->inode_ref->inode);
    570         return count;
     575        return ext4_inode_get_links_count(enode->inode_ref->inode);
    571576}
    572577
     
    10741079        int rc;
    10751080        fs_node_t *fn;
    1076 //      aoff64_t old_size;
    1077 //      aoff64_t size_diff;
    10781081
    10791082        rc = ext4fs_node_get(&fn, service_id, index);
     
    10901093
    10911094        return rc;
    1092 
    1093 //      if (! ext4_inode_can_truncate(fs->superblock, inode_ref->inode)) {
    1094 //              // Unable to truncate
    1095 //              ext4fs_node_put(fn);
    1096 //              return EINVAL;
    1097 //      }
    1098 //
    1099 //      old_size = ext4_inode_get_size(fs->superblock, inode_ref->inode);
    1100 //
    1101 //      if (old_size == new_size) {
    1102 //              ext4fs_node_put(fn);
    1103 //              return EOK;
    1104 //      } else {
    1105 //
    1106 //              uint32_t block_size;
    1107 //              uint32_t blocks_count, total_blocks;
    1108 //              uint32_t i;
    1109 //
    1110 //              block_size  = ext4_superblock_get_block_size(fs->superblock);
    1111 //
    1112 //              if (old_size < new_size) {
    1113 //                      // Currently not supported to expand the file
    1114 //                      // TODO
    1115 //                      EXT4FS_DBG("trying to expand the file");
    1116 //                      ext4fs_node_put(fn);
    1117 //                      return EINVAL;
    1118 //              }
    1119 //
    1120 //              size_diff = old_size - new_size;
    1121 //              blocks_count = size_diff / block_size;
    1122 //              if (size_diff % block_size != 0) {
    1123 //                      blocks_count++;
    1124 //              }
    1125 //
    1126 //              total_blocks = old_size / block_size;
    1127 //              if (old_size % block_size != 0) {
    1128 //                      total_blocks++;
    1129 //              }
    1130 //
    1131 //              // starting from 1 because of logical blocks are numbered from 0
    1132 //              for (i = 1; i <= blocks_count; ++i) {
    1133 //                      // TODO check retval
    1134 //                      // TODO decrement inode->blocks_count
    1135 //
    1136 //                      ext4_filesystem_release_inode_block(fs, inode_ref, total_blocks - i);
    1137 //              }
    1138 //
    1139 //              ext4_inode_set_size(inode_ref->inode, new_size);
    1140 //
    1141 //              inode_ref->dirty = true;
    1142 //
    1143 //      }
    1144 //
    1145 //      ext4fs_node_put(fn);
    1146 //
    1147 //      return EOK;
    11481095}
    11491096
Note: See TracChangeset for help on using the changeset viewer.