Changes in / [edb14ca:c1618ed] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    redb14ca rc1618ed  
    7878}
    7979
    80 static int fat_node_sync(fat_node_t *node)
     80static void fat_node_sync(fat_node_t *node)
    8181{
    8282        block_t *b;
     
    9696        rc = _fat_block_get(&b, bs, node->idx->dev_handle, node->idx->pfc,
    9797            (node->idx->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE);
    98         if (rc != EOK)
    99                 return rc;
     98        assert(rc == EOK);
    10099
    101100        d = ((fat_dentry_t *)b->data) + (node->idx->pdi % dps);
     
    112111        b->dirty = true;                /* need to sync block */
    113112        rc = block_put(b);
    114         return rc;
     113        assert(rc == EOK);
    115114}
    116115
     
    119118        fs_node_t *fn;
    120119        fat_node_t *nodep;
    121         int rc;
    122120
    123121        fibril_mutex_lock(&ffn_mutex);
     
    135133                list_remove(&nodep->ffn_link);
    136134                fibril_mutex_unlock(&ffn_mutex);
    137                 if (nodep->dirty) {
    138                         rc = fat_node_sync(nodep);
    139                         assert(rc == EOK);
    140                 }
     135                if (nodep->dirty)
     136                        fat_node_sync(nodep);
    141137                idxp_tmp->nodep = NULL;
    142138                fibril_mutex_unlock(&nodep->lock);
     
    445441        for (i = 0; i < blocks; i++) {
    446442                rc = fat_block_get(&b, bs, parentp, i, BLOCK_FLAGS_NONE);
    447                 if (rc != EOK) {
    448                         fibril_mutex_unlock(&parentp->idx->lock);
    449                         return rc;
    450                 }
     443                assert(rc == EOK);
    451444                for (j = 0; j < dps; j++) {
    452445                        d = ((fat_dentry_t *)b->data) + j;
     
    463456                }
    464457                rc = block_put(b);
    465                 if (rc != EOK) {
    466                         fibril_mutex_unlock(&parentp->idx->lock);
    467                         return rc;
    468                 }
     458                assert(rc == EOK);
    469459        }
    470460        j = 0;
     
    484474        }
    485475        rc = fat_zero_cluster(bs, parentp->idx->dev_handle, mcl);
    486         if (rc != EOK) {
    487                 fibril_mutex_unlock(&parentp->idx->lock);
    488                 return rc;
    489         }
     476        assert(rc == EOK);
    490477        rc = fat_append_clusters(bs, parentp, mcl);
    491         if (rc != EOK) {
    492                 fibril_mutex_unlock(&parentp->idx->lock);
    493                 return rc;
    494         }
     478        assert(rc == EOK);
    495479        parentp->size += bps * bs->spc;
    496480        parentp->dirty = true;          /* need to sync node */
    497481        rc = fat_block_get(&b, bs, parentp, i, BLOCK_FLAGS_NONE);
    498         if (rc != EOK) {
    499                 fibril_mutex_unlock(&parentp->idx->lock);
    500                 return rc;
    501         }
     482        assert(rc == EOK);
    502483        d = (fat_dentry_t *)b->data;
    503484
     
    513494        b->dirty = true;                /* need to sync block */
    514495        rc = block_put(b);
     496        assert(rc == EOK);
    515497        fibril_mutex_unlock(&parentp->idx->lock);
    516         if (rc != EOK)
    517                 return rc;
    518498
    519499        fibril_mutex_lock(&childp->idx->lock);
     
    526506         */
    527507        rc = fat_block_get(&b, bs, childp, 0, BLOCK_FLAGS_NONE);
    528         if (rc != EOK) {
    529                 /*
    530                  * Rather than returning an error, simply skip the creation of
    531                  * these two entries.
    532                  */
    533                 goto skip_dots;
    534         }
     508        assert(rc == EOK);
    535509        d = (fat_dentry_t *)b->data;
    536510        if (fat_classify_dentry(d) == FAT_DENTRY_LAST ||
     
    556530        }
    557531        b->dirty = true;                /* need to sync block */
    558         /*
    559          * Ignore the return value as we would have fallen through on error
    560          * anyway.
    561          */
    562         (void) block_put(b);
    563 skip_dots:
     532        rc = block_put(b);
     533        assert(rc == EOK);
    564534
    565535        childp->idx->pfc = parentp->firstc;
     
    606576            (childp->idx->pdi * sizeof(fat_dentry_t)) / bps,
    607577            BLOCK_FLAGS_NONE);
    608         if (rc != EOK)
    609                 goto error;
     578        assert(rc == EOK);
    610579        d = (fat_dentry_t *)b->data +
    611580            (childp->idx->pdi % (bps / sizeof(fat_dentry_t)));
     
    614583        b->dirty = true;                /* need to sync block */
    615584        rc = block_put(b);
    616         if (rc != EOK)
    617                 goto error;
     585        assert(rc == EOK);
    618586
    619587        /* remove the index structure from the position hash */
     
    629597
    630598        return EOK;
    631 
    632 error:
    633         fibril_mutex_unlock(&parentp->idx->lock);
    634         fibril_mutex_unlock(&childp->lock);
    635         fibril_mutex_unlock(&childp->idx->lock);
    636         return rc;
    637599}
    638600
Note: See TracChangeset for help on using the changeset viewer.