Lines Matching refs:inode
40 static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) in ext2_add_nondir() argument
42 int err = ext2_add_link(dentry, inode); in ext2_add_nondir()
44 d_instantiate_new(dentry, inode); in ext2_add_nondir()
47 inode_dec_link_count(inode); in ext2_add_nondir()
48 discard_new_inode(inode); in ext2_add_nondir()
56 static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) in ext2_lookup()
58 struct inode * inode; in ext2_lookup() local
69 inode = NULL; in ext2_lookup()
71 inode = ext2_iget(dir->i_sb, ino); in ext2_lookup()
72 if (inode == ERR_PTR(-ESTALE)) { in ext2_lookup()
79 return d_splice_alias(inode, dentry); in ext2_lookup()
103 static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, bool excl) in ext2_create()
105 struct inode *inode; in ext2_create() local
112 inode = ext2_new_inode(dir, mode, &dentry->d_name); in ext2_create()
113 if (IS_ERR(inode)) in ext2_create()
114 return PTR_ERR(inode); in ext2_create()
116 ext2_set_file_ops(inode); in ext2_create()
117 mark_inode_dirty(inode); in ext2_create()
118 return ext2_add_nondir(dentry, inode); in ext2_create()
121 static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) in ext2_tmpfile()
123 struct inode *inode = ext2_new_inode(dir, mode, NULL); in ext2_tmpfile() local
124 if (IS_ERR(inode)) in ext2_tmpfile()
125 return PTR_ERR(inode); in ext2_tmpfile()
127 ext2_set_file_ops(inode); in ext2_tmpfile()
128 mark_inode_dirty(inode); in ext2_tmpfile()
129 d_tmpfile(dentry, inode); in ext2_tmpfile()
130 unlock_new_inode(inode); in ext2_tmpfile()
134 static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev) in ext2_mknod()
136 struct inode * inode; in ext2_mknod() local
143 inode = ext2_new_inode (dir, mode, &dentry->d_name); in ext2_mknod()
144 err = PTR_ERR(inode); in ext2_mknod()
145 if (!IS_ERR(inode)) { in ext2_mknod()
146 init_special_inode(inode, inode->i_mode, rdev); in ext2_mknod()
147 inode->i_op = &ext2_special_inode_operations; in ext2_mknod()
148 mark_inode_dirty(inode); in ext2_mknod()
149 err = ext2_add_nondir(dentry, inode); in ext2_mknod()
154 static int ext2_symlink (struct inode * dir, struct dentry * dentry, in ext2_symlink()
160 struct inode * inode; in ext2_symlink() local
169 inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO, &dentry->d_name); in ext2_symlink()
170 err = PTR_ERR(inode); in ext2_symlink()
171 if (IS_ERR(inode)) in ext2_symlink()
174 if (l > sizeof (EXT2_I(inode)->i_data)) { in ext2_symlink()
176 inode->i_op = &ext2_symlink_inode_operations; in ext2_symlink()
177 inode_nohighmem(inode); in ext2_symlink()
178 if (test_opt(inode->i_sb, NOBH)) in ext2_symlink()
179 inode->i_mapping->a_ops = &ext2_nobh_aops; in ext2_symlink()
181 inode->i_mapping->a_ops = &ext2_aops; in ext2_symlink()
182 err = page_symlink(inode, symname, l); in ext2_symlink()
187 inode->i_op = &ext2_fast_symlink_inode_operations; in ext2_symlink()
188 inode->i_link = (char*)EXT2_I(inode)->i_data; in ext2_symlink()
189 memcpy(inode->i_link, symname, l); in ext2_symlink()
190 inode->i_size = l-1; in ext2_symlink()
192 mark_inode_dirty(inode); in ext2_symlink()
194 err = ext2_add_nondir(dentry, inode); in ext2_symlink()
199 inode_dec_link_count(inode); in ext2_symlink()
200 discard_new_inode(inode); in ext2_symlink()
204 static int ext2_link (struct dentry * old_dentry, struct inode * dir, in ext2_link()
207 struct inode *inode = d_inode(old_dentry); in ext2_link() local
214 inode->i_ctime = current_time(inode); in ext2_link()
215 inode_inc_link_count(inode); in ext2_link()
216 ihold(inode); in ext2_link()
218 err = ext2_add_link(dentry, inode); in ext2_link()
220 d_instantiate(dentry, inode); in ext2_link()
223 inode_dec_link_count(inode); in ext2_link()
224 iput(inode); in ext2_link()
228 static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) in ext2_mkdir()
230 struct inode * inode; in ext2_mkdir() local
239 inode = ext2_new_inode(dir, S_IFDIR | mode, &dentry->d_name); in ext2_mkdir()
240 err = PTR_ERR(inode); in ext2_mkdir()
241 if (IS_ERR(inode)) in ext2_mkdir()
244 inode->i_op = &ext2_dir_inode_operations; in ext2_mkdir()
245 inode->i_fop = &ext2_dir_operations; in ext2_mkdir()
246 if (test_opt(inode->i_sb, NOBH)) in ext2_mkdir()
247 inode->i_mapping->a_ops = &ext2_nobh_aops; in ext2_mkdir()
249 inode->i_mapping->a_ops = &ext2_aops; in ext2_mkdir()
251 inode_inc_link_count(inode); in ext2_mkdir()
253 err = ext2_make_empty(inode, dir); in ext2_mkdir()
257 err = ext2_add_link(dentry, inode); in ext2_mkdir()
261 d_instantiate_new(dentry, inode); in ext2_mkdir()
266 inode_dec_link_count(inode); in ext2_mkdir()
267 inode_dec_link_count(inode); in ext2_mkdir()
268 discard_new_inode(inode); in ext2_mkdir()
274 static int ext2_unlink(struct inode * dir, struct dentry *dentry) in ext2_unlink()
276 struct inode * inode = d_inode(dentry); in ext2_unlink() local
295 inode->i_ctime = dir->i_ctime; in ext2_unlink()
296 inode_dec_link_count(inode); in ext2_unlink()
302 static int ext2_rmdir (struct inode * dir, struct dentry *dentry) in ext2_rmdir()
304 struct inode * inode = d_inode(dentry); in ext2_rmdir() local
307 if (ext2_empty_dir(inode)) { in ext2_rmdir()
310 inode->i_size = 0; in ext2_rmdir()
311 inode_dec_link_count(inode); in ext2_rmdir()
318 static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, in ext2_rename()
319 struct inode * new_dir, struct dentry * new_dentry, in ext2_rename()
322 struct inode * old_inode = d_inode(old_dentry); in ext2_rename()
323 struct inode * new_inode = d_inode(new_dentry); in ext2_rename()