• Home
  • Raw
  • Download

Lines Matching refs:inode

124 static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
127 static inline int shmem_getpage(struct inode *inode, pgoff_t index, in shmem_getpage() argument
130 return shmem_getpage_gfp(inode, index, pagep, sgp, in shmem_getpage()
131 mapping_gfp_mask(inode->i_mapping), fault_type); in shmem_getpage()
236 static void shmem_recalc_inode(struct inode *inode) in shmem_recalc_inode() argument
238 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_recalc_inode()
241 freed = info->alloced - info->swapped - inode->i_mapping->nrpages; in shmem_recalc_inode()
243 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); in shmem_recalc_inode()
247 inode->i_blocks -= freed * BLOCKS_PER_PAGE; in shmem_recalc_inode()
396 static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, in shmem_undo_range() argument
399 struct address_space *mapping = inode->i_mapping; in shmem_undo_range()
400 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_undo_range()
455 shmem_getpage(inode, start - 1, &page, SGP_READ, NULL); in shmem_undo_range()
470 shmem_getpage(inode, end, &page, SGP_READ, NULL); in shmem_undo_range()
536 shmem_recalc_inode(inode); in shmem_undo_range()
540 void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend) in shmem_truncate_range() argument
542 shmem_undo_range(inode, lstart, lend, false); in shmem_truncate_range()
543 inode->i_ctime = inode->i_mtime = CURRENT_TIME; in shmem_truncate_range()
550 struct inode *inode = dentry->d_inode; in shmem_getattr() local
551 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_getattr()
553 if (info->alloced - info->swapped != inode->i_mapping->nrpages) { in shmem_getattr()
555 shmem_recalc_inode(inode); in shmem_getattr()
558 generic_fillattr(inode, stat); in shmem_getattr()
564 struct inode *inode = d_inode(dentry); in shmem_setattr() local
565 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_setattr()
568 error = inode_change_ok(inode, attr); in shmem_setattr()
572 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { in shmem_setattr()
573 loff_t oldsize = inode->i_size; in shmem_setattr()
582 error = shmem_reacct_size(SHMEM_I(inode)->flags, in shmem_setattr()
586 i_size_write(inode, newsize); in shmem_setattr()
587 inode->i_ctime = inode->i_mtime = CURRENT_TIME; in shmem_setattr()
592 unmap_mapping_range(inode->i_mapping, in shmem_setattr()
595 shmem_truncate_range(inode, in shmem_setattr()
599 unmap_mapping_range(inode->i_mapping, in shmem_setattr()
604 setattr_copy(inode, attr); in shmem_setattr()
606 error = posix_acl_chmod(inode, inode->i_mode); in shmem_setattr()
610 static void shmem_evict_inode(struct inode *inode) in shmem_evict_inode() argument
612 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_evict_inode()
614 if (inode->i_mapping->a_ops == &shmem_aops) { in shmem_evict_inode()
615 shmem_unacct_size(info->flags, inode->i_size); in shmem_evict_inode()
616 inode->i_size = 0; in shmem_evict_inode()
617 shmem_truncate_range(inode, 0, (loff_t)-1); in shmem_evict_inode()
626 WARN_ON(inode->i_blocks); in shmem_evict_inode()
627 shmem_free_inode(inode->i_sb); in shmem_evict_inode()
628 clear_inode(inode); in shmem_evict_inode()
770 struct inode *inode; in shmem_writepage() local
777 inode = mapping->host; in shmem_writepage()
778 info = SHMEM_I(inode); in shmem_writepage()
808 if (inode->i_private) { in shmem_writepage()
810 spin_lock(&inode->i_lock); in shmem_writepage()
811 shmem_falloc = inode->i_private; in shmem_writepage()
819 spin_unlock(&inode->i_lock); in shmem_writepage()
846 shmem_recalc_inode(inode); in shmem_writepage()
1054 static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, in shmem_getpage_gfp() argument
1057 struct address_space *mapping = inode->i_mapping; in shmem_getpage_gfp()
1078 ((loff_t)index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) { in shmem_getpage_gfp()
1103 info = SHMEM_I(inode); in shmem_getpage_gfp()
1104 sbinfo = SHMEM_SB(inode->i_sb); in shmem_getpage_gfp()
1167 shmem_recalc_inode(inode); in shmem_getpage_gfp()
1220 inode->i_blocks += BLOCKS_PER_PAGE; in shmem_getpage_gfp()
1221 shmem_recalc_inode(inode); in shmem_getpage_gfp()
1247 ((loff_t)index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) { in shmem_getpage_gfp()
1252 shmem_recalc_inode(inode); in shmem_getpage_gfp()
1278 info = SHMEM_I(inode); in shmem_getpage_gfp()
1280 shmem_recalc_inode(inode); in shmem_getpage_gfp()
1291 struct inode *inode = file_inode(vma->vm_file); in shmem_fault() local
1312 if (unlikely(inode->i_private)) { in shmem_fault()
1315 spin_lock(&inode->i_lock); in shmem_fault()
1316 shmem_falloc = inode->i_private; in shmem_fault()
1335 spin_unlock(&inode->i_lock); in shmem_fault()
1345 spin_lock(&inode->i_lock); in shmem_fault()
1347 spin_unlock(&inode->i_lock); in shmem_fault()
1350 spin_unlock(&inode->i_lock); in shmem_fault()
1353 error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret); in shmem_fault()
1367 struct inode *inode = file_inode(vma->vm_file); in shmem_set_policy() local
1368 return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol); in shmem_set_policy()
1374 struct inode *inode = file_inode(vma->vm_file); in shmem_get_policy() local
1378 return mpol_shared_policy_lookup(&SHMEM_I(inode)->policy, index); in shmem_get_policy()
1384 struct inode *inode = file_inode(file); in shmem_lock() local
1385 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_lock()
1390 if (!user_shm_lock(inode->i_size, user)) in shmem_lock()
1396 user_shm_unlock(inode->i_size, user); in shmem_lock()
1414 static struct inode *shmem_get_inode(struct super_block *sb, const struct inode *dir, in shmem_get_inode()
1417 struct inode *inode; in shmem_get_inode() local
1424 inode = new_inode(sb); in shmem_get_inode()
1425 if (inode) { in shmem_get_inode()
1426 inode->i_ino = get_next_ino(); in shmem_get_inode()
1427 inode_init_owner(inode, dir, mode); in shmem_get_inode()
1428 inode->i_blocks = 0; in shmem_get_inode()
1429 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; in shmem_get_inode()
1430 inode->i_generation = get_seconds(); in shmem_get_inode()
1431 info = SHMEM_I(inode); in shmem_get_inode()
1432 memset(info, 0, (char *)inode - (char *)info); in shmem_get_inode()
1438 cache_no_acl(inode); in shmem_get_inode()
1442 inode->i_op = &shmem_special_inode_operations; in shmem_get_inode()
1443 init_special_inode(inode, mode, dev); in shmem_get_inode()
1446 inode->i_mapping->a_ops = &shmem_aops; in shmem_get_inode()
1447 inode->i_op = &shmem_inode_operations; in shmem_get_inode()
1448 inode->i_fop = &shmem_file_operations; in shmem_get_inode()
1453 inc_nlink(inode); in shmem_get_inode()
1455 inode->i_size = 2 * BOGO_DIRENT_SIZE; in shmem_get_inode()
1456 inode->i_op = &shmem_dir_inode_operations; in shmem_get_inode()
1457 inode->i_fop = &simple_dir_operations; in shmem_get_inode()
1468 lockdep_annotate_inode_mutex_key(inode); in shmem_get_inode()
1471 return inode; in shmem_get_inode()
1487 static int shmem_initxattrs(struct inode *, const struct xattr *, void *);
1497 struct inode *inode = mapping->host; in shmem_write_begin() local
1498 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_write_begin()
1505 if ((info->seals & F_SEAL_GROW) && pos + len > inode->i_size) in shmem_write_begin()
1509 return shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); in shmem_write_begin()
1517 struct inode *inode = mapping->host; in shmem_write_end() local
1519 if (pos + copied > inode->i_size) in shmem_write_end()
1520 i_size_write(inode, pos + copied); in shmem_write_end()
1540 struct inode *inode = file_inode(file); in shmem_file_read_iter() local
1541 struct address_space *mapping = inode->i_mapping; in shmem_file_read_iter()
1564 loff_t i_size = i_size_read(inode); in shmem_file_read_iter()
1575 error = shmem_getpage(inode, index, &page, sgp, NULL); in shmem_file_read_iter()
1589 i_size = i_size_read(inode); in shmem_file_read_iter()
1649 struct inode *inode = mapping->host; in shmem_file_splice_read() local
1666 isize = i_size_read(inode); in shmem_file_splice_read()
1688 error = shmem_getpage(inode, index, &page, SGP_CACHE, NULL); in shmem_file_splice_read()
1710 error = shmem_getpage(inode, index, &page, in shmem_file_splice_read()
1719 isize = i_size_read(inode); in shmem_file_splice_read()
1811 struct inode *inode = mapping->host; in shmem_file_llseek() local
1817 MAX_LFS_FILESIZE, i_size_read(inode)); in shmem_file_llseek()
1818 mutex_lock(&inode->i_mutex); in shmem_file_llseek()
1821 if (offset < 0 || offset >= inode->i_size) in shmem_file_llseek()
1825 end = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; in shmem_file_llseek()
1829 if (new_offset < inode->i_size) in shmem_file_llseek()
1834 offset = inode->i_size; in shmem_file_llseek()
1840 mutex_unlock(&inode->i_mutex); in shmem_file_llseek()
1966 struct inode *inode = file_inode(file); in shmem_add_seals() local
1967 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_add_seals()
2007 mutex_lock(&inode->i_mutex); in shmem_add_seals()
2030 mutex_unlock(&inode->i_mutex); in shmem_add_seals()
2070 struct inode *inode = file_inode(file); in shmem_fallocate() local
2071 struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); in shmem_fallocate()
2072 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_fallocate()
2080 mutex_lock(&inode->i_mutex); in shmem_fallocate()
2097 spin_lock(&inode->i_lock); in shmem_fallocate()
2098 inode->i_private = &shmem_falloc; in shmem_fallocate()
2099 spin_unlock(&inode->i_lock); in shmem_fallocate()
2104 shmem_truncate_range(inode, offset, offset + len - 1); in shmem_fallocate()
2107 spin_lock(&inode->i_lock); in shmem_fallocate()
2108 inode->i_private = NULL; in shmem_fallocate()
2110 spin_unlock(&inode->i_lock); in shmem_fallocate()
2116 error = inode_newsize_ok(inode, offset + len); in shmem_fallocate()
2120 if ((info->seals & F_SEAL_GROW) && offset + len > inode->i_size) { in shmem_fallocate()
2138 spin_lock(&inode->i_lock); in shmem_fallocate()
2139 inode->i_private = &shmem_falloc; in shmem_fallocate()
2140 spin_unlock(&inode->i_lock); in shmem_fallocate()
2154 error = shmem_getpage(inode, index, &page, SGP_FALLOC, in shmem_fallocate()
2159 shmem_undo_range(inode, in shmem_fallocate()
2187 if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) in shmem_fallocate()
2188 i_size_write(inode, offset + len); in shmem_fallocate()
2189 inode->i_ctime = CURRENT_TIME; in shmem_fallocate()
2191 spin_lock(&inode->i_lock); in shmem_fallocate()
2192 inode->i_private = NULL; in shmem_fallocate()
2193 spin_unlock(&inode->i_lock); in shmem_fallocate()
2195 mutex_unlock(&inode->i_mutex); in shmem_fallocate()
2224 shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) in shmem_mknod()
2226 struct inode *inode; in shmem_mknod() local
2229 inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE); in shmem_mknod()
2230 if (inode) { in shmem_mknod()
2231 error = simple_acl_create(dir, inode); in shmem_mknod()
2234 error = security_inode_init_security(inode, dir, in shmem_mknod()
2243 d_instantiate(dentry, inode); in shmem_mknod()
2248 iput(inode); in shmem_mknod()
2253 shmem_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) in shmem_tmpfile()
2255 struct inode *inode; in shmem_tmpfile() local
2258 inode = shmem_get_inode(dir->i_sb, dir, mode, 0, VM_NORESERVE); in shmem_tmpfile()
2259 if (inode) { in shmem_tmpfile()
2260 error = security_inode_init_security(inode, dir, in shmem_tmpfile()
2265 error = simple_acl_create(dir, inode); in shmem_tmpfile()
2268 d_tmpfile(dentry, inode); in shmem_tmpfile()
2272 iput(inode); in shmem_tmpfile()
2276 static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) in shmem_mkdir()
2286 static int shmem_create(struct inode *dir, struct dentry *dentry, umode_t mode, in shmem_create()
2295 static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) in shmem_link()
2297 struct inode *inode = d_inode(old_dentry); in shmem_link() local
2307 if (inode->i_nlink) { in shmem_link()
2308 ret = shmem_reserve_inode(inode->i_sb); in shmem_link()
2314 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; in shmem_link()
2315 inc_nlink(inode); in shmem_link()
2316 ihold(inode); /* New dentry reference */ in shmem_link()
2318 d_instantiate(dentry, inode); in shmem_link()
2323 static int shmem_unlink(struct inode *dir, struct dentry *dentry) in shmem_unlink()
2325 struct inode *inode = d_inode(dentry); in shmem_unlink() local
2327 if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) in shmem_unlink()
2328 shmem_free_inode(inode->i_sb); in shmem_unlink()
2331 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; in shmem_unlink()
2332 drop_nlink(inode); in shmem_unlink()
2337 static int shmem_rmdir(struct inode *dir, struct dentry *dentry) in shmem_rmdir()
2347 static int shmem_exchange(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, … in shmem_exchange()
2369 static int shmem_whiteout(struct inode *old_dir, struct dentry *old_dentry) in shmem_whiteout()
2401 static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, s… in shmem_rename2()
2403 struct inode *inode = d_inode(old_dentry); in shmem_rename2() local
2404 int they_are_dirs = S_ISDIR(inode->i_mode); in shmem_rename2()
2438 inode->i_ctime = CURRENT_TIME; in shmem_rename2()
2442 static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *symname) in shmem_symlink()
2446 struct inode *inode; in shmem_symlink() local
2455 inode = shmem_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0, VM_NORESERVE); in shmem_symlink()
2456 if (!inode) in shmem_symlink()
2459 error = security_inode_init_security(inode, dir, &dentry->d_name, in shmem_symlink()
2463 iput(inode); in shmem_symlink()
2469 info = SHMEM_I(inode); in shmem_symlink()
2470 inode->i_size = len-1; in shmem_symlink()
2472 inode->i_link = kmemdup(symname, len, GFP_KERNEL); in shmem_symlink()
2473 if (!inode->i_link) { in shmem_symlink()
2474 iput(inode); in shmem_symlink()
2477 inode->i_op = &shmem_short_symlink_operations; in shmem_symlink()
2479 error = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL); in shmem_symlink()
2481 iput(inode); in shmem_symlink()
2484 inode->i_mapping->a_ops = &shmem_aops; in shmem_symlink()
2485 inode->i_op = &shmem_symlink_inode_operations; in shmem_symlink()
2496 d_instantiate(dentry, inode); in shmem_symlink()
2512 static void shmem_put_link(struct inode *unused, void *cookie) in shmem_put_link()
2531 static int shmem_initxattrs(struct inode *inode, in shmem_initxattrs() argument
2535 struct shmem_inode_info *info = SHMEM_I(inode); in shmem_initxattrs()
2688 static int shmem_match(struct inode *ino, void *vfh) in shmem_match()
2699 struct inode *inode; in shmem_fh_to_dentry() local
2709 inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]), in shmem_fh_to_dentry()
2711 if (inode) { in shmem_fh_to_dentry()
2712 dentry = d_find_alias(inode); in shmem_fh_to_dentry()
2713 iput(inode); in shmem_fh_to_dentry()
2719 static int shmem_encode_fh(struct inode *inode, __u32 *fh, int *len, in shmem_encode_fh() argument
2720 struct inode *parent) in shmem_encode_fh()
2727 if (inode_unhashed(inode)) { in shmem_encode_fh()
2735 if (inode_unhashed(inode)) in shmem_encode_fh()
2736 __insert_inode_hash(inode, in shmem_encode_fh()
2737 inode->i_ino + inode->i_generation); in shmem_encode_fh()
2741 fh[0] = inode->i_generation; in shmem_encode_fh()
2742 fh[1] = inode->i_ino; in shmem_encode_fh()
2743 fh[2] = ((__u64)inode->i_ino) >> 32; in shmem_encode_fh()
3008 struct inode *inode; in shmem_fill_super() local
3063 inode = shmem_get_inode(sb, NULL, S_IFDIR | sbinfo->mode, 0, VM_NORESERVE); in shmem_fill_super()
3064 if (!inode) in shmem_fill_super()
3066 inode->i_uid = sbinfo->uid; in shmem_fill_super()
3067 inode->i_gid = sbinfo->gid; in shmem_fill_super()
3068 sb->s_root = d_make_root(inode); in shmem_fill_super()
3080 static struct inode *shmem_alloc_inode(struct super_block *sb) in shmem_alloc_inode()
3091 struct inode *inode = container_of(head, struct inode, i_rcu); in shmem_destroy_callback() local
3092 kfree(inode->i_link); in shmem_destroy_callback()
3093 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode)); in shmem_destroy_callback()
3096 static void shmem_destroy_inode(struct inode *inode) in shmem_destroy_inode() argument
3098 if (S_ISREG(inode->i_mode)) in shmem_destroy_inode()
3099 mpol_free_shared_policy(&SHMEM_I(inode)->policy); in shmem_destroy_inode()
3100 call_rcu(&inode->i_rcu, shmem_destroy_callback); in shmem_destroy_inode()
3311 void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend) in shmem_truncate_range() argument
3313 truncate_inode_pages_range(inode->i_mapping, lstart, lend); in shmem_truncate_range()
3335 struct inode *inode; in __shmem_file_setup() local
3361 inode = shmem_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0, flags); in __shmem_file_setup()
3362 if (!inode) in __shmem_file_setup()
3365 inode->i_flags |= i_flags; in __shmem_file_setup()
3366 d_instantiate(path.dentry, inode); in __shmem_file_setup()
3367 inode->i_size = size; in __shmem_file_setup()
3368 clear_nlink(inode); /* It is unlinked */ in __shmem_file_setup()
3369 res = ERR_PTR(ramfs_nommu_expand_for_mapping(inode, size)); in __shmem_file_setup()
3464 struct inode *inode = mapping->host; in shmem_read_mapping_page_gfp() local
3469 error = shmem_getpage_gfp(inode, index, &page, SGP_CACHE, gfp, NULL); in shmem_read_mapping_page_gfp()