Changes in uspace/srv/fs/mfs/mfs_ops.c [1ba6651:fc22069] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
r1ba6651 rfc22069 64 64 static int mfs_check_sanity(struct mfs_sb_info *sbi); 65 65 static bool is_power_of_two(uint32_t n); 66 static int mfs_size_block(service_id_t service_id, uint32_t *size); 67 static int mfs_total_block_count(service_id_t service_id, uint64_t *count); 68 static int mfs_free_block_count(service_id_t service_id, uint64_t *count); 66 69 67 70 static hash_table_t open_nodes; … … 84 87 .destroy = mfs_destroy_node, 85 88 .has_children = mfs_has_children, 86 .lnkcnt_get = mfs_lnkcnt_get 89 .lnkcnt_get = mfs_lnkcnt_get, 90 .size_block = mfs_size_block, 91 .total_block_count = mfs_total_block_count, 92 .free_block_count = mfs_free_block_count 87 93 }; 88 94 … … 155 161 156 162 /* initialize libblock */ 157 rc = block_init( EXCHANGE_SERIALIZE,service_id, 4096);163 rc = block_init(service_id, 4096); 158 164 if (rc != EOK) 159 165 return rc; … … 210 216 sbi->isearch = 0; 211 217 sbi->zsearch = 0; 218 sbi->nfree_zones_valid = false; 219 sbi->nfree_zones = 0; 212 220 213 221 if (version == MFS_VERSION_V3) { … … 1129 1137 } 1130 1138 1139 static int 1140 mfs_size_block(service_id_t service_id, uint32_t *size) 1141 { 1142 struct mfs_instance *inst; 1143 int rc; 1144 1145 rc = mfs_instance_get(service_id, &inst); 1146 if (rc != EOK) 1147 return rc; 1148 1149 if (NULL == inst) 1150 return ENOENT; 1151 1152 *size = inst->sbi->block_size; 1153 1154 return EOK; 1155 } 1156 1157 static int 1158 mfs_total_block_count(service_id_t service_id, uint64_t *count) 1159 { 1160 struct mfs_instance *inst; 1161 int rc; 1162 1163 rc = mfs_instance_get(service_id, &inst); 1164 if (rc != EOK) 1165 return rc; 1166 1167 if (NULL == inst) 1168 return ENOENT; 1169 1170 *count = (uint64_t) MFS_BMAP_SIZE_BITS(inst->sbi, BMAP_ZONE); 1171 1172 return EOK; 1173 } 1174 1175 static int 1176 mfs_free_block_count(service_id_t service_id, uint64_t *count) 1177 { 1178 uint32_t block_free; 1179 1180 struct mfs_instance *inst; 1181 int rc = mfs_instance_get(service_id, &inst); 1182 if (rc != EOK) 1183 return rc; 1184 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; 1202 1203 return rc; 1204 } 1205 1131 1206 vfs_out_ops_t mfs_ops = { 1132 1207 .mounted = mfs_mounted,
Note:
See TracChangeset
for help on using the changeset viewer.