Changes in / [d2663d8:cc8044e] in mainline
- Location:
- uspace/srv/fs/mfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs.h
rd2663d8 rcc8044e 44 44 #include <errno.h> 45 45 #include <assert.h> 46 #include <stdbool.h>47 46 #include "../../vfs/vfs.h" 48 47 … … 106 105 unsigned isearch; 107 106 unsigned zsearch; 108 109 /* Indicates wether if the cached number of free zones110 * is to be considered valid or not.111 */112 bool nfree_zones_valid;113 /* Cached number of free zones, used to avoid to scan114 * the whole bitmap every time the mfs_free_block_count()115 * is invoked.116 */117 unsigned nfree_zones;118 107 }; 119 108 -
uspace/srv/fs/mfs/mfs_balloc.c
rd2663d8 rcc8044e 88 88 { 89 89 int r = mfs_alloc_bit(inst, zone, BMAP_ZONE); 90 if (r != EOK)91 return r;92 93 /* Update the cached number of free zones */94 struct mfs_sb_info *sbi = inst->sbi;95 if (sbi->nfree_zones_valid)96 sbi->nfree_zones--;97 90 98 91 *zone += inst->sbi->firstdatazone - 1; … … 110 103 mfs_free_zone(struct mfs_instance *inst, uint32_t zone) 111 104 { 112 int r;113 114 105 zone -= inst->sbi->firstdatazone - 1; 115 106 116 r = mfs_free_bit(inst, zone, BMAP_ZONE); 117 if (r != EOK) 118 return r; 119 120 /* Update the cached number of free zones */ 121 struct mfs_sb_info *sbi = inst->sbi; 122 if (sbi->nfree_zones_valid) 123 sbi->nfree_zones++; 124 125 return r; 107 return mfs_free_bit(inst, zone, BMAP_ZONE); 126 108 } 127 109 -
uspace/srv/fs/mfs/mfs_ops.c
rd2663d8 rcc8044e 216 216 sbi->isearch = 0; 217 217 sbi->zsearch = 0; 218 sbi->nfree_zones_valid = false;219 sbi->nfree_zones = 0;220 218 221 219 if (version == MFS_VERSION_V3) { … … 1183 1181 return rc; 1184 1182 1185 struct mfs_sb_info *sbi = inst->sbi; 1186 1187 if (!sbi->nfree_zones_valid) { 1188 /* The cached number of free zones is not valid, 1189 * we need to scan the bitmap to retrieve the 1190 * current value. 1191 */ 1192 1193 rc = mfs_count_free_zones(inst, &block_free); 1194 if (rc != EOK) 1195 return rc; 1196 1197 sbi->nfree_zones = block_free; 1198 sbi->nfree_zones_valid = true; 1199 } 1200 1201 *count = sbi->nfree_zones; 1183 rc = mfs_count_free_zones(inst, &block_free); 1184 *count = block_free; 1202 1185 1203 1186 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.