Lines Matching refs:sbinfo
201 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_reserve_inode() local
202 if (sbinfo->max_inodes) { in shmem_reserve_inode()
203 spin_lock(&sbinfo->stat_lock); in shmem_reserve_inode()
204 if (!sbinfo->free_inodes) { in shmem_reserve_inode()
205 spin_unlock(&sbinfo->stat_lock); in shmem_reserve_inode()
208 sbinfo->free_inodes--; in shmem_reserve_inode()
209 spin_unlock(&sbinfo->stat_lock); in shmem_reserve_inode()
216 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_free_inode() local
217 if (sbinfo->max_inodes) { in shmem_free_inode()
218 spin_lock(&sbinfo->stat_lock); in shmem_free_inode()
219 sbinfo->free_inodes++; in shmem_free_inode()
220 spin_unlock(&sbinfo->stat_lock); in shmem_free_inode()
243 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); in shmem_recalc_inode() local
244 if (sbinfo->max_blocks) in shmem_recalc_inode()
245 percpu_counter_add(&sbinfo->used_blocks, -freed); in shmem_recalc_inode()
883 static struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo) in shmem_get_sbmpol() argument
886 if (sbinfo->mpol) { in shmem_get_sbmpol()
887 spin_lock(&sbinfo->stat_lock); /* prevent replace/use races */ in shmem_get_sbmpol()
888 mpol = sbinfo->mpol; in shmem_get_sbmpol()
890 spin_unlock(&sbinfo->stat_lock); in shmem_get_sbmpol()
958 static inline struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo) in shmem_get_sbmpol() argument
1059 struct shmem_sb_info *sbinfo; in shmem_getpage_gfp() local
1104 sbinfo = SHMEM_SB(inode->i_sb); in shmem_getpage_gfp()
1182 if (sbinfo->max_blocks) { in shmem_getpage_gfp()
1183 if (percpu_counter_compare(&sbinfo->used_blocks, in shmem_getpage_gfp()
1184 sbinfo->max_blocks) >= 0) { in shmem_getpage_gfp()
1188 percpu_counter_inc(&sbinfo->used_blocks); in shmem_getpage_gfp()
1265 if (sbinfo->max_blocks) in shmem_getpage_gfp()
1266 percpu_counter_add(&sbinfo->used_blocks, -1); in shmem_getpage_gfp()
1419 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_get_inode() local
1450 shmem_get_sbmpol(sbinfo)); in shmem_get_inode()
2069 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); in shmem_fallocate() local
2126 if (sbinfo->max_blocks && end - start > sbinfo->max_blocks) { in shmem_fallocate()
2197 struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb); in shmem_statfs() local
2202 if (sbinfo->max_blocks) { in shmem_statfs()
2203 buf->f_blocks = sbinfo->max_blocks; in shmem_statfs()
2205 buf->f_bfree = sbinfo->max_blocks - in shmem_statfs()
2206 percpu_counter_sum(&sbinfo->used_blocks); in shmem_statfs()
2208 if (sbinfo->max_inodes) { in shmem_statfs()
2209 buf->f_files = sbinfo->max_inodes; in shmem_statfs()
2210 buf->f_ffree = sbinfo->free_inodes; in shmem_statfs()
2747 static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, in shmem_parse_options() argument
2794 sbinfo->max_blocks = in shmem_parse_options()
2797 sbinfo->max_blocks = memparse(value, &rest); in shmem_parse_options()
2801 sbinfo->max_inodes = memparse(value, &rest); in shmem_parse_options()
2807 sbinfo->mode = simple_strtoul(value, &rest, 8) & 07777; in shmem_parse_options()
2816 sbinfo->uid = make_kuid(current_user_ns(), uid); in shmem_parse_options()
2817 if (!uid_valid(sbinfo->uid)) in shmem_parse_options()
2825 sbinfo->gid = make_kgid(current_user_ns(), gid); in shmem_parse_options()
2826 if (!gid_valid(sbinfo->gid)) in shmem_parse_options()
2839 sbinfo->mpol = mpol; in shmem_parse_options()
2853 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_remount_fs() local
2854 struct shmem_sb_info config = *sbinfo; in shmem_remount_fs()
2862 spin_lock(&sbinfo->stat_lock); in shmem_remount_fs()
2863 inodes = sbinfo->max_inodes - sbinfo->free_inodes; in shmem_remount_fs()
2864 if (percpu_counter_compare(&sbinfo->used_blocks, config.max_blocks) > 0) in shmem_remount_fs()
2873 if (config.max_blocks && !sbinfo->max_blocks) in shmem_remount_fs()
2875 if (config.max_inodes && !sbinfo->max_inodes) in shmem_remount_fs()
2879 sbinfo->max_blocks = config.max_blocks; in shmem_remount_fs()
2880 sbinfo->max_inodes = config.max_inodes; in shmem_remount_fs()
2881 sbinfo->free_inodes = config.max_inodes - inodes; in shmem_remount_fs()
2887 mpol_put(sbinfo->mpol); in shmem_remount_fs()
2888 sbinfo->mpol = config.mpol; /* transfers initial ref */ in shmem_remount_fs()
2891 spin_unlock(&sbinfo->stat_lock); in shmem_remount_fs()
2897 struct shmem_sb_info *sbinfo = SHMEM_SB(root->d_sb); in shmem_show_options() local
2899 if (sbinfo->max_blocks != shmem_default_max_blocks()) in shmem_show_options()
2901 sbinfo->max_blocks << (PAGE_CACHE_SHIFT - 10)); in shmem_show_options()
2902 if (sbinfo->max_inodes != shmem_default_max_inodes()) in shmem_show_options()
2903 seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); in shmem_show_options()
2904 if (sbinfo->mode != (S_IRWXUGO | S_ISVTX)) in shmem_show_options()
2905 seq_printf(seq, ",mode=%03ho", sbinfo->mode); in shmem_show_options()
2906 if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID)) in shmem_show_options()
2908 from_kuid_munged(&init_user_ns, sbinfo->uid)); in shmem_show_options()
2909 if (!gid_eq(sbinfo->gid, GLOBAL_ROOT_GID)) in shmem_show_options()
2911 from_kgid_munged(&init_user_ns, sbinfo->gid)); in shmem_show_options()
2912 shmem_show_mpol(seq, sbinfo->mpol); in shmem_show_options()
2990 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_put_super() local
2992 percpu_counter_destroy(&sbinfo->used_blocks); in shmem_put_super()
2993 mpol_put(sbinfo->mpol); in shmem_put_super()
2994 kfree(sbinfo); in shmem_put_super()
3001 struct shmem_sb_info *sbinfo; in shmem_fill_super() local
3005 sbinfo = kzalloc(max((int)sizeof(struct shmem_sb_info), in shmem_fill_super()
3007 if (!sbinfo) in shmem_fill_super()
3010 sbinfo->mode = S_IRWXUGO | S_ISVTX; in shmem_fill_super()
3011 sbinfo->uid = current_fsuid(); in shmem_fill_super()
3012 sbinfo->gid = current_fsgid(); in shmem_fill_super()
3013 sb->s_fs_info = sbinfo; in shmem_fill_super()
3022 sbinfo->max_blocks = shmem_default_max_blocks(); in shmem_fill_super()
3023 sbinfo->max_inodes = shmem_default_max_inodes(); in shmem_fill_super()
3024 if (shmem_parse_options(data, sbinfo, false)) { in shmem_fill_super()
3037 spin_lock_init(&sbinfo->stat_lock); in shmem_fill_super()
3038 if (percpu_counter_init(&sbinfo->used_blocks, 0, GFP_KERNEL)) in shmem_fill_super()
3040 sbinfo->free_inodes = sbinfo->max_inodes; in shmem_fill_super()
3055 inode = shmem_get_inode(sb, NULL, S_IFDIR | sbinfo->mode, 0, VM_NORESERVE); in shmem_fill_super()
3058 inode->i_uid = sbinfo->uid; in shmem_fill_super()
3059 inode->i_gid = sbinfo->gid; in shmem_fill_super()