Lines Matching refs:sec
11 static void hpfs_claim_alloc(struct super_block *s, secno sec) in hpfs_claim_alloc() argument
16 hpfs_error(s, "free count underflow, allocating sector %08x", sec); in hpfs_claim_alloc()
24 static void hpfs_claim_free(struct super_block *s, secno sec) in hpfs_claim_free() argument
29 hpfs_error(s, "free count overflow, freeing sector %08x", sec); in hpfs_claim_free()
37 static void hpfs_claim_dirband_alloc(struct super_block *s, secno sec) in hpfs_claim_dirband_alloc() argument
42 hpfs_error(s, "dirband free count underflow, allocating sector %08x", sec); in hpfs_claim_dirband_alloc()
50 static void hpfs_claim_dirband_free(struct super_block *s, secno sec) in hpfs_claim_dirband_free() argument
55 hpfs_error(s, "dirband free count overflow, freeing sector %08x", sec); in hpfs_claim_dirband_free()
68 static int chk_if_allocated(struct super_block *s, secno sec, char *msg) in chk_if_allocated() argument
72 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; in chk_if_allocated()
73 if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) { in chk_if_allocated()
74 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); in chk_if_allocated()
78 …if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dir… in chk_if_allocated()
79 unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4; in chk_if_allocated()
82 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); in chk_if_allocated()
204 secno sec; in hpfs_alloc_sector() local
216 if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret; in hpfs_alloc_sector()
230 if (near_bmp+i < n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i) << 14, n, forward)))) { in hpfs_alloc_sector()
235 if (near_bmp-i-1 >= 0 && ((sec = alloc_in_bmp(s, (near_bmp-i-1) << 14, n, forward)))) { in hpfs_alloc_sector()
240 if (near_bmp+i >= n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i-n_bmps) << 14, n, forward)))) { in hpfs_alloc_sector()
245 …if (i == 1 && sbi->sb_c_bitmap != -1 && ((sec = alloc_in_bmp(s, (sbi->sb_c_bitmap) << 14, n, forwa… in hpfs_alloc_sector()
256 sec = 0; in hpfs_alloc_sector()
258 if (sec) { in hpfs_alloc_sector()
261 hpfs_claim_alloc(s, sec + i); in hpfs_alloc_sector()
264 if (sec && f_p) { in hpfs_alloc_sector()
266 if (!hpfs_alloc_if_possible(s, sec + n + i)) { in hpfs_alloc_sector()
267 …rror(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i); in hpfs_alloc_sector()
268 sec = 0; in hpfs_alloc_sector()
273 return sec; in hpfs_alloc_sector()
279 secno sec; in alloc_in_dirband() local
287 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); in alloc_in_dirband()
288 if (!sec) return 0; in alloc_in_dirband()
289 hpfs_claim_dirband_alloc(s, sec); in alloc_in_dirband()
290 return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start; in alloc_in_dirband()
295 int hpfs_alloc_if_possible(struct super_block *s, secno sec) in hpfs_alloc_if_possible() argument
299 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; in hpfs_alloc_if_possible()
300 if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) { in hpfs_alloc_if_possible()
301 bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f))); in hpfs_alloc_if_possible()
304 hpfs_claim_alloc(s, sec); in hpfs_alloc_if_possible()
314 void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) in hpfs_free_sectors() argument
321 if (sec < 0x12) { in hpfs_free_sectors()
322 hpfs_error(s, "Trying to free reserved sector %08x", sec); in hpfs_free_sectors()
328 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) { in hpfs_free_sectors()
332 if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f) & 1)) { in hpfs_free_sectors()
333 hpfs_error(s, "sector %08x not allocated", sec); in hpfs_free_sectors()
337 bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f)); in hpfs_free_sectors()
338 hpfs_claim_free(s, sec); in hpfs_free_sectors()
344 if (!(++sec & 0x3fff)) { in hpfs_free_sectors()