Lines Matching refs:dm

68 static int lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen,  in lookup_zone()  argument
71 const unsigned int endbit = dm->dm_endbit; in lookup_zone()
73 unsigned char *map = dm->dm_bh->b_data; in lookup_zone()
74 unsigned int start = dm->dm_startbit; in lookup_zone()
115 scan_free_map(struct adfs_sb_info *asb, struct adfs_discmap *dm) in scan_free_map() argument
117 const unsigned int endbit = dm->dm_endbit; in scan_free_map()
121 unsigned char *map = dm->dm_bh->b_data; in scan_free_map()
163 struct adfs_discmap *dm, *dm_end; in scan_map() local
166 dm = asb->s_map + zone; in scan_map()
171 result = lookup_zone(dm, idlen, frag_id, &mapoff); in scan_map()
176 dm ++; in scan_map()
177 if (dm == dm_end) in scan_map()
178 dm = asb->s_map; in scan_map()
183 result -= dm->dm_startbit; in scan_map()
184 result += dm->dm_startblk; in scan_map()
200 struct adfs_discmap *dm; in adfs_map_statfs() local
204 dm = asb->s_map; in adfs_map_statfs()
208 total += scan_free_map(asb, dm++); in adfs_map_statfs()
284 static int adfs_checkmap(struct super_block *sb, struct adfs_discmap *dm) in adfs_checkmap() argument
292 map = dm[i].dm_bh->b_data; in adfs_checkmap()
309 static void adfs_map_layout(struct adfs_discmap *dm, unsigned int nzones, in adfs_map_layout() argument
317 dm[0].dm_bh = NULL; in adfs_map_layout()
318 dm[0].dm_startblk = 0; in adfs_map_layout()
319 dm[0].dm_startbit = 32 + ADFS_DR_SIZE_BITS; in adfs_map_layout()
320 dm[0].dm_endbit = 32 + zone_size; in adfs_map_layout()
323 dm[zone].dm_bh = NULL; in adfs_map_layout()
324 dm[zone].dm_startblk = zone * zone_size - ADFS_DR_SIZE_BITS; in adfs_map_layout()
325 dm[zone].dm_startbit = 32; in adfs_map_layout()
326 dm[zone].dm_endbit = 32 + zone_size; in adfs_map_layout()
331 dm[nzones - 1].dm_endbit = 32 + size; in adfs_map_layout()
334 static int adfs_map_read(struct adfs_discmap *dm, struct super_block *sb, in adfs_map_read() argument
340 dm[zone].dm_bh = sb_bread(sb, map_addr + zone); in adfs_map_read()
341 if (!dm[zone].dm_bh) in adfs_map_read()
348 static void adfs_map_relse(struct adfs_discmap *dm, unsigned int nzones) in adfs_map_relse() argument
353 brelse(dm[zone].dm_bh); in adfs_map_relse()
359 struct adfs_discmap *dm; in adfs_read_map() local
376 dm = kmalloc_array(nzones, sizeof(*dm), GFP_KERNEL); in adfs_read_map()
377 if (dm == NULL) { in adfs_read_map()
382 adfs_map_layout(dm, nzones, dr); in adfs_read_map()
384 ret = adfs_map_read(dm, sb, map_addr, nzones); in adfs_read_map()
390 if (adfs_checkmap(sb, dm)) in adfs_read_map()
391 return dm; in adfs_read_map()
396 adfs_map_relse(dm, nzones); in adfs_read_map()
397 kfree(dm); in adfs_read_map()