Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/ufs/namei.c |
| 3 | * |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 4 | * Migration to usage of "page cache" on May 2006 by |
| 5 | * Evgeniy Dushistov <dushistov@mail.ru> based on ext2 code base. |
| 6 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * Copyright (C) 1998 |
| 8 | * Daniel Pirkl <daniel.pirkl@email.cz> |
| 9 | * Charles University, Faculty of Mathematics and Physics |
| 10 | * |
| 11 | * from |
| 12 | * |
| 13 | * linux/fs/ext2/namei.c |
| 14 | * |
| 15 | * Copyright (C) 1992, 1993, 1994, 1995 |
| 16 | * Remy Card (card@masi.ibp.fr) |
| 17 | * Laboratoire MASI - Institut Blaise Pascal |
| 18 | * Universite Pierre et Marie Curie (Paris VI) |
| 19 | * |
| 20 | * from |
| 21 | * |
| 22 | * linux/fs/minix/namei.c |
| 23 | * |
| 24 | * Copyright (C) 1991, 1992 Linus Torvalds |
| 25 | * |
| 26 | * Big-endian to little-endian byte-swapping/bitmaps by |
| 27 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
| 28 | */ |
| 29 | |
| 30 | #include <linux/time.h> |
| 31 | #include <linux/fs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include <linux/smp_lock.h> |
Mike Frysinger | e542059 | 2008-02-08 04:21:31 -0800 | [diff] [blame] | 33 | |
| 34 | #include "ufs_fs.h" |
Christoph Hellwig | bcd6d4e | 2007-10-16 23:26:51 -0700 | [diff] [blame] | 35 | #include "ufs.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #include "util.h" |
| 37 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) |
| 39 | { |
| 40 | int err = ufs_add_link(dentry, inode); |
| 41 | if (!err) { |
| 42 | d_instantiate(dentry, inode); |
| 43 | return 0; |
| 44 | } |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 45 | inode_dec_link_count(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | iput(inode); |
| 47 | return err; |
| 48 | } |
| 49 | |
| 50 | static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) |
| 51 | { |
| 52 | struct inode * inode = NULL; |
| 53 | ino_t ino; |
| 54 | |
| 55 | if (dentry->d_name.len > UFS_MAXNAMLEN) |
| 56 | return ERR_PTR(-ENAMETOOLONG); |
| 57 | |
| 58 | lock_kernel(); |
Alexey Dobriyan | 0804970 | 2009-12-15 16:46:50 -0800 | [diff] [blame] | 59 | ino = ufs_inode_by_name(dir, &dentry->d_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | if (ino) { |
David Howells | b55c460 | 2008-02-07 00:15:48 -0800 | [diff] [blame] | 61 | inode = ufs_iget(dir->i_sb, ino); |
| 62 | if (IS_ERR(inode)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | unlock_kernel(); |
David Howells | b55c460 | 2008-02-07 00:15:48 -0800 | [diff] [blame] | 64 | return ERR_CAST(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | } |
| 66 | } |
| 67 | unlock_kernel(); |
| 68 | d_add(dentry, inode); |
| 69 | return NULL; |
| 70 | } |
| 71 | |
| 72 | /* |
| 73 | * By the time this is called, we already have created |
| 74 | * the directory cache entry for the new file, but it |
| 75 | * is so far negative - it has no inode. |
| 76 | * |
| 77 | * If the create succeeds, we fill in the inode information |
| 78 | * with d_instantiate(). |
| 79 | */ |
| 80 | static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, |
| 81 | struct nameidata *nd) |
| 82 | { |
Evgeniy Dushistov | abf5d15 | 2006-06-25 05:47:24 -0700 | [diff] [blame] | 83 | struct inode *inode; |
| 84 | int err; |
| 85 | |
| 86 | UFSD("BEGIN\n"); |
Christoph Hellwig | 907f455 | 2010-03-03 09:05:06 -0500 | [diff] [blame] | 87 | |
Evgeniy Dushistov | abf5d15 | 2006-06-25 05:47:24 -0700 | [diff] [blame] | 88 | inode = ufs_new_inode(dir, mode); |
| 89 | err = PTR_ERR(inode); |
| 90 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | if (!IS_ERR(inode)) { |
| 92 | inode->i_op = &ufs_file_inode_operations; |
| 93 | inode->i_fop = &ufs_file_operations; |
| 94 | inode->i_mapping->a_ops = &ufs_aops; |
| 95 | mark_inode_dirty(inode); |
| 96 | lock_kernel(); |
| 97 | err = ufs_add_nondir(dentry, inode); |
| 98 | unlock_kernel(); |
| 99 | } |
Evgeniy Dushistov | abf5d15 | 2006-06-25 05:47:24 -0700 | [diff] [blame] | 100 | UFSD("END: err=%d\n", err); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | return err; |
| 102 | } |
| 103 | |
| 104 | static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) |
| 105 | { |
| 106 | struct inode *inode; |
| 107 | int err; |
| 108 | |
| 109 | if (!old_valid_dev(rdev)) |
| 110 | return -EINVAL; |
Christoph Hellwig | 907f455 | 2010-03-03 09:05:06 -0500 | [diff] [blame] | 111 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | inode = ufs_new_inode(dir, mode); |
| 113 | err = PTR_ERR(inode); |
| 114 | if (!IS_ERR(inode)) { |
| 115 | init_special_inode(inode, mode, rdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev); |
| 117 | mark_inode_dirty(inode); |
| 118 | lock_kernel(); |
| 119 | err = ufs_add_nondir(dentry, inode); |
| 120 | unlock_kernel(); |
| 121 | } |
| 122 | return err; |
| 123 | } |
| 124 | |
| 125 | static int ufs_symlink (struct inode * dir, struct dentry * dentry, |
| 126 | const char * symname) |
| 127 | { |
| 128 | struct super_block * sb = dir->i_sb; |
| 129 | int err = -ENAMETOOLONG; |
| 130 | unsigned l = strlen(symname)+1; |
| 131 | struct inode * inode; |
| 132 | |
| 133 | if (l > sb->s_blocksize) |
Josh Triplett | 344fe78 | 2006-07-30 03:03:59 -0700 | [diff] [blame] | 134 | goto out_notlocked; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | |
| 136 | lock_kernel(); |
| 137 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); |
| 138 | err = PTR_ERR(inode); |
| 139 | if (IS_ERR(inode)) |
| 140 | goto out; |
| 141 | |
| 142 | if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) { |
| 143 | /* slow symlink */ |
Dmitry Monakhov | 311b954 | 2010-04-15 00:56:58 +0200 | [diff] [blame] | 144 | inode->i_op = &ufs_symlink_inode_operations; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | inode->i_mapping->a_ops = &ufs_aops; |
| 146 | err = page_symlink(inode, symname, l); |
| 147 | if (err) |
| 148 | goto out_fail; |
| 149 | } else { |
| 150 | /* fast symlink */ |
| 151 | inode->i_op = &ufs_fast_symlink_inode_operations; |
Duane Griffin | 723be1f | 2009-01-08 22:43:51 +0000 | [diff] [blame] | 152 | memcpy(UFS_I(inode)->i_u1.i_symlink, symname, l); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | inode->i_size = l-1; |
| 154 | } |
| 155 | mark_inode_dirty(inode); |
| 156 | |
| 157 | err = ufs_add_nondir(dentry, inode); |
| 158 | out: |
| 159 | unlock_kernel(); |
Josh Triplett | 344fe78 | 2006-07-30 03:03:59 -0700 | [diff] [blame] | 160 | out_notlocked: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | return err; |
| 162 | |
| 163 | out_fail: |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 164 | inode_dec_link_count(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | iput(inode); |
| 166 | goto out; |
| 167 | } |
| 168 | |
| 169 | static int ufs_link (struct dentry * old_dentry, struct inode * dir, |
| 170 | struct dentry *dentry) |
| 171 | { |
| 172 | struct inode *inode = old_dentry->d_inode; |
| 173 | int error; |
| 174 | |
| 175 | lock_kernel(); |
| 176 | if (inode->i_nlink >= UFS_LINK_MAX) { |
| 177 | unlock_kernel(); |
| 178 | return -EMLINK; |
| 179 | } |
| 180 | |
| 181 | inode->i_ctime = CURRENT_TIME_SEC; |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 182 | inode_inc_link_count(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | atomic_inc(&inode->i_count); |
| 184 | |
| 185 | error = ufs_add_nondir(dentry, inode); |
| 186 | unlock_kernel(); |
| 187 | return error; |
| 188 | } |
| 189 | |
| 190 | static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) |
| 191 | { |
| 192 | struct inode * inode; |
| 193 | int err = -EMLINK; |
| 194 | |
| 195 | if (dir->i_nlink >= UFS_LINK_MAX) |
| 196 | goto out; |
| 197 | |
| 198 | lock_kernel(); |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 199 | inode_inc_link_count(dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | |
| 201 | inode = ufs_new_inode(dir, S_IFDIR|mode); |
| 202 | err = PTR_ERR(inode); |
| 203 | if (IS_ERR(inode)) |
| 204 | goto out_dir; |
| 205 | |
| 206 | inode->i_op = &ufs_dir_inode_operations; |
| 207 | inode->i_fop = &ufs_dir_operations; |
Evgeniy Dushistov | 826843a | 2006-06-25 05:47:21 -0700 | [diff] [blame] | 208 | inode->i_mapping->a_ops = &ufs_aops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 210 | inode_inc_link_count(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | |
| 212 | err = ufs_make_empty(inode, dir); |
| 213 | if (err) |
| 214 | goto out_fail; |
| 215 | |
| 216 | err = ufs_add_link(dentry, inode); |
| 217 | if (err) |
| 218 | goto out_fail; |
| 219 | unlock_kernel(); |
| 220 | |
| 221 | d_instantiate(dentry, inode); |
| 222 | out: |
| 223 | return err; |
| 224 | |
| 225 | out_fail: |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 226 | inode_dec_link_count(inode); |
| 227 | inode_dec_link_count(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | iput (inode); |
| 229 | out_dir: |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 230 | inode_dec_link_count(dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | unlock_kernel(); |
| 232 | goto out; |
| 233 | } |
| 234 | |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 235 | static int ufs_unlink(struct inode *dir, struct dentry *dentry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | { |
| 237 | struct inode * inode = dentry->d_inode; |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 238 | struct ufs_dir_entry *de; |
| 239 | struct page *page; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | int err = -ENOENT; |
| 241 | |
Alexey Dobriyan | 0804970 | 2009-12-15 16:46:50 -0800 | [diff] [blame] | 242 | de = ufs_find_entry(dir, &dentry->d_name, &page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | if (!de) |
| 244 | goto out; |
| 245 | |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 246 | err = ufs_delete_entry(dir, de, page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | if (err) |
| 248 | goto out; |
| 249 | |
| 250 | inode->i_ctime = dir->i_ctime; |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 251 | inode_dec_link_count(inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | err = 0; |
| 253 | out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | return err; |
| 255 | } |
| 256 | |
| 257 | static int ufs_rmdir (struct inode * dir, struct dentry *dentry) |
| 258 | { |
| 259 | struct inode * inode = dentry->d_inode; |
| 260 | int err= -ENOTEMPTY; |
| 261 | |
| 262 | lock_kernel(); |
| 263 | if (ufs_empty_dir (inode)) { |
| 264 | err = ufs_unlink(dir, dentry); |
| 265 | if (!err) { |
| 266 | inode->i_size = 0; |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 267 | inode_dec_link_count(inode); |
| 268 | inode_dec_link_count(dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | } |
| 270 | } |
| 271 | unlock_kernel(); |
| 272 | return err; |
| 273 | } |
| 274 | |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 275 | static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 276 | struct inode *new_dir, struct dentry *new_dentry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | { |
| 278 | struct inode *old_inode = old_dentry->d_inode; |
| 279 | struct inode *new_inode = new_dentry->d_inode; |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 280 | struct page *dir_page = NULL; |
| 281 | struct ufs_dir_entry * dir_de = NULL; |
| 282 | struct page *old_page; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | struct ufs_dir_entry *old_de; |
| 284 | int err = -ENOENT; |
| 285 | |
Alexey Dobriyan | 0804970 | 2009-12-15 16:46:50 -0800 | [diff] [blame] | 286 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | if (!old_de) |
| 288 | goto out; |
| 289 | |
| 290 | if (S_ISDIR(old_inode->i_mode)) { |
| 291 | err = -EIO; |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 292 | dir_de = ufs_dotdot(old_inode, &dir_page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | if (!dir_de) |
| 294 | goto out_old; |
| 295 | } |
| 296 | |
| 297 | if (new_inode) { |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 298 | struct page *new_page; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | struct ufs_dir_entry *new_de; |
| 300 | |
| 301 | err = -ENOTEMPTY; |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 302 | if (dir_de && !ufs_empty_dir(new_inode)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | goto out_dir; |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 304 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | err = -ENOENT; |
Alexey Dobriyan | 0804970 | 2009-12-15 16:46:50 -0800 | [diff] [blame] | 306 | new_de = ufs_find_entry(new_dir, &new_dentry->d_name, &new_page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | if (!new_de) |
| 308 | goto out_dir; |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 309 | inode_inc_link_count(old_inode); |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 310 | ufs_set_link(new_dir, new_de, new_page, old_inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | new_inode->i_ctime = CURRENT_TIME_SEC; |
| 312 | if (dir_de) |
Dave Hansen | 9a53c3a | 2006-09-30 23:29:03 -0700 | [diff] [blame] | 313 | drop_nlink(new_inode); |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 314 | inode_dec_link_count(new_inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | } else { |
| 316 | if (dir_de) { |
| 317 | err = -EMLINK; |
| 318 | if (new_dir->i_nlink >= UFS_LINK_MAX) |
| 319 | goto out_dir; |
| 320 | } |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 321 | inode_inc_link_count(old_inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | err = ufs_add_link(new_dentry, old_inode); |
| 323 | if (err) { |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 324 | inode_dec_link_count(old_inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | goto out_dir; |
| 326 | } |
| 327 | if (dir_de) |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 328 | inode_inc_link_count(new_dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | } |
| 330 | |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 331 | /* |
| 332 | * Like most other Unix systems, set the ctime for inodes on a |
| 333 | * rename. |
| 334 | * inode_dec_link_count() will mark the inode dirty. |
| 335 | */ |
| 336 | old_inode->i_ctime = CURRENT_TIME_SEC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 338 | ufs_delete_entry(old_dir, old_de, old_page); |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 339 | inode_dec_link_count(old_inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | |
| 341 | if (dir_de) { |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 342 | ufs_set_link(old_inode, dir_de, dir_page, new_dir); |
Alexey Dobriyan | 3257545 | 2006-03-23 03:00:53 -0800 | [diff] [blame] | 343 | inode_dec_link_count(old_dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | return 0; |
| 346 | |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 347 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | out_dir: |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 349 | if (dir_de) { |
| 350 | kunmap(dir_page); |
| 351 | page_cache_release(dir_page); |
| 352 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | out_old: |
Evgeniy Dushistov | b71034e | 2006-06-25 05:47:22 -0700 | [diff] [blame] | 354 | kunmap(old_page); |
| 355 | page_cache_release(old_page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | return err; |
| 358 | } |
| 359 | |
Arjan van de Ven | c5ef1c4 | 2007-02-12 00:55:40 -0800 | [diff] [blame] | 360 | const struct inode_operations ufs_dir_inode_operations = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | .create = ufs_create, |
| 362 | .lookup = ufs_lookup, |
| 363 | .link = ufs_link, |
| 364 | .unlink = ufs_unlink, |
| 365 | .symlink = ufs_symlink, |
| 366 | .mkdir = ufs_mkdir, |
| 367 | .rmdir = ufs_rmdir, |
| 368 | .mknod = ufs_mknod, |
| 369 | .rename = ufs_rename, |
| 370 | }; |