Changeset fe61181 in mainline


Ignore:
Timestamp:
2012-07-21T08:19: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:
0b293a6
Parents:
34bc2fe
Message:

Debug messages removed

Location:
uspace
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4.h

    r34bc2fe rfe61181  
    4949
    5050#include <stdio.h>
    51 #define EXT4FS_DBG(format, ...) {if (true) printf("ext4fs: %s: " format "\n", __FUNCTION__, ##__VA_ARGS__);}
     51#define EXT4FS_DBG(format, ...) {printf("ext4fs: %s: " format "\n", __FUNCTION__, ##__VA_ARGS__);}
    5252
    5353#endif
  • uspace/lib/ext4/libext4_balloc.c

    r34bc2fe rfe61181  
    6060}
    6161
    62 
    6362/** Free block.
    6463 *
     
    8382        rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
    8483        if (rc != EOK) {
    85                 EXT4FS_DBG("error in loading bg_ref \%d", rc);
    8684                return rc;
    8785        }
     
    9391        rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
    9492        if (rc != EOK) {
    95                 EXT4FS_DBG("error in loading bitmap \%d", rc);
    9693                return rc;
    9794        }
     
    107104                /* Error in saving bitmap */
    108105                ext4_filesystem_put_block_group_ref(bg_ref);
    109                 EXT4FS_DBG("error in saving bitmap \%d", rc);
    110106                return rc;
    111107        }
     
    135131        rc = ext4_filesystem_put_block_group_ref(bg_ref);
    136132        if (rc != EOK) {
    137                 EXT4FS_DBG("error in saving bg_ref \%d", rc);
    138133                return rc;
    139134        }
     
    169164        rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
    170165        if (rc != EOK) {
    171                 EXT4FS_DBG("error in loading bg_ref \%d", rc);
    172166                return rc;
    173167        }
     
    184178        rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
    185179        if (rc != EOK) {
    186                 EXT4FS_DBG("error in loading bitmap \%d", rc);
    187180                return rc;
    188181        }
     
    197190                /* Error in saving bitmap */
    198191                ext4_filesystem_put_block_group_ref(bg_ref);
    199                 EXT4FS_DBG("error in saving bitmap \%d", rc);
    200192                return rc;
    201193        }
     
    225217        rc = ext4_filesystem_put_block_group_ref(bg_ref);
    226218        if (rc != EOK) {
    227                 EXT4FS_DBG("error in saving bg_ref \%d", rc);
    228219                return rc;
    229220        }
     
    368359        if (goal == 0) {
    369360                /* no goal found => partition is full */
    370                 EXT4FS_DBG("ERROR (goal == 0)");
    371361                return ENOSPC;
    372362        }
     
    384374        rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, block_group, &bg_ref);
    385375        if (rc != EOK) {
    386                 EXT4FS_DBG("initial BG ref not loaded");
    387376                return rc;
    388377        }
     
    407396        if (rc != EOK) {
    408397                ext4_filesystem_put_block_group_ref(bg_ref);
    409                 EXT4FS_DBG("initial bitmap not loaded");
    410398                return rc;
    411399        }
     
    417405                rc = block_put(bitmap_block);
    418406                if (rc != EOK) {
    419                         EXT4FS_DBG("goal check: error in saving bitmap \%d", rc);
    420407                        ext4_filesystem_put_block_group_ref(bg_ref);
    421408                        return rc;
     
    444431                        rc = block_put(bitmap_block);
    445432                        if (rc != EOK) {
    446                                 EXT4FS_DBG("near blocks: error in saving initial bitmap \%d", rc);
    447433                                return rc;
    448434                        }
     
    462448                rc = block_put(bitmap_block);
    463449                if (rc != EOK) {
    464                         EXT4FS_DBG("free byte: error in saving initial bitmap \%d", rc);
    465450                        return rc;
    466451                }
     
    478463                rc = block_put(bitmap_block);
    479464                if (rc != EOK) {
    480                         EXT4FS_DBG("free bit: error in saving initial bitmap \%d", rc);
    481465                        return rc;
    482466                }
     
    501485                rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, bgid, &bg_ref);
    502486                if (rc != EOK) {
    503                         EXT4FS_DBG("ERROR: unable to load block group \%u", bgid);
    504487                        return rc;
    505488                }
     
    512495                if (rc != EOK) {
    513496                        ext4_filesystem_put_block_group_ref(bg_ref);
    514                         EXT4FS_DBG("ERROR: unable to load bitmap block");
    515497                        return rc;
    516498                }
     
    531513
    532514                /* Try to find free byte in bitmap */
    533                 rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data, index_in_group, &rel_block_idx, blocks_in_group);
     515                rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
     516                                index_in_group, &rel_block_idx, blocks_in_group);
    534517                if (rc == EOK) {
    535518                        bitmap_block->dirty = true;
    536519                        rc = block_put(bitmap_block);
    537520                        if (rc != EOK) {
    538                                 EXT4FS_DBG("ERROR: unable to save bitmap block");
    539521                                return rc;
    540522                        }
     
    552534                        rc = block_put(bitmap_block);
    553535                        if (rc != EOK) {
    554                                 EXT4FS_DBG("ERROR: unable to save bitmap block");
    555536                                return rc;
    556537                        }
     
    625606        rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
    626607        if (rc != EOK) {
    627                 EXT4FS_DBG("error in loading bg_ref \%d", rc);
    628608                return rc;
    629609        }
     
    635615        rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
    636616        if (rc != EOK) {
    637                 EXT4FS_DBG("error in loading bitmap \%d", rc);
    638617                return rc;
    639618        }
     
    653632                /* Error in saving bitmap */
    654633                ext4_filesystem_put_block_group_ref(bg_ref);
    655                 EXT4FS_DBG("error in saving bitmap \%d", rc);
    656634                return rc;
    657635        }
     
    687665        rc = ext4_filesystem_put_block_group_ref(bg_ref);
    688666        if (rc != EOK) {
    689                 EXT4FS_DBG("error in saving bg_ref \%d", rc);
    690667                return rc;
    691668        }
  • uspace/lib/ext4/libext4_directory.c

    r34bc2fe rfe61181  
    413413                ext4_inode_clear_flag(parent->inode, EXT4_INODE_FLAG_INDEX);
    414414                parent->dirty = true;
    415 
    416                 EXT4FS_DBG("index is corrupted - doing linear algorithm, index flag cleared");
    417415        }
    418416
     
    522520                parent->dirty = true;
    523521
    524                 EXT4FS_DBG("index is corrupted - doing linear search");
    525522        }
    526523
  • uspace/lib/ext4/libext4_directory_index.c

    r34bc2fe rfe61181  
    318318        /* Check unused flags */
    319319        if (root->info.unused_flags != 0) {
    320                 EXT4FS_DBG("ERR: unused_flags = \%u", root->info.unused_flags);
    321320                return EXT4_ERR_BAD_DX_DIR;
    322321        }
     
    324323        /* Check indirect levels */
    325324        if (root->info.indirect_levels > 1) {
    326                 EXT4FS_DBG("ERR: indirect_levels = \%u", root->info.indirect_levels);
    327325                return EXT4_ERR_BAD_DX_DIR;
    328326        }
     
    897895                /* Linux limitation */
    898896                if ((levels > 0) && (root_limit == root_count)) {
    899                         EXT4FS_DBG("Directory index is full");
    900897                        return ENOSPC;
    901898                }
     
    10391036        if (rc != EOK) {
    10401037                block_put(root_block);
    1041                 EXT4FS_DBG("hinfo initialization error");
    10421038                return EXT4_ERR_BAD_DX_DIR;
    10431039        }
     
    10481044        rc = ext4_directory_dx_get_leaf(&hinfo, parent, root_block, &dx_block, dx_blocks);
    10491045        if (rc != EOK) {
    1050                 EXT4FS_DBG("get leaf error");
    10511046                rc = EXT4_ERR_BAD_DX_DIR;
    10521047                goto release_index;
     
    11021097        rc = block_put(new_block);
    11031098        if (rc != EOK) {
    1104                 EXT4FS_DBG("error writing new block");
    11051099                return rc;
    11061100        }
     
    11141108        rc = block_put(target_block);
    11151109        if (rc != EOK) {
    1116                 EXT4FS_DBG("error writing target block");
    11171110                return rc;
    11181111        }
     
    11291122                rc = block_put(dx_it->block);
    11301123                if (rc != EOK) {
    1131                         EXT4FS_DBG("error writing index block");
    11321124                        return rc;
    11331125                }
  • uspace/lib/ext4/libext4_extent.c

    r34bc2fe rfe61181  
    506506        rc = ext4_balloc_free_blocks(inode_ref, start, block_count);
    507507        if (rc != EOK) {
    508                 EXT4FS_DBG("Error in releasing data blocks");
    509508                return rc;
    510509        }
     
    534533        rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
    535534        if (rc != EOK) {
    536                 EXT4FS_DBG("ERROR get_block");
    537535                return rc;
    538536        }
     
    550548                        rc = ext4_extent_release_branch(inode_ref, idx);
    551549                        if (rc != EOK) {
    552                                 EXT4FS_DBG("error recursion");
    553550                                return rc;
    554551                        }
     
    564561                        rc = ext4_extent_release(inode_ref, ext);
    565562                        if (rc != EOK) {
    566                                 EXT4FS_DBG("error recursion");
    567563                                return rc;
    568564                        }
     
    574570        rc = block_put(block);
    575571        if (rc != EOK) {
    576                 EXT4FS_DBG("ERROR block_put returned \%d", rc);
    577572                return rc;
    578573        }
     
    837832                rc = ext4_balloc_alloc_block(inode_ref, &new_fblock);
    838833                if (rc != EOK) {
    839                         EXT4FS_DBG("error in block allocation");
    840834                        return rc;
    841835                }
     
    845839                                new_fblock, BLOCK_FLAGS_NOREAD);
    846840                if (rc != EOK) {
    847                         EXT4FS_DBG("error in block_get");
    848841                        return rc;
    849842                }
     
    10491042        rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
    10501043        if (rc != EOK) {
    1051                 EXT4FS_DBG("error in block allocation, rc = \%d", rc);
    10521044                goto finish;
    10531045        }
  • uspace/lib/ext4/libext4_filesystem.c

    r34bc2fe rfe61181  
    5656        rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
    5757        if (rc != EOK) {
    58                 EXT4FS_DBG("block init error: \%d", rc);
    5958                return rc;
    6059        }
     
    6564        if (rc != EOK) {
    6665                block_fini(fs->device);
    67                 EXT4FS_DBG("superblock read error: \%d", rc);
    6866                return rc;
    6967        }
     
    7371        if (block_size > EXT4_MAX_BLOCK_SIZE) {
    7472                block_fini(fs->device);
    75                 EXT4FS_DBG("get blocksize error: \%d", rc);
    7673                return ENOTSUP;
    7774        }
     
    8178        if (rc != EOK) {
    8279                block_fini(fs->device);
    83                 EXT4FS_DBG("block cache init error: \%d", rc);
    8480                return rc;
    8581        }
     
    104100                block_cache_fini(fs->device);
    105101                block_fini(fs->device);
    106                 EXT4FS_DBG("Unable to mount: Invalid state error");
    107102                return ENOTSUP;
    108103        }
     
    114109                block_cache_fini(fs->device);
    115110                block_fini(fs->device);
    116                 EXT4FS_DBG("state write error: \%d", rc);
    117111                return rc;
    118112        }
     
    192186        incompatible_features &= ~EXT4_FEATURE_INCOMPAT_SUPP;
    193187        if (incompatible_features > 0) {
    194                 EXT4FS_DBG("Not supported incompatible features");
    195188                return ENOTSUP;
    196189        }
     
    203196        compatible_read_only &= ~EXT4_FEATURE_RO_COMPAT_SUPP;
    204197        if (compatible_read_only > 0) {
    205                 EXT4FS_DBG("Not supported readonly features - mounting READ-ONLY");
    206198                *read_only = true;
    207199                return EOK;
     
    357349 * @param bg_ref        reference to block group
    358350 * @return                      error code
    359  */static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
     351 */
     352static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
    360353{
    361354        int rc;
     
    14051398}
    14061399
    1407 /** Add orphaned i-node to the orphans linked list.
    1408  *
    1409  * @param inode_ref             i-node to be added to orphans list
    1410  * @return                              error code
    1411  */
    1412 int ext4_filesystem_add_orphan(ext4_inode_ref_t *inode_ref)
    1413 {
    1414         uint32_t next_orphan = ext4_superblock_get_last_orphan(
    1415                         inode_ref->fs->superblock);
    1416 
    1417         /* Deletion time is used for holding next item of the list */
    1418         ext4_inode_set_deletion_time(inode_ref->inode, next_orphan);
    1419 
    1420         /* Head of the list is in the superblock */
    1421         ext4_superblock_set_last_orphan(
    1422                         inode_ref->fs->superblock, inode_ref->index);
    1423         inode_ref->dirty = true;
    1424 
    1425         return EOK;
    1426 }
    1427 
    1428 /** Delete orphaned i-node from the orphans linked list.
    1429  *
    1430  * @param inode_ref             i-node to be deleted from the orphans list
    1431  * @return                              error code
    1432  */
    1433 int ext4_filesystem_delete_orphan(ext4_inode_ref_t *inode_ref)
    1434 {
    1435         int rc;
    1436 
    1437         /* Get head of the linked list */
    1438         uint32_t last_orphan = ext4_superblock_get_last_orphan(
    1439                         inode_ref->fs->superblock);
    1440 
    1441         assert (last_orphan != 0);
    1442 
    1443         ext4_inode_ref_t *current;
    1444         rc = ext4_filesystem_get_inode_ref(inode_ref->fs, last_orphan, &current);
    1445         if (rc != EOK) {
    1446                 return rc;
    1447         }
    1448 
    1449         uint32_t next_orphan = ext4_inode_get_deletion_time(current->inode);
    1450 
    1451         /* Check if the head is the target */
    1452         if (last_orphan == inode_ref->index) {
    1453                 ext4_superblock_set_last_orphan(inode_ref->fs->superblock, next_orphan);
    1454                 return EOK;
    1455         }
    1456 
    1457         bool found = false;
    1458 
    1459         /* Walk thourgh the linked list */
    1460         while (next_orphan != 0) {
    1461 
    1462                 /* Found? */
    1463                 if (next_orphan == inode_ref->index) {
    1464                         next_orphan = ext4_inode_get_deletion_time(inode_ref->inode);
    1465                         ext4_inode_set_deletion_time(current->inode, next_orphan);
    1466                         current->dirty = true;
    1467                         found = true;
    1468                         break;
    1469                 }
    1470 
    1471                 ext4_filesystem_put_inode_ref(current);
    1472 
    1473                 rc = ext4_filesystem_get_inode_ref(inode_ref->fs, next_orphan, &current);
    1474                 if (rc != EOK) {
    1475                         return rc;
    1476                 }
    1477                 next_orphan = ext4_inode_get_deletion_time(current->inode);
    1478 
    1479         }
    1480 
    1481         rc = ext4_filesystem_put_inode_ref(current);
    1482         if (rc != EOK) {
    1483                 return rc;
    1484         }
    1485 
    1486         if (!found) {
    1487                 return ENOENT;
    1488         } else {
    1489                 return EOK;
    1490         }
    1491 }
    1492 
    14931400/**
    14941401 * @}
  • uspace/lib/ext4/libext4_filesystem.h

    r34bc2fe rfe61181  
    6464                uint32_t *, uint32_t *);
    6565
    66 extern int ext4_filesystem_add_orphan(ext4_inode_ref_t *);
    67 extern int ext4_filesystem_delete_orphan(ext4_inode_ref_t *);
    68 
    69 extern uint16_t ext4_group_desc_csum(ext4_superblock_t *, uint32_t,
    70                 ext4_block_group_t *);
    7166#endif
    7267
  • uspace/lib/ext4/libext4_ialloc.c

    r34bc2fe rfe61181  
    244244                        rc = ext4_filesystem_put_block_group_ref(bg_ref);
    245245                        if (rc != EOK) {
    246                                 EXT4FS_DBG("ERROR: unable to put block group reference");
    247246                                return rc;
    248247                        }
  • uspace/lib/ext4/libext4_superblock.c

    r34bc2fe rfe61181  
    10811081        }
    10821082
    1083         // TODO more checks !!!
    1084 
    10851083        return EOK;
    10861084}
  • uspace/srv/fs/ext4fs/ext4fs_ops.c

    r34bc2fe rfe61181  
    553553        }
    554554
    555         /* Handle orphans */
    556         // TODO this code should be deleted
    557 //      ext4_filesystem_t *fs = enode->instance->filesystem;
    558 //      uint32_t rev_level = ext4_superblock_get_rev_level(fs->superblock);
    559 //      uint16_t lnk_count = ext4_inode_get_links_count(inode_ref->inode);
    560 //      if ((rev_level > 0) && (lnk_count == 0)) {
    561 //              rc = ext4_filesystem_delete_orphan(inode_ref);
    562 //              if (rc != EOK) {
    563 //                      EXT4FS_DBG("delete orphan error, rc = \%d", rc);
    564 //              }
    565 //      }
    566 
    567555        // TODO set real deletion time when it will be supported, temporary set fake time
    568556//      time_t now = time(NULL);
     
    704692                parent->dirty = true;
    705693        }
    706 
    707 //      ext4_filesystem_t *fs = EXT4FS_NODE(pfn)->instance->filesystem;
    708 //      uint32_t rev_level = ext4_superblock_get_rev_level(fs->superblock);
    709 //      if ((rev_level > 0) && (lnk_count == 0)) {
    710 //              rc = ext4_filesystem_add_orphan(child_inode_ref);
    711 //              if (rc != EOK) {
    712 //                      EXT4FS_DBG("add orphan error, rc = \%d", rc);
    713 //              }
    714 //      }
    715694
    716695        // TODO set timestamps for parent (when we have wall-clock time)
Note: See TracChangeset for help on using the changeset viewer.