Changeset 4687a26c in mainline for uspace/srv/fs/fat/fat_fat.c


Ignore:
Timestamp:
2010-11-02T18:29:01Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f35b9ff
Parents:
76e1121f (diff), 28f4adb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r76e1121f r4687a26c  
    545545        dev_handle_t dev_handle = nodep->idx->dev_handle;
    546546        fat_cluster_t lastc;
    547         uint16_t numc;
    548547        uint8_t fatno;
    549548        int rc;
    550549
    551         if (nodep->lastc_cached_valid) {
    552                 lastc = nodep->lastc_cached_value;
    553                 nodep->lastc_cached_valid = false;
     550        if (nodep->firstc == FAT_CLST_RES0) {
     551                /* No clusters allocated to the node yet. */
     552                nodep->firstc = mcl;
     553                nodep->dirty = true;    /* need to sync node */
    554554        } else {
    555                 rc = fat_cluster_walk(bs, dev_handle, nodep->firstc, &lastc,
    556                     &numc, (uint16_t) -1);
    557                 if (rc != EOK)
    558                         return rc;
    559 
    560                 if (numc == 0) {
    561                         /* No clusters allocated to the node yet. */
    562                         nodep->firstc = mcl;
    563                         nodep->dirty = true;    /* need to sync node */
    564                         return EOK;
     555                if (nodep->lastc_cached_valid) {
     556                        lastc = nodep->lastc_cached_value;
     557                        nodep->lastc_cached_valid = false;
     558                } else {
     559                        rc = fat_cluster_walk(bs, dev_handle, nodep->firstc,
     560                            &lastc, NULL, (uint16_t) -1);
     561                        if (rc != EOK)
     562                                return rc;
    565563                }
    566         }
    567 
    568         for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
    569                 rc = fat_set_cluster(bs, nodep->idx->dev_handle, fatno, lastc,
    570                     mcl);
    571                 if (rc != EOK)
    572                         return rc;
     564
     565                for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
     566                        rc = fat_set_cluster(bs, nodep->idx->dev_handle, fatno,
     567                            lastc, mcl);
     568                        if (rc != EOK)
     569                                return rc;
     570                }
    573571        }
    574572
Note: See TracChangeset for help on using the changeset viewer.