Lines Matching refs:s
16 static int chk_if_allocated(struct super_block *s, secno sec, char *msg) in chk_if_allocated() argument
20 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; in chk_if_allocated()
22 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); in chk_if_allocated()
26 …if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dir… in chk_if_allocated()
27 unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4; in chk_if_allocated()
28 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail; in chk_if_allocated()
30 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); in chk_if_allocated()
47 int hpfs_chk_sectors(struct super_block *s, secno start, int len, char *msg) in hpfs_chk_sectors() argument
50 start + len > hpfs_sb(s)->sb_fs_size) { in hpfs_chk_sectors()
51 hpfs_error(s, "sector(s) '%s' badly placed at %08x", msg, start); in hpfs_chk_sectors()
54 if (hpfs_sb(s)->sb_chk>=2) { in hpfs_chk_sectors()
57 if (chk_if_allocated(s, start + i, msg)) return 1; in hpfs_chk_sectors()
62 static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigned forward) in alloc_in_bmp() argument
73 hpfs_error(s, "Bad allocation size: %d", n); in alloc_in_bmp()
77 if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls; in alloc_in_bmp()
79 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto uls; in alloc_in_bmp()
128 …if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (le32_to_cpu(bmp[(ret & 0x3fff) >> 5]) | ~… in alloc_in_bmp()
129 hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret); in alloc_in_bmp()
150 secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward) in hpfs_alloc_sector() argument
155 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_alloc_sector()
164 if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret; in hpfs_alloc_sector()
178 if (near_bmp+i < n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i) << 14, n, forward)))) { in hpfs_alloc_sector()
183 if (near_bmp-i-1 >= 0 && ((sec = alloc_in_bmp(s, (near_bmp-i-1) << 14, n, forward)))) { in hpfs_alloc_sector()
188 if (near_bmp+i >= n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i-n_bmps) << 14, n, forward)))) { in hpfs_alloc_sector()
193 …if (i == 1 && sbi->sb_c_bitmap != -1 && ((sec = alloc_in_bmp(s, (sbi->sb_c_bitmap) << 14, n, forwa… in hpfs_alloc_sector()
208 if (!hpfs_alloc_if_possible(s, sec + i + 1)) { in hpfs_alloc_sector()
209 …hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, s… in hpfs_alloc_sector()
218 static secno alloc_in_dirband(struct super_block *s, secno near) in alloc_in_dirband() argument
222 struct hpfs_sb_info *sbi = hpfs_sb(s); in alloc_in_dirband()
229 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); in alloc_in_dirband()
236 int hpfs_alloc_if_possible(struct super_block *s, secno sec) in hpfs_alloc_if_possible() argument
240 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; in hpfs_alloc_if_possible()
254 void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) in hpfs_free_sectors() argument
258 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_free_sectors()
262 hpfs_error(s, "Trying to free reserved sector %08x", sec); in hpfs_free_sectors()
268 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) { in hpfs_free_sectors()
273 hpfs_error(s, "sector %08x not allocated", sec); in hpfs_free_sectors()
297 int hpfs_check_free_dnodes(struct super_block *s, int n) in hpfs_check_free_dnodes() argument
299 int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; in hpfs_check_free_dnodes()
300 int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; in hpfs_check_free_dnodes()
304 if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { in hpfs_check_free_dnodes()
316 if (hpfs_sb(s)->sb_c_bitmap != -1) { in hpfs_check_free_dnodes()
317 bmp = hpfs_map_bitmap(s, b, &qbh, "chkdn1"); in hpfs_check_free_dnodes()
323 bmp = hpfs_map_bitmap(s, i, &qbh, "chkdn2"); in hpfs_check_free_dnodes()
343 void hpfs_free_dnode(struct super_block *s, dnode_secno dno) in hpfs_free_dnode() argument
345 if (hpfs_sb(s)->sb_chk) if (dno & 3) { in hpfs_free_dnode()
346 hpfs_error(s, "hpfs_free_dnode: dnode %08x not aligned", dno); in hpfs_free_dnode()
349 if (dno < hpfs_sb(s)->sb_dirband_start || in hpfs_free_dnode()
350 dno >= hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) { in hpfs_free_dnode()
351 hpfs_free_sectors(s, dno, 4); in hpfs_free_dnode()
355 unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; in hpfs_free_dnode()
356 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { in hpfs_free_dnode()
365 struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near, in hpfs_alloc_dnode() argument
369 if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) { in hpfs_alloc_dnode()
370 if (!(*dno = alloc_in_dirband(s, near))) in hpfs_alloc_dnode()
371 if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL; in hpfs_alloc_dnode()
373 if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) in hpfs_alloc_dnode()
374 if (!(*dno = alloc_in_dirband(s, near))) return NULL; in hpfs_alloc_dnode()
376 if (!(d = hpfs_get_4sectors(s, *dno, qbh))) { in hpfs_alloc_dnode()
377 hpfs_free_dnode(s, *dno); in hpfs_alloc_dnode()
391 struct fnode *hpfs_alloc_fnode(struct super_block *s, secno near, fnode_secno *fno, in hpfs_alloc_fnode() argument
395 if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD))) return NULL; in hpfs_alloc_fnode()
396 if (!(f = hpfs_get_sector(s, *fno, bh))) { in hpfs_alloc_fnode()
397 hpfs_free_sectors(s, *fno, 1); in hpfs_alloc_fnode()
408 struct anode *hpfs_alloc_anode(struct super_block *s, secno near, anode_secno *ano, in hpfs_alloc_anode() argument
412 if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD))) return NULL; in hpfs_alloc_anode()
413 if (!(a = hpfs_get_sector(s, *ano, bh))) { in hpfs_alloc_anode()
414 hpfs_free_sectors(s, *ano, 1); in hpfs_alloc_anode()