Changes in / [edb14ca:c1618ed] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
redb14ca rc1618ed 78 78 } 79 79 80 static intfat_node_sync(fat_node_t *node)80 static void fat_node_sync(fat_node_t *node) 81 81 { 82 82 block_t *b; … … 96 96 rc = _fat_block_get(&b, bs, node->idx->dev_handle, node->idx->pfc, 97 97 (node->idx->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE); 98 if (rc != EOK) 99 return rc; 98 assert(rc == EOK); 100 99 101 100 d = ((fat_dentry_t *)b->data) + (node->idx->pdi % dps); … … 112 111 b->dirty = true; /* need to sync block */ 113 112 rc = block_put(b); 114 return rc;113 assert(rc == EOK); 115 114 } 116 115 … … 119 118 fs_node_t *fn; 120 119 fat_node_t *nodep; 121 int rc;122 120 123 121 fibril_mutex_lock(&ffn_mutex); … … 135 133 list_remove(&nodep->ffn_link); 136 134 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); 141 137 idxp_tmp->nodep = NULL; 142 138 fibril_mutex_unlock(&nodep->lock); … … 445 441 for (i = 0; i < blocks; i++) { 446 442 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); 451 444 for (j = 0; j < dps; j++) { 452 445 d = ((fat_dentry_t *)b->data) + j; … … 463 456 } 464 457 rc = block_put(b); 465 if (rc != EOK) { 466 fibril_mutex_unlock(&parentp->idx->lock); 467 return rc; 468 } 458 assert(rc == EOK); 469 459 } 470 460 j = 0; … … 484 474 } 485 475 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); 490 477 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); 495 479 parentp->size += bps * bs->spc; 496 480 parentp->dirty = true; /* need to sync node */ 497 481 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); 502 483 d = (fat_dentry_t *)b->data; 503 484 … … 513 494 b->dirty = true; /* need to sync block */ 514 495 rc = block_put(b); 496 assert(rc == EOK); 515 497 fibril_mutex_unlock(&parentp->idx->lock); 516 if (rc != EOK)517 return rc;518 498 519 499 fibril_mutex_lock(&childp->idx->lock); … … 526 506 */ 527 507 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); 535 509 d = (fat_dentry_t *)b->data; 536 510 if (fat_classify_dentry(d) == FAT_DENTRY_LAST || … … 556 530 } 557 531 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); 564 534 565 535 childp->idx->pfc = parentp->firstc; … … 606 576 (childp->idx->pdi * sizeof(fat_dentry_t)) / bps, 607 577 BLOCK_FLAGS_NONE); 608 if (rc != EOK) 609 goto error; 578 assert(rc == EOK); 610 579 d = (fat_dentry_t *)b->data + 611 580 (childp->idx->pdi % (bps / sizeof(fat_dentry_t))); … … 614 583 b->dirty = true; /* need to sync block */ 615 584 rc = block_put(b); 616 if (rc != EOK) 617 goto error; 585 assert(rc == EOK); 618 586 619 587 /* remove the index structure from the position hash */ … … 629 597 630 598 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;637 599 } 638 600
Note:
See TracChangeset
for help on using the changeset viewer.