Lines Matching refs:inode

3  * This file contains vfs inode ops for the 9P2000 protocol.
221 * v9fs_alloc_inode - helper function to allocate an inode
222 * @sb: The superblock to allocate the inode from
224 struct inode *v9fs_alloc_inode(struct super_block *sb)
233 return &v9inode->netfs.inode;
237 * v9fs_free_inode - destroy an inode
238 * @inode: The inode to be freed
241 void v9fs_free_inode(struct inode *inode)
243 kmem_cache_free(v9fs_inode_cache, V9FS_I(inode));
249 void v9fs_set_netfs_context(struct inode *inode)
251 struct v9fs_inode *v9inode = V9FS_I(inode);
256 struct inode *inode, umode_t mode, dev_t rdev)
260 inode_init_owner(&nop_mnt_idmap, inode, NULL, mode);
261 inode->i_blocks = 0;
262 inode->i_rdev = rdev;
263 inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
264 inode->i_mapping->a_ops = &v9fs_addr_operations;
265 inode->i_private = NULL;
273 inode->i_op = &v9fs_file_inode_operations_dotl;
275 inode->i_op = &v9fs_file_inode_operations;
282 init_special_inode(inode, inode->i_mode, inode->i_rdev);
286 inode->i_op = &v9fs_file_inode_operations_dotl;
287 inode->i_fop = &v9fs_file_operations_dotl;
289 inode->i_op = &v9fs_file_inode_operations;
290 inode->i_fop = &v9fs_file_operations;
303 inode->i_op = &v9fs_symlink_inode_operations_dotl;
305 inode->i_op = &v9fs_symlink_inode_operations;
309 inc_nlink(inode);
311 inode->i_op = &v9fs_dir_inode_operations_dotl;
313 inode->i_op = &v9fs_dir_inode_operations_dotu;
315 inode->i_op = &v9fs_dir_inode_operations;
318 inode->i_fop = &v9fs_dir_operations_dotl;
320 inode->i_fop = &v9fs_dir_operations;
335 * v9fs_get_inode - helper function to setup an inode
337 * @mode: mode to setup inode with
341 struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev)
344 struct inode *inode;
349 inode = new_inode(sb);
350 if (!inode) {
351 pr_warn("%s (%d): Problem allocating inode\n",
355 err = v9fs_init_inode(v9ses, inode, mode, rdev);
357 iput(inode);
360 v9fs_set_netfs_context(inode);
361 return inode;
365 * v9fs_evict_inode - Remove an inode from the inode cache
366 * @inode: inode to release
369 void v9fs_evict_inode(struct inode *inode)
371 struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode);
374 truncate_inode_pages_final(&inode->i_data);
378 fscache_clear_inode_writeback(v9fs_inode_cookie(v9inode), inode,
382 clear_inode(inode);
383 filemap_fdatawrite(&inode->i_data);
390 static int v9fs_test_inode(struct inode *inode, void *data)
394 struct v9fs_inode *v9inode = V9FS_I(inode);
396 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
399 /* don't match inode of different type */
400 if (inode_wrong_type(inode, umode))
416 static int v9fs_test_new_inode(struct inode *inode, void *data)
421 static int v9fs_set_inode(struct inode *inode, void *data)
423 struct v9fs_inode *v9inode = V9FS_I(inode);
430 static struct inode *v9fs_qid_iget(struct super_block *sb,
439 struct inode *inode;
441 int (*test)(struct inode *inode, void *data);
449 inode = iget5_locked(sb, i_ino, test, v9fs_set_inode, st);
450 if (!inode)
452 if (!(inode->i_state & I_NEW))
453 return inode;
455 * initialize the inode with the stat info
459 inode->i_ino = i_ino;
461 retval = v9fs_init_inode(v9ses, inode, umode, rdev);
465 v9fs_stat2inode(st, inode, sb, 0);
466 v9fs_set_netfs_context(inode);
467 v9fs_cache_inode_get_cookie(inode);
468 unlock_new_inode(inode);
469 return inode;
471 iget_failed(inode);
476 struct inode *
481 struct inode *inode = NULL;
487 inode = v9fs_qid_iget(sb, &st->qid, st, new);
490 return inode;
518 * @inode: inode whose nlink is being dropped
520 static void v9fs_dec_count(struct inode *inode)
522 if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
523 drop_nlink(inode);
528 * @dir: directory inode that is being deleted
534 static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
536 struct inode *inode;
541 p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
545 inode = d_inode(dentry);
569 clear_nlink(inode);
572 v9fs_dec_count(inode);
574 v9fs_invalidate_inode_attr(inode);
595 v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
601 struct inode *inode;
637 * instantiate inode and assign the unopened fid to the dentry
639 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
640 if (IS_ERR(inode)) {
641 err = PTR_ERR(inode);
643 "inode creation failed %d\n", err);
647 d_instantiate(dentry, inode);
672 v9fs_vfs_create(struct mnt_idmap *idmap, struct inode *dir,
693 * @dir: inode that is being unlinked
699 static int v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
727 * v9fs_vfs_lookup - VFS lookup hook to "walk" to a new inode
728 * @dir: inode that is being walked from
734 struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
740 struct inode *inode;
756 * Make sure we don't use a wrong inode due to parallel
758 * inode. But with cache disabled, lookup should do this.
764 inode = NULL;
766 inode = ERR_CAST(fid);
768 inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);
770 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
778 res = d_splice_alias(inode, dentry);
791 v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
800 struct inode *inode;
832 inode = d_inode(dentry);
833 v9inode = V9FS_I(inode);
846 v9fs_open_fid_add(inode, &fid);
859 * v9fs_vfs_unlink - VFS unlink hook to delete an inode
860 * @i: inode that is being unlinked
865 int v9fs_vfs_unlink(struct inode *i, struct dentry *d)
872 * @i: inode that is being unlinked
877 int v9fs_vfs_rmdir(struct inode *i, struct dentry *d)
883 * v9fs_vfs_rename - VFS hook to rename an inode
885 * @old_dir: old dir inode
887 * @new_dir: new dir inode
894 v9fs_vfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
895 struct dentry *old_dentry, struct inode *new_dir,
899 struct inode *old_inode;
900 struct inode *new_inode;
1006 struct inode *inode = d_inode(dentry);
1014 generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
1017 if (S_ISREG(inode->i_mode)) {
1018 int retval = filemap_fdatawrite(inode->i_mapping);
1054 struct inode *inode = d_inode(dentry);
1099 retval = filemap_fdatawrite(inode->i_mapping);
1114 iattr->ia_size != i_size_read(inode)) {
1115 truncate_setsize(inode, iattr->ia_size);
1116 truncate_pagecache(inode, iattr->ia_size);
1120 struct v9fs_inode *v9inode = V9FS_I(inode);
1127 v9fs_invalidate_inode_attr(inode);
1129 setattr_copy(&nop_mnt_idmap, inode, iattr);
1130 mark_inode_dirty(inode);
1135 * v9fs_stat2inode - populate an inode structure with mistat info
1137 * @inode: inode to populate
1144 v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
1149 struct v9fs_inode *v9inode = V9FS_I(inode);
1151 set_nlink(inode, 1);
1153 inode->i_atime.tv_sec = stat->atime;
1154 inode->i_mtime.tv_sec = stat->mtime;
1155 inode_set_ctime(inode, stat->mtime, 0);
1157 inode->i_uid = v9ses->dfltuid;
1158 inode->i_gid = v9ses->dfltgid;
1161 inode->i_uid = stat->n_uid;
1162 inode->i_gid = stat->n_gid;
1164 if ((S_ISREG(inode->i_mode)) || (S_ISDIR(inode->i_mode))) {
1177 set_nlink(inode, i_nlink);
1181 mode |= inode->i_mode & ~S_IALLUGO;
1182 inode->i_mode = mode;
1185 v9fs_i_size_write(inode, stat->length);
1187 inode->i_blocks = (stat->length + 512 - 1) >> 9;
1192 * v9fs_qid2ino - convert qid into inode number
1195 * BUG: potential for inode number collisions?
1214 * @inode: inode for symlink
1219 struct inode *inode,
1263 * @dir: inode to create special file in
1270 static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1295 * @dir: directory inode containing symlink
1304 v9fs_vfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
1318 * @dir: inode destination for new link
1324 v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1351 * @dir: inode destination for new link
1359 v9fs_vfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
1385 int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
1393 v9ses = v9fs_inode2v9ses(inode);
1398 * Don't update inode if the file type is different
1401 if (inode_wrong_type(inode, umode))
1405 * We don't want to refresh inode->i_size,
1410 v9fs_stat2inode(st, inode, inode->i_sb, flags);