Changeset dba4a23 in mainline
- Timestamp:
- 2010-07-28T15:22:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4637c72, 9a1d8ab
- Parents:
- 6da81e0
- Location:
- uspace/srv/fs/fat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat.h
r6da81e0 rdba4a23 213 213 214 214 /* 215 * Cache of the node's last cluster to avoid some unnecessary FAT walks. 215 * Cache of the node's last and "current" cluster to avoid some 216 * unnecessary FAT walks. 216 217 */ 217 bool lastc_cached_valid; 218 fat_cluster_t lastc_cached_value; 218 /* Node's last cluster in FAT. */ 219 bool lastc_cached_valid; 220 fat_cluster_t lastc_cached_value; 221 /* Node's "current" cluster, i.e. where the last I/O took place. */ 222 bool currc_cached_valid; 223 aoff64_t currc_cached_bn; 224 fat_cluster_t currc_cached_value; 219 225 } fat_node_t; 220 226 -
uspace/srv/fs/fat/fat_fat.c
r6da81e0 rdba4a23 142 142 aoff64_t bn, int flags) 143 143 { 144 fat_cluster_t firstc = nodep->firstc; 145 fat_cluster_t currc; 146 aoff64_t relbn = bn; 147 int rc; 148 144 149 if (!nodep->size) 145 150 return ELIMIT; … … 158 163 } 159 164 165 if (nodep->currc_cached_valid && bn >= nodep->currc_cached_bn) { 166 /* 167 * We can start with the cluster cached by the previous call to 168 * fat_block_get(). 169 */ 170 firstc = nodep->currc_cached_value; 171 relbn -= (nodep->currc_cached_bn / SPC(bs)) * SPC(bs); 172 } 173 160 174 fall_through: 161 return _fat_block_get(block, bs, nodep->idx->dev_handle, nodep->firstc, 162 NULL, bn, flags); 175 rc = _fat_block_get(block, bs, nodep->idx->dev_handle, firstc, 176 &currc, relbn, flags); 177 if (rc != EOK) 178 return rc; 179 180 /* 181 * Update the "current" cluster cache. 182 */ 183 nodep->currc_cached_valid = true; 184 nodep->currc_cached_bn = bn; 185 nodep->currc_cached_value = currc; 186 187 return rc; 163 188 } 164 189 … … 567 592 dev_handle_t dev_handle = nodep->idx->dev_handle; 568 593 594 /* 595 * Invalidate cached cluster numbers. 596 */ 569 597 nodep->lastc_cached_valid = false; 598 if (nodep->currc_cached_value != lcl) 599 nodep->currc_cached_valid = false; 600 570 601 if (lcl == FAT_CLST_RES0) { 571 602 /* The node will have zero size and no clusters allocated. */ … … 597 628 } 598 629 630 /* 631 * Update and re-enable the last cluster cache. 632 */ 599 633 nodep->lastc_cached_valid = true; 600 634 nodep->lastc_cached_value = lcl; -
uspace/srv/fs/fat/fat_ops.c
r6da81e0 rdba4a23 106 106 node->lastc_cached_valid = false; 107 107 node->lastc_cached_value = FAT_CLST_LAST1; 108 node->currc_cached_valid = false; 109 node->currc_cached_bn = 0; 110 node->currc_cached_value = FAT_CLST_LAST1; 108 111 } 109 112
Note:
See TracChangeset
for help on using the changeset viewer.