Changeset 1eaa3cf in mainline
- Timestamp:
- 2013-09-13T15:52:21Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eb40d86
- Parents:
- b5ba8f6
- Location:
- uspace/srv/fs/mfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs.h
rb5ba8f6 r1eaa3cf 44 44 #include <errno.h> 45 45 #include <assert.h> 46 #include <stdbool.h> 46 47 #include "../../vfs/vfs.h" 47 48 … … 105 106 unsigned isearch; 106 107 unsigned zsearch; 108 109 bool nfree_zones_valid; 110 unsigned nfree_zones; 107 111 }; 108 112 -
uspace/srv/fs/mfs/mfs_balloc.c
rb5ba8f6 r1eaa3cf 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--; 90 97 91 98 *zone += inst->sbi->firstdatazone - 1; … … 103 110 mfs_free_zone(struct mfs_instance *inst, uint32_t zone) 104 111 { 112 int r; 113 105 114 zone -= inst->sbi->firstdatazone - 1; 106 115 107 return mfs_free_bit(inst, zone, BMAP_ZONE); 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; 108 126 } 109 127 -
uspace/srv/fs/mfs/mfs_ops.c
rb5ba8f6 r1eaa3cf 216 216 sbi->isearch = 0; 217 217 sbi->zsearch = 0; 218 sbi->nfree_zones_valid = false; 219 sbi->nfree_zones = 0; 218 220 219 221 if (version == MFS_VERSION_V3) { … … 1181 1183 return rc; 1182 1184 1183 if (NULL == inst) 1184 return ENOENT; 1185 1186 mfs_count_free_zones(inst, &block_free); 1187 *count = block_free; 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; 1188 1202 1189 1203 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.