static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf) { struct super_block *s = dentry->d_sb; struct hpfs_sb_info *sbi = hpfs_sb(s); u64 id = huge_encode_dev(s->s_bdev->bd_dev); hpfs_lock(s); /*if (sbi->sb_n_free == -1) {*/ sbi->sb_n_free = count_bitmaps(s); sbi->sb_n_free_dnodes = hpfs_count_one_bitmap(s, sbi->sb_dmap); /*}*/ buf->f_type = s->s_magic; buf->f_bsize = 512; buf->f_blocks = sbi->sb_fs_size; buf->f_bfree = sbi->sb_n_free; buf->f_bavail = sbi->sb_n_free; buf->f_files = sbi->sb_dirband_size / 4; buf->f_ffree = sbi->sb_n_free_dnodes; buf->f_fsid.val[0] = (u32)id; buf->f_fsid.val[1] = (u32)(id >> 32); buf->f_namelen = 254; hpfs_unlock(s); return 0; }
static unsigned count_bitmaps(struct super_block *s) { unsigned n, count, n_bands; n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; count = 0; for (n = 0; n < n_bands; n++) count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); return count; }
static unsigned count_bitmaps(struct super_block *s) { unsigned n, count, n_bands; n_bands = (s->s_hpfs_fs_size + 0x3fff) >> 14; count = 0; for (n = 0; n < n_bands; n++) count += hpfs_count_one_bitmap(s, s->s_hpfs_bmp_dir[n]); return count; }
unsigned hpfs_get_free_dnodes(struct super_block *s) { struct hpfs_sb_info *sbi = hpfs_sb(s); if (sbi->sb_n_free_dnodes == (unsigned)-1) { unsigned c = hpfs_count_one_bitmap(s, sbi->sb_dmap); if (c == (unsigned)-1) return 0; sbi->sb_n_free_dnodes = c; } return sbi->sb_n_free_dnodes; }
int hpfs_statfs(struct super_block *s, struct statfs *buf) { /*if (s->s_hpfs_n_free == -1) {*/ s->s_hpfs_n_free = count_bitmaps(s); s->s_hpfs_n_free_dnodes = hpfs_count_one_bitmap(s, s->s_hpfs_dmap); /*}*/ buf->f_type = s->s_magic; buf->f_bsize = 512; buf->f_blocks = s->s_hpfs_fs_size; buf->f_bfree = s->s_hpfs_n_free; buf->f_bavail = s->s_hpfs_n_free; buf->f_files = s->s_hpfs_dirband_size / 4; buf->f_ffree = s->s_hpfs_n_free_dnodes; buf->f_namelen = 254; return 0; }
static unsigned count_bitmaps(struct super_block *s) { unsigned n, count, n_bands; n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; count = 0; for (n = 0; n < COUNT_RD_AHEAD; n++) { hpfs_prefetch_bitmap(s, n); } for (n = 0; n < n_bands; n++) { unsigned c; hpfs_prefetch_bitmap(s, n + COUNT_RD_AHEAD); c = hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); if (c != (unsigned)-1) count += c; } return count; }
static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf) { struct super_block *s = dentry->d_sb; struct hpfs_sb_info *sbi = hpfs_sb(s); lock_kernel(); /*if (sbi->sb_n_free == -1) {*/ sbi->sb_n_free = count_bitmaps(s); sbi->sb_n_free_dnodes = hpfs_count_one_bitmap(s, sbi->sb_dmap); /*}*/ buf->f_type = s->s_magic; buf->f_bsize = 512; buf->f_blocks = sbi->sb_fs_size; buf->f_bfree = sbi->sb_n_free; buf->f_bavail = sbi->sb_n_free; buf->f_files = sbi->sb_dirband_size / 4; buf->f_ffree = sbi->sb_n_free_dnodes; buf->f_namelen = 254; unlock_kernel(); return 0; }