Lines Matching refs:inode

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