48 inode_dec_link_count(inode);
58 static struct dentry *ext2_lookup(
struct inode * dir,
struct dentry *dentry,
unsigned int flags)
70 if (inode == ERR_PTR(-
ESTALE)) {
72 "deleted inode referenced: %lu",
97 static int ext2_create (
struct inode * dir,
struct dentry * dentry,
umode_t mode,
bool excl)
105 return PTR_ERR(inode);
118 mark_inode_dirty(inode);
119 return ext2_add_nondir(dentry, inode);
122 static int ext2_mknod (
struct inode * dir,
struct dentry *dentry,
umode_t mode,
dev_t rdev)
124 struct inode *
inode;
127 if (!new_valid_dev(rdev))
133 err = PTR_ERR(inode);
134 if (!IS_ERR(inode)) {
136 #ifdef CONFIG_EXT2_FS_XATTR
139 mark_inode_dirty(inode);
140 err = ext2_add_nondir(dentry, inode);
145 static int ext2_symlink (
struct inode * dir,
struct dentry * dentry,
146 const char * symname)
150 unsigned l =
strlen(symname)+1;
151 struct inode *
inode;
159 err = PTR_ERR(inode);
163 if (l >
sizeof (EXT2_I(inode)->
i_data)) {
179 mark_inode_dirty(inode);
181 err = ext2_add_nondir(dentry, inode);
186 inode_dec_link_count(inode);
192 static int ext2_link (
struct dentry * old_dentry,
struct inode * dir,
193 struct dentry *dentry)
195 struct inode *inode = old_dentry->
d_inode;
201 inode_inc_link_count(inode);
209 inode_dec_link_count(inode);
214 static int ext2_mkdir(
struct inode * dir,
struct dentry * dentry,
umode_t mode)
216 struct inode *
inode;
221 inode_inc_link_count(dir);
224 err = PTR_ERR(inode);
235 inode_inc_link_count(inode);
251 inode_dec_link_count(inode);
252 inode_dec_link_count(inode);
256 inode_dec_link_count(dir);
260 static int ext2_unlink(
struct inode * dir,
struct dentry *dentry)
262 struct inode * inode = dentry->
d_inode;
278 inode_dec_link_count(inode);
284 static int ext2_rmdir (
struct inode * dir,
struct dentry *dentry)
286 struct inode * inode = dentry->
d_inode;
290 err = ext2_unlink(dir, dentry);
293 inode_dec_link_count(inode);
294 inode_dec_link_count(dir);
300 static int ext2_rename (
struct inode * old_dir,
struct dentry * old_dentry,
301 struct inode * new_dir,
struct dentry * new_dentry )
303 struct inode * old_inode = old_dentry->
d_inode;
305 struct page * dir_page =
NULL;
307 struct page * old_page;
326 struct page *new_page;
341 inode_dec_link_count(new_inode);
347 inode_inc_link_count(new_dir);
355 mark_inode_dirty(old_inode);
360 if (old_dir != new_dir)
366 inode_dec_link_count(old_dir);
384 .create = ext2_create,
385 .lookup = ext2_lookup,
387 .unlink = ext2_unlink,
388 .symlink = ext2_symlink,
392 .rename = ext2_rename,
393 #ifdef CONFIG_EXT2_FS_XATTR
404 #ifdef CONFIG_EXT2_FS_XATTR