• Home
  • Raw
  • Download

Lines Matching refs:s

12 static void hpfs_claim_alloc(struct super_block *s, secno sec)  in hpfs_claim_alloc()  argument
14 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_claim_alloc()
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
27 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_claim_free()
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
40 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_claim_dirband_alloc()
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
53 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_claim_dirband_free()
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()
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()
81 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail; in chk_if_allocated()
83 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); in chk_if_allocated()
100 int hpfs_chk_sectors(struct super_block *s, secno start, int len, char *msg) in hpfs_chk_sectors() argument
103 start + len > hpfs_sb(s)->sb_fs_size) { in hpfs_chk_sectors()
104 hpfs_error(s, "sector(s) '%s' badly placed at %08x", msg, start); in hpfs_chk_sectors()
107 if (hpfs_sb(s)->sb_chk>=2) { in hpfs_chk_sectors()
110 if (chk_if_allocated(s, start + i, msg)) return 1; in hpfs_chk_sectors()
115 static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigned forward) in alloc_in_bmp() argument
126 hpfs_error(s, "Bad allocation size: %d", n); in alloc_in_bmp()
130 if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls; in alloc_in_bmp()
132 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto uls; in alloc_in_bmp()
181 …if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (le32_to_cpu(bmp[(ret & 0x3fff) >> 5]) | ~… in alloc_in_bmp()
182 hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret); in alloc_in_bmp()
203 secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward) in hpfs_alloc_sector() argument
208 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_alloc_sector()
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()
262 hpfs_claim_alloc(s, sec + i); in hpfs_alloc_sector()
267 if (!hpfs_alloc_if_possible(s, sec + n + i)) { in hpfs_alloc_sector()
268 …hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, s… in hpfs_alloc_sector()
277 static secno alloc_in_dirband(struct super_block *s, secno near) in alloc_in_dirband() argument
281 struct hpfs_sb_info *sbi = hpfs_sb(s); in alloc_in_dirband()
288 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); in alloc_in_dirband()
290 hpfs_claim_dirband_alloc(s, sec); 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()
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
319 struct hpfs_sb_info *sbi = hpfs_sb(s); 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()
334 hpfs_error(s, "sector %08x not allocated", sec); in hpfs_free_sectors()
339 hpfs_claim_free(s, sec); in hpfs_free_sectors()
359 int hpfs_check_free_dnodes(struct super_block *s, int n) in hpfs_check_free_dnodes() argument
361 int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; in hpfs_check_free_dnodes()
362 int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; in hpfs_check_free_dnodes()
366 if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { in hpfs_check_free_dnodes()
378 if (hpfs_sb(s)->sb_c_bitmap != -1) { in hpfs_check_free_dnodes()
379 bmp = hpfs_map_bitmap(s, b, &qbh, "chkdn1"); in hpfs_check_free_dnodes()
385 bmp = hpfs_map_bitmap(s, i, &qbh, "chkdn2"); in hpfs_check_free_dnodes()
405 void hpfs_free_dnode(struct super_block *s, dnode_secno dno) in hpfs_free_dnode() argument
407 if (hpfs_sb(s)->sb_chk) if (dno & 3) { in hpfs_free_dnode()
408 hpfs_error(s, "hpfs_free_dnode: dnode %08x not aligned", dno); in hpfs_free_dnode()
411 if (dno < hpfs_sb(s)->sb_dirband_start || in hpfs_free_dnode()
412 dno >= hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) { in hpfs_free_dnode()
413 hpfs_free_sectors(s, dno, 4); in hpfs_free_dnode()
417 unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; in hpfs_free_dnode()
418 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { in hpfs_free_dnode()
424 hpfs_claim_dirband_free(s, dno); in hpfs_free_dnode()
428 struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near, in hpfs_alloc_dnode() argument
432 if (hpfs_get_free_dnodes(s) > FREE_DNODES_ADD) { in hpfs_alloc_dnode()
433 if (!(*dno = alloc_in_dirband(s, near))) in hpfs_alloc_dnode()
434 if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL; in hpfs_alloc_dnode()
436 if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) in hpfs_alloc_dnode()
437 if (!(*dno = alloc_in_dirband(s, near))) return NULL; in hpfs_alloc_dnode()
439 if (!(d = hpfs_get_4sectors(s, *dno, qbh))) { in hpfs_alloc_dnode()
440 hpfs_free_dnode(s, *dno); in hpfs_alloc_dnode()
454 struct fnode *hpfs_alloc_fnode(struct super_block *s, secno near, fnode_secno *fno, in hpfs_alloc_fnode() argument
458 if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD))) return NULL; in hpfs_alloc_fnode()
459 if (!(f = hpfs_get_sector(s, *fno, bh))) { in hpfs_alloc_fnode()
460 hpfs_free_sectors(s, *fno, 1); in hpfs_alloc_fnode()
471 struct anode *hpfs_alloc_anode(struct super_block *s, secno near, anode_secno *ano, in hpfs_alloc_anode() argument
475 if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD))) return NULL; in hpfs_alloc_anode()
476 if (!(a = hpfs_get_sector(s, *ano, bh))) { in hpfs_alloc_anode()
477 hpfs_free_sectors(s, *ano, 1); in hpfs_alloc_anode()
503 static int do_trim(struct super_block *s, secno start, unsigned len, secno limit_start, secno limit… in do_trim() argument
518 err = sb_issue_discard(s, start, end - start, GFP_NOFS, 0); in do_trim()
525 int hpfs_trim_fs(struct super_block *s, u64 start, u64 end, u64 minlen, unsigned *result) in hpfs_trim_fs() argument
528 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_trim_fs()
541 hpfs_lock(s); in hpfs_trim_fs()
542 if (sb_rdonly(s)) { in hpfs_trim_fs()
546 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { in hpfs_trim_fs()
552 err = do_trim(s, sbi->sb_dirband_start + idx * 4, len * 4, start, end, minlen, result); in hpfs_trim_fs()
557 hpfs_unlock(s); in hpfs_trim_fs()
562 hpfs_lock(s); in hpfs_trim_fs()
563 if (sb_rdonly(s)) { in hpfs_trim_fs()
567 if (!(bmp = hpfs_map_bitmap(s, start_bmp, &qbh, "trim"))) { in hpfs_trim_fs()
573 err = do_trim(s, (start_bmp << 14) + idx, len, start, end, minlen, result); in hpfs_trim_fs()
578 hpfs_unlock(s); in hpfs_trim_fs()