Lines Matching refs:sec

12 static void hpfs_claim_alloc(struct super_block *s, secno sec)  in hpfs_claim_alloc()  argument
17 hpfs_error(s, "free count underflow, allocating sector %08x", sec); in hpfs_claim_alloc()
25 static void hpfs_claim_free(struct super_block *s, secno sec) in hpfs_claim_free() argument
30 hpfs_error(s, "free count overflow, freeing sector %08x", sec); in hpfs_claim_free()
38 static void hpfs_claim_dirband_alloc(struct super_block *s, secno sec) in hpfs_claim_dirband_alloc() argument
43 hpfs_error(s, "dirband free count underflow, allocating sector %08x", sec); in hpfs_claim_dirband_alloc()
51 static void hpfs_claim_dirband_free(struct super_block *s, secno sec) in hpfs_claim_dirband_free() argument
56 hpfs_error(s, "dirband free count overflow, freeing sector %08x", sec); in hpfs_claim_dirband_free()
69 static int chk_if_allocated(struct super_block *s, secno sec, char *msg) in chk_if_allocated() argument
73 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; in chk_if_allocated()
74 if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) { in chk_if_allocated()
75 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); in chk_if_allocated()
79 …if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dir… in chk_if_allocated()
80 unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4; in chk_if_allocated()
83 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); in chk_if_allocated()
205 secno sec; in hpfs_alloc_sector() local
217 if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret; in hpfs_alloc_sector()
231 if (near_bmp+i < n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i) << 14, n, forward)))) { in hpfs_alloc_sector()
236 if (near_bmp-i-1 >= 0 && ((sec = alloc_in_bmp(s, (near_bmp-i-1) << 14, n, forward)))) { in hpfs_alloc_sector()
241 if (near_bmp+i >= n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i-n_bmps) << 14, n, forward)))) { in hpfs_alloc_sector()
246 …if (i == 1 && sbi->sb_c_bitmap != -1 && ((sec = alloc_in_bmp(s, (sbi->sb_c_bitmap) << 14, n, forwa… in hpfs_alloc_sector()
257 sec = 0; in hpfs_alloc_sector()
259 if (sec) { in hpfs_alloc_sector()
262 hpfs_claim_alloc(s, sec + i); in hpfs_alloc_sector()
265 if (sec && f_p) { in hpfs_alloc_sector()
267 if (!hpfs_alloc_if_possible(s, sec + n + i)) { in hpfs_alloc_sector()
268 …rror(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i); in hpfs_alloc_sector()
269 sec = 0; in hpfs_alloc_sector()
274 return sec; in hpfs_alloc_sector()
280 secno sec; in alloc_in_dirband() local
288 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); in alloc_in_dirband()
289 if (!sec) return 0; in alloc_in_dirband()
290 hpfs_claim_dirband_alloc(s, sec); in alloc_in_dirband()
291 return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start; in alloc_in_dirband()
296 int hpfs_alloc_if_possible(struct super_block *s, secno sec) in hpfs_alloc_if_possible() argument
300 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; in hpfs_alloc_if_possible()
301 if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) { in hpfs_alloc_if_possible()
302 bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f))); in hpfs_alloc_if_possible()
305 hpfs_claim_alloc(s, sec); in hpfs_alloc_if_possible()
315 void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) in hpfs_free_sectors() argument
322 if (sec < 0x12) { in hpfs_free_sectors()
323 hpfs_error(s, "Trying to free reserved sector %08x", sec); in hpfs_free_sectors()
329 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) { in hpfs_free_sectors()
333 if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f) & 1)) { in hpfs_free_sectors()
334 hpfs_error(s, "sector %08x not allocated", sec); in hpfs_free_sectors()
338 bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f)); in hpfs_free_sectors()
339 hpfs_claim_free(s, sec); in hpfs_free_sectors()
345 if (!(++sec & 0x3fff)) { in hpfs_free_sectors()