Changeset 1d8cdb1 in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2008-11-18T20:28:17Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
18c485a
Parents:
26fa0f9f
Message:

Avoid unnecessary block reads in block_get().

File:
1 edited

Legend:

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

    r26fa0f9f r1d8cdb1  
    9090        /* Read the block that contains the dentry of interest. */
    9191        b = _fat_block_get(bs, node->idx->dev_handle, node->idx->pfc,
    92             (node->idx->pdi * sizeof(fat_dentry_t)) / bps);
     92            (node->idx->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE);
    9393
    9494        d = ((fat_dentry_t *)b->data) + (node->idx->pdi % dps);
     
    182182        /* Read the block that contains the dentry of interest. */
    183183        b = _fat_block_get(bs, idxp->dev_handle, idxp->pfc,
    184             (idxp->pdi * sizeof(fat_dentry_t)) / bps);
     184            (idxp->pdi * sizeof(fat_dentry_t)) / bps, BLOCK_FLAGS_NONE);
    185185        assert(b);
    186186
     
    283283        blocks = parentp->size / bps;
    284284        for (i = 0; i < blocks; i++) {
    285                 b = fat_block_get(bs, parentp, i);
     285                b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NONE);
    286286                for (j = 0; j < dps; j++) {
    287287                        d = ((fat_dentry_t *)b->data) + j;
     
    373373                fat_dentry_t *d;
    374374       
    375                 b = fat_block_get(bs, nodep, i);
     375                b = fat_block_get(bs, nodep, i, BLOCK_FLAGS_NONE);
    376376                for (j = 0; j < dps; j++) {
    377377                        d = ((fat_dentry_t *)b->data) + j;
     
    575575                        bytes = min(len, bps - pos % bps);
    576576                        bytes = min(bytes, nodep->size - pos);
    577                         b = fat_block_get(bs, nodep, pos / bps);
     577                        b = fat_block_get(bs, nodep, pos / bps,
     578                            BLOCK_FLAGS_NONE);
    578579                        (void) ipc_data_read_finalize(callid, b->data + pos % bps,
    579580                            bytes);
     
    600601                        off_t o;
    601602
    602                         b = fat_block_get(bs, nodep, bnum);
     603                        b = fat_block_get(bs, nodep, bnum, BLOCK_FLAGS_NONE);
    603604                        for (o = pos % (bps / sizeof(fat_dentry_t));
    604605                            o < bps / sizeof(fat_dentry_t);
     
    648649        unsigned bpc;           /* bytes per cluster */
    649650        off_t boundary;
     651        int flags = BLOCK_FLAGS_NONE;
    650652       
    651653        if (!nodep) {
     
    676678         */
    677679        bytes = min(len, bps - pos % bps);
     680        if (bytes == bps)
     681                flags |= BLOCK_FLAGS_NOREAD;
    678682       
    679683        boundary = ROUND_UP(nodep->size, bpc);
     
    686690                 */
    687691                fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos);
    688                 b = fat_block_get(bs, nodep, pos / bps);
     692                b = fat_block_get(bs, nodep, pos / bps, flags);
    689693                (void) ipc_data_write_finalize(callid, b->data + pos % bps,
    690694                    bytes);
     
    719723                /* zero fill any gaps */
    720724                fat_fill_gap(bs, nodep, mcl, pos);
    721                 b = _fat_block_get(bs, dev_handle, lcl, (pos / bps) % spc);
     725                b = _fat_block_get(bs, dev_handle, lcl, (pos / bps) % spc,
     726                    flags);
    722727                (void) ipc_data_write_finalize(callid, b->data + pos % bps,
    723728                    bytes);
Note: See TracChangeset for help on using the changeset viewer.