Lines Matching refs:sbinfo
199 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_reserve_inode() local
200 if (sbinfo->max_inodes) { in shmem_reserve_inode()
201 spin_lock(&sbinfo->stat_lock); in shmem_reserve_inode()
202 if (!sbinfo->free_inodes) { in shmem_reserve_inode()
203 spin_unlock(&sbinfo->stat_lock); in shmem_reserve_inode()
206 sbinfo->free_inodes--; in shmem_reserve_inode()
207 spin_unlock(&sbinfo->stat_lock); in shmem_reserve_inode()
214 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_free_inode() local
215 if (sbinfo->max_inodes) { in shmem_free_inode()
216 spin_lock(&sbinfo->stat_lock); in shmem_free_inode()
217 sbinfo->free_inodes++; in shmem_free_inode()
218 spin_unlock(&sbinfo->stat_lock); in shmem_free_inode()
241 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); in shmem_recalc_inode() local
242 if (sbinfo->max_blocks) in shmem_recalc_inode()
243 percpu_counter_add(&sbinfo->used_blocks, -freed); in shmem_recalc_inode()
861 static struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo) in shmem_get_sbmpol() argument
864 if (sbinfo->mpol) { in shmem_get_sbmpol()
865 spin_lock(&sbinfo->stat_lock); /* prevent replace/use races */ in shmem_get_sbmpol()
866 mpol = sbinfo->mpol; in shmem_get_sbmpol()
868 spin_unlock(&sbinfo->stat_lock); in shmem_get_sbmpol()
936 static inline struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo) in shmem_get_sbmpol() argument
1037 struct shmem_sb_info *sbinfo; in shmem_getpage_gfp() local
1082 sbinfo = SHMEM_SB(inode->i_sb); in shmem_getpage_gfp()
1160 if (sbinfo->max_blocks) { in shmem_getpage_gfp()
1161 if (percpu_counter_compare(&sbinfo->used_blocks, in shmem_getpage_gfp()
1162 sbinfo->max_blocks) >= 0) { in shmem_getpage_gfp()
1166 percpu_counter_inc(&sbinfo->used_blocks); in shmem_getpage_gfp()
1247 sbinfo = SHMEM_SB(inode->i_sb); in shmem_getpage_gfp()
1248 if (sbinfo->max_blocks) in shmem_getpage_gfp()
1249 percpu_counter_add(&sbinfo->used_blocks, -1); in shmem_getpage_gfp()
1403 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_get_inode() local
1434 shmem_get_sbmpol(sbinfo)); in shmem_get_inode()
2053 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); in shmem_fallocate() local
2110 if (sbinfo->max_blocks && end - start > sbinfo->max_blocks) { in shmem_fallocate()
2181 struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb); in shmem_statfs() local
2186 if (sbinfo->max_blocks) { in shmem_statfs()
2187 buf->f_blocks = sbinfo->max_blocks; in shmem_statfs()
2189 buf->f_bfree = sbinfo->max_blocks - in shmem_statfs()
2190 percpu_counter_sum(&sbinfo->used_blocks); in shmem_statfs()
2192 if (sbinfo->max_inodes) { in shmem_statfs()
2193 buf->f_files = sbinfo->max_inodes; in shmem_statfs()
2194 buf->f_ffree = sbinfo->free_inodes; in shmem_statfs()
2738 static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, in shmem_parse_options() argument
2785 sbinfo->max_blocks = in shmem_parse_options()
2788 sbinfo->max_blocks = memparse(value, &rest); in shmem_parse_options()
2792 sbinfo->max_inodes = memparse(value, &rest); in shmem_parse_options()
2798 sbinfo->mode = simple_strtoul(value, &rest, 8) & 07777; in shmem_parse_options()
2807 sbinfo->uid = make_kuid(current_user_ns(), uid); in shmem_parse_options()
2808 if (!uid_valid(sbinfo->uid)) in shmem_parse_options()
2816 sbinfo->gid = make_kgid(current_user_ns(), gid); in shmem_parse_options()
2817 if (!gid_valid(sbinfo->gid)) in shmem_parse_options()
2830 sbinfo->mpol = mpol; in shmem_parse_options()
2844 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_remount_fs() local
2845 struct shmem_sb_info config = *sbinfo; in shmem_remount_fs()
2853 spin_lock(&sbinfo->stat_lock); in shmem_remount_fs()
2854 inodes = sbinfo->max_inodes - sbinfo->free_inodes; in shmem_remount_fs()
2855 if (percpu_counter_compare(&sbinfo->used_blocks, config.max_blocks) > 0) in shmem_remount_fs()
2864 if (config.max_blocks && !sbinfo->max_blocks) in shmem_remount_fs()
2866 if (config.max_inodes && !sbinfo->max_inodes) in shmem_remount_fs()
2870 sbinfo->max_blocks = config.max_blocks; in shmem_remount_fs()
2871 sbinfo->max_inodes = config.max_inodes; in shmem_remount_fs()
2872 sbinfo->free_inodes = config.max_inodes - inodes; in shmem_remount_fs()
2878 mpol_put(sbinfo->mpol); in shmem_remount_fs()
2879 sbinfo->mpol = config.mpol; /* transfers initial ref */ in shmem_remount_fs()
2882 spin_unlock(&sbinfo->stat_lock); in shmem_remount_fs()
2888 struct shmem_sb_info *sbinfo = SHMEM_SB(root->d_sb); in shmem_show_options() local
2890 if (sbinfo->max_blocks != shmem_default_max_blocks()) in shmem_show_options()
2892 sbinfo->max_blocks << (PAGE_CACHE_SHIFT - 10)); in shmem_show_options()
2893 if (sbinfo->max_inodes != shmem_default_max_inodes()) in shmem_show_options()
2894 seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); in shmem_show_options()
2895 if (sbinfo->mode != (S_IRWXUGO | S_ISVTX)) in shmem_show_options()
2896 seq_printf(seq, ",mode=%03ho", sbinfo->mode); in shmem_show_options()
2897 if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID)) in shmem_show_options()
2899 from_kuid_munged(&init_user_ns, sbinfo->uid)); in shmem_show_options()
2900 if (!gid_eq(sbinfo->gid, GLOBAL_ROOT_GID)) in shmem_show_options()
2902 from_kgid_munged(&init_user_ns, sbinfo->gid)); in shmem_show_options()
2903 shmem_show_mpol(seq, sbinfo->mpol); in shmem_show_options()
2981 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); in shmem_put_super() local
2983 percpu_counter_destroy(&sbinfo->used_blocks); in shmem_put_super()
2984 mpol_put(sbinfo->mpol); in shmem_put_super()
2985 kfree(sbinfo); in shmem_put_super()
2992 struct shmem_sb_info *sbinfo; in shmem_fill_super() local
2996 sbinfo = kzalloc(max((int)sizeof(struct shmem_sb_info), in shmem_fill_super()
2998 if (!sbinfo) in shmem_fill_super()
3001 sbinfo->mode = S_IRWXUGO | S_ISVTX; in shmem_fill_super()
3002 sbinfo->uid = current_fsuid(); in shmem_fill_super()
3003 sbinfo->gid = current_fsgid(); in shmem_fill_super()
3004 sb->s_fs_info = sbinfo; in shmem_fill_super()
3013 sbinfo->max_blocks = shmem_default_max_blocks(); in shmem_fill_super()
3014 sbinfo->max_inodes = shmem_default_max_inodes(); in shmem_fill_super()
3015 if (shmem_parse_options(data, sbinfo, false)) { in shmem_fill_super()
3028 spin_lock_init(&sbinfo->stat_lock); in shmem_fill_super()
3029 if (percpu_counter_init(&sbinfo->used_blocks, 0, GFP_KERNEL)) in shmem_fill_super()
3031 sbinfo->free_inodes = sbinfo->max_inodes; in shmem_fill_super()
3046 inode = shmem_get_inode(sb, NULL, S_IFDIR | sbinfo->mode, 0, VM_NORESERVE); in shmem_fill_super()
3049 inode->i_uid = sbinfo->uid; in shmem_fill_super()
3050 inode->i_gid = sbinfo->gid; in shmem_fill_super()