• Home
  • Raw
  • Download

Lines Matching refs:s

11 static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec);
18 static int chk_if_allocated(struct super_block *s, secno sec, char *msg) in chk_if_allocated() argument
22 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; in chk_if_allocated()
24 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); in chk_if_allocated()
28 …if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dir… in chk_if_allocated()
29 unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4; in chk_if_allocated()
30 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail; in chk_if_allocated()
32 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); in chk_if_allocated()
49 int hpfs_chk_sectors(struct super_block *s, secno start, int len, char *msg) in hpfs_chk_sectors() argument
52 start + len > hpfs_sb(s)->sb_fs_size) { in hpfs_chk_sectors()
53 hpfs_error(s, "sector(s) '%s' badly placed at %08x", msg, start); in hpfs_chk_sectors()
56 if (hpfs_sb(s)->sb_chk>=2) { in hpfs_chk_sectors()
59 if (chk_if_allocated(s, start + i, msg)) return 1; in hpfs_chk_sectors()
64 static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigned forward) in alloc_in_bmp() argument
75 hpfs_error(s, "Bad allocation size: %d", n); in alloc_in_bmp()
78 lock_super(s); in alloc_in_bmp()
80 if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls; in alloc_in_bmp()
82 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto uls; in alloc_in_bmp()
135 …if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (bmp[(ret & 0x3fff) >> 5] | ~(((1 << n) - … in alloc_in_bmp()
136 hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret); in alloc_in_bmp()
146 unlock_super(s); in alloc_in_bmp()
158 secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward, int lock) in hpfs_alloc_sector() argument
163 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_alloc_sector()
170 if (lock) hpfs_lock_creation(s); in hpfs_alloc_sector()
173 if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret; in hpfs_alloc_sector()
187 if (near_bmp+i < n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i) << 14, n, forward)))) { in hpfs_alloc_sector()
192 if (near_bmp-i-1 >= 0 && ((sec = alloc_in_bmp(s, (near_bmp-i-1) << 14, n, forward)))) { in hpfs_alloc_sector()
197 if (near_bmp+i >= n_bmps && ((sec = alloc_in_bmp(s, (near_bmp+i-n_bmps) << 14, n, forward)))) { in hpfs_alloc_sector()
202 …if (i == 1 && sbi->sb_c_bitmap != -1 && ((sec = alloc_in_bmp(s, (sbi->sb_c_bitmap) << 14, n, forwa… in hpfs_alloc_sector()
217 if (!hpfs_alloc_if_possible_nolock(s, sec + i + 1)) { in hpfs_alloc_sector()
218 …hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, s… in hpfs_alloc_sector()
224 if (lock) hpfs_unlock_creation(s); in hpfs_alloc_sector()
228 static secno alloc_in_dirband(struct super_block *s, secno near, int lock) in alloc_in_dirband() argument
232 struct hpfs_sb_info *sbi = hpfs_sb(s); in alloc_in_dirband()
239 if (lock) hpfs_lock_creation(s); in alloc_in_dirband()
240 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); in alloc_in_dirband()
241 if (lock) hpfs_unlock_creation(s); in alloc_in_dirband()
248 static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec) in hpfs_alloc_if_possible_nolock() argument
252 lock_super(s); in hpfs_alloc_if_possible_nolock()
253 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; in hpfs_alloc_if_possible_nolock()
258 unlock_super(s); in hpfs_alloc_if_possible_nolock()
263 unlock_super(s); in hpfs_alloc_if_possible_nolock()
267 int hpfs_alloc_if_possible(struct super_block *s, secno sec) in hpfs_alloc_if_possible() argument
270 hpfs_lock_creation(s); in hpfs_alloc_if_possible()
271 r = hpfs_alloc_if_possible_nolock(s, sec); in hpfs_alloc_if_possible()
272 hpfs_unlock_creation(s); in hpfs_alloc_if_possible()
278 void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) in hpfs_free_sectors() argument
282 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_free_sectors()
286 hpfs_error(s, "Trying to free reserved sector %08x", sec); in hpfs_free_sectors()
289 lock_super(s); in hpfs_free_sectors()
293 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) { in hpfs_free_sectors()
294 unlock_super(s); in hpfs_free_sectors()
299 hpfs_error(s, "sector %08x not allocated", sec); in hpfs_free_sectors()
301 unlock_super(s); in hpfs_free_sectors()
308 unlock_super(s); in hpfs_free_sectors()
325 int hpfs_check_free_dnodes(struct super_block *s, int n) in hpfs_check_free_dnodes() argument
327 int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; in hpfs_check_free_dnodes()
328 int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; in hpfs_check_free_dnodes()
332 if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { in hpfs_check_free_dnodes()
344 if (hpfs_sb(s)->sb_c_bitmap != -1) { in hpfs_check_free_dnodes()
345 bmp = hpfs_map_bitmap(s, b, &qbh, "chkdn1"); in hpfs_check_free_dnodes()
351 bmp = hpfs_map_bitmap(s, i, &qbh, "chkdn2"); in hpfs_check_free_dnodes()
371 void hpfs_free_dnode(struct super_block *s, dnode_secno dno) in hpfs_free_dnode() argument
373 if (hpfs_sb(s)->sb_chk) if (dno & 3) { in hpfs_free_dnode()
374 hpfs_error(s, "hpfs_free_dnode: dnode %08x not aligned", dno); in hpfs_free_dnode()
377 if (dno < hpfs_sb(s)->sb_dirband_start || in hpfs_free_dnode()
378 dno >= hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) { in hpfs_free_dnode()
379 hpfs_free_sectors(s, dno, 4); in hpfs_free_dnode()
383 unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; in hpfs_free_dnode()
384 lock_super(s); in hpfs_free_dnode()
385 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { in hpfs_free_dnode()
386 unlock_super(s); in hpfs_free_dnode()
392 unlock_super(s); in hpfs_free_dnode()
396 struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near, in hpfs_alloc_dnode() argument
401 if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) { in hpfs_alloc_dnode()
402 if (!(*dno = alloc_in_dirband(s, near, lock))) in hpfs_alloc_dnode()
403 if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) return NULL; in hpfs_alloc_dnode()
405 if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) in hpfs_alloc_dnode()
406 if (!(*dno = alloc_in_dirband(s, near, lock))) return NULL; in hpfs_alloc_dnode()
408 if (!(d = hpfs_get_4sectors(s, *dno, qbh))) { in hpfs_alloc_dnode()
409 hpfs_free_dnode(s, *dno); in hpfs_alloc_dnode()
423 struct fnode *hpfs_alloc_fnode(struct super_block *s, secno near, fnode_secno *fno, in hpfs_alloc_fnode() argument
427 if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD, 1))) return NULL; in hpfs_alloc_fnode()
428 if (!(f = hpfs_get_sector(s, *fno, bh))) { in hpfs_alloc_fnode()
429 hpfs_free_sectors(s, *fno, 1); in hpfs_alloc_fnode()
440 struct anode *hpfs_alloc_anode(struct super_block *s, secno near, anode_secno *ano, in hpfs_alloc_anode() argument
444 if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD, 1))) return NULL; in hpfs_alloc_anode()
445 if (!(a = hpfs_get_sector(s, *ano, bh))) { in hpfs_alloc_anode()
446 hpfs_free_sectors(s, *ano, 1); in hpfs_alloc_anode()