diff options
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_export.c | 5 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 55 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2.c | 62 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2.h | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_rename.c | 82 | ||||
-rw-r--r-- | fs/xfs/xfs_types.h | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_utils.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_utils.h | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 121 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.h | 23 |
12 files changed, 183 insertions, 203 deletions
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index 66a9a9e76cbe..265f0168ab76 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "xfs_trans.h" | 22 | #include "xfs_trans.h" |
23 | #include "xfs_sb.h" | 23 | #include "xfs_sb.h" |
24 | #include "xfs_ag.h" | 24 | #include "xfs_ag.h" |
25 | #include "xfs_dir2.h" | ||
25 | #include "xfs_dmapi.h" | 26 | #include "xfs_dmapi.h" |
26 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
27 | #include "xfs_export.h" | 28 | #include "xfs_export.h" |
@@ -30,8 +31,6 @@ | |||
30 | #include "xfs_inode.h" | 31 | #include "xfs_inode.h" |
31 | #include "xfs_vfsops.h" | 32 | #include "xfs_vfsops.h" |
32 | 33 | ||
33 | static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, }; | ||
34 | |||
35 | /* | 34 | /* |
36 | * Note that we only accept fileids which are long enough rather than allow | 35 | * Note that we only accept fileids which are long enough rather than allow |
37 | * the parent generation number to default to zero. XFS considers zero a | 36 | * the parent generation number to default to zero. XFS considers zero a |
@@ -216,7 +215,7 @@ xfs_fs_get_parent( | |||
216 | struct xfs_inode *cip; | 215 | struct xfs_inode *cip; |
217 | struct dentry *parent; | 216 | struct dentry *parent; |
218 | 217 | ||
219 | error = xfs_lookup(XFS_I(child->d_inode), &dotdot, &cip); | 218 | error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip); |
220 | if (unlikely(error)) | 219 | if (unlikely(error)) |
221 | return ERR_PTR(-error); | 220 | return ERR_PTR(-error); |
222 | 221 | ||
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 41e7baabfd9f..0c958cf77758 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -239,6 +239,15 @@ xfs_init_security( | |||
239 | return error; | 239 | return error; |
240 | } | 240 | } |
241 | 241 | ||
242 | static void | ||
243 | xfs_dentry_to_name( | ||
244 | struct xfs_name *namep, | ||
245 | struct dentry *dentry) | ||
246 | { | ||
247 | namep->name = dentry->d_name.name; | ||
248 | namep->len = dentry->d_name.len; | ||
249 | } | ||
250 | |||
242 | STATIC void | 251 | STATIC void |
243 | xfs_cleanup_inode( | 252 | xfs_cleanup_inode( |
244 | struct inode *dir, | 253 | struct inode *dir, |
@@ -246,20 +255,19 @@ xfs_cleanup_inode( | |||
246 | struct dentry *dentry, | 255 | struct dentry *dentry, |
247 | int mode) | 256 | int mode) |
248 | { | 257 | { |
249 | struct dentry teardown = {}; | 258 | struct xfs_name teardown; |
250 | 259 | ||
251 | /* Oh, the horror. | 260 | /* Oh, the horror. |
252 | * If we can't add the ACL or we fail in | 261 | * If we can't add the ACL or we fail in |
253 | * xfs_init_security we must back out. | 262 | * xfs_init_security we must back out. |
254 | * ENOSPC can hit here, among other things. | 263 | * ENOSPC can hit here, among other things. |
255 | */ | 264 | */ |
256 | teardown.d_inode = inode; | 265 | xfs_dentry_to_name(&teardown, dentry); |
257 | teardown.d_name = dentry->d_name; | ||
258 | 266 | ||
259 | if (S_ISDIR(mode)) | 267 | if (S_ISDIR(mode)) |
260 | xfs_rmdir(XFS_I(dir), &teardown); | 268 | xfs_rmdir(XFS_I(dir), &teardown, XFS_I(inode)); |
261 | else | 269 | else |
262 | xfs_remove(XFS_I(dir), &teardown); | 270 | xfs_remove(XFS_I(dir), &teardown, XFS_I(inode)); |
263 | iput(inode); | 271 | iput(inode); |
264 | } | 272 | } |
265 | 273 | ||
@@ -273,6 +281,7 @@ xfs_vn_mknod( | |||
273 | struct inode *inode; | 281 | struct inode *inode; |
274 | struct xfs_inode *ip = NULL; | 282 | struct xfs_inode *ip = NULL; |
275 | xfs_acl_t *default_acl = NULL; | 283 | xfs_acl_t *default_acl = NULL; |
284 | struct xfs_name name; | ||
276 | attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; | 285 | attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; |
277 | int error; | 286 | int error; |
278 | 287 | ||
@@ -293,6 +302,8 @@ xfs_vn_mknod( | |||
293 | } | 302 | } |
294 | } | 303 | } |
295 | 304 | ||
305 | xfs_dentry_to_name(&name, dentry); | ||
306 | |||
296 | if (IS_POSIXACL(dir) && !default_acl) | 307 | if (IS_POSIXACL(dir) && !default_acl) |
297 | mode &= ~current->fs->umask; | 308 | mode &= ~current->fs->umask; |
298 | 309 | ||
@@ -303,10 +314,10 @@ xfs_vn_mknod( | |||
303 | case S_IFSOCK: | 314 | case S_IFSOCK: |
304 | rdev = sysv_encode_dev(rdev); | 315 | rdev = sysv_encode_dev(rdev); |
305 | case S_IFREG: | 316 | case S_IFREG: |
306 | error = xfs_create(XFS_I(dir), dentry, mode, rdev, &ip, NULL); | 317 | error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL); |
307 | break; | 318 | break; |
308 | case S_IFDIR: | 319 | case S_IFDIR: |
309 | error = xfs_mkdir(XFS_I(dir), dentry, mode, &ip, NULL); | 320 | error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL); |
310 | break; | 321 | break; |
311 | default: | 322 | default: |
312 | error = EINVAL; | 323 | error = EINVAL; |
@@ -371,12 +382,14 @@ xfs_vn_lookup( | |||
371 | struct nameidata *nd) | 382 | struct nameidata *nd) |
372 | { | 383 | { |
373 | struct xfs_inode *cip; | 384 | struct xfs_inode *cip; |
385 | struct xfs_name name; | ||
374 | int error; | 386 | int error; |
375 | 387 | ||
376 | if (dentry->d_name.len >= MAXNAMELEN) | 388 | if (dentry->d_name.len >= MAXNAMELEN) |
377 | return ERR_PTR(-ENAMETOOLONG); | 389 | return ERR_PTR(-ENAMETOOLONG); |
378 | 390 | ||
379 | error = xfs_lookup(XFS_I(dir), dentry, &cip); | 391 | xfs_dentry_to_name(&name, dentry); |
392 | error = xfs_lookup(XFS_I(dir), &name, &cip); | ||
380 | if (unlikely(error)) { | 393 | if (unlikely(error)) { |
381 | if (unlikely(error != ENOENT)) | 394 | if (unlikely(error != ENOENT)) |
382 | return ERR_PTR(-error); | 395 | return ERR_PTR(-error); |
@@ -394,12 +407,14 @@ xfs_vn_link( | |||
394 | struct dentry *dentry) | 407 | struct dentry *dentry) |
395 | { | 408 | { |
396 | struct inode *inode; /* inode of guy being linked to */ | 409 | struct inode *inode; /* inode of guy being linked to */ |
410 | struct xfs_name name; | ||
397 | int error; | 411 | int error; |
398 | 412 | ||
399 | inode = old_dentry->d_inode; | 413 | inode = old_dentry->d_inode; |
414 | xfs_dentry_to_name(&name, dentry); | ||
400 | 415 | ||
401 | igrab(inode); | 416 | igrab(inode); |
402 | error = xfs_link(XFS_I(dir), XFS_I(inode), dentry); | 417 | error = xfs_link(XFS_I(dir), XFS_I(inode), &name); |
403 | if (unlikely(error)) { | 418 | if (unlikely(error)) { |
404 | iput(inode); | 419 | iput(inode); |
405 | return -error; | 420 | return -error; |
@@ -417,11 +432,13 @@ xfs_vn_unlink( | |||
417 | struct dentry *dentry) | 432 | struct dentry *dentry) |
418 | { | 433 | { |
419 | struct inode *inode; | 434 | struct inode *inode; |
435 | struct xfs_name name; | ||
420 | int error; | 436 | int error; |
421 | 437 | ||
422 | inode = dentry->d_inode; | 438 | inode = dentry->d_inode; |
439 | xfs_dentry_to_name(&name, dentry); | ||
423 | 440 | ||
424 | error = xfs_remove(XFS_I(dir), dentry); | 441 | error = xfs_remove(XFS_I(dir), &name, XFS_I(inode)); |
425 | if (likely(!error)) { | 442 | if (likely(!error)) { |
426 | xfs_validate_fields(dir); /* size needs update */ | 443 | xfs_validate_fields(dir); /* size needs update */ |
427 | xfs_validate_fields(inode); | 444 | xfs_validate_fields(inode); |
@@ -437,14 +454,15 @@ xfs_vn_symlink( | |||
437 | { | 454 | { |
438 | struct inode *inode; | 455 | struct inode *inode; |
439 | struct xfs_inode *cip = NULL; | 456 | struct xfs_inode *cip = NULL; |
457 | struct xfs_name name; | ||
440 | int error; | 458 | int error; |
441 | mode_t mode; | 459 | mode_t mode; |
442 | 460 | ||
443 | mode = S_IFLNK | | 461 | mode = S_IFLNK | |
444 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); | 462 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); |
463 | xfs_dentry_to_name(&name, dentry); | ||
445 | 464 | ||
446 | error = xfs_symlink(XFS_I(dir), dentry, (char *)symname, mode, | 465 | error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip, NULL); |
447 | &cip, NULL); | ||
448 | if (unlikely(error)) | 466 | if (unlikely(error)) |
449 | goto out; | 467 | goto out; |
450 | 468 | ||
@@ -471,9 +489,12 @@ xfs_vn_rmdir( | |||
471 | struct dentry *dentry) | 489 | struct dentry *dentry) |
472 | { | 490 | { |
473 | struct inode *inode = dentry->d_inode; | 491 | struct inode *inode = dentry->d_inode; |
492 | struct xfs_name name; | ||
474 | int error; | 493 | int error; |
475 | 494 | ||
476 | error = xfs_rmdir(XFS_I(dir), dentry); | 495 | xfs_dentry_to_name(&name, dentry); |
496 | |||
497 | error = xfs_rmdir(XFS_I(dir), &name, XFS_I(inode)); | ||
477 | if (likely(!error)) { | 498 | if (likely(!error)) { |
478 | xfs_validate_fields(inode); | 499 | xfs_validate_fields(inode); |
479 | xfs_validate_fields(dir); | 500 | xfs_validate_fields(dir); |
@@ -489,9 +510,15 @@ xfs_vn_rename( | |||
489 | struct dentry *ndentry) | 510 | struct dentry *ndentry) |
490 | { | 511 | { |
491 | struct inode *new_inode = ndentry->d_inode; | 512 | struct inode *new_inode = ndentry->d_inode; |
513 | struct xfs_name oname; | ||
514 | struct xfs_name nname; | ||
492 | int error; | 515 | int error; |
493 | 516 | ||
494 | error = xfs_rename(XFS_I(odir), odentry, XFS_I(ndir), ndentry); | 517 | xfs_dentry_to_name(&oname, odentry); |
518 | xfs_dentry_to_name(&nname, ndentry); | ||
519 | |||
520 | error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), | ||
521 | XFS_I(ndir), &nname); | ||
495 | if (likely(!error)) { | 522 | if (likely(!error)) { |
496 | if (new_inode) | 523 | if (new_inode) |
497 | xfs_validate_fields(new_inode); | 524 | xfs_validate_fields(new_inode); |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index dbb8a5d27f78..8b4d63ce8694 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -23,8 +23,6 @@ struct bhv_vattr; | |||
23 | struct xfs_iomap; | 23 | struct xfs_iomap; |
24 | struct attrlist_cursor_kern; | 24 | struct attrlist_cursor_kern; |
25 | 25 | ||
26 | typedef struct dentry bhv_vname_t; | ||
27 | typedef __u64 bhv_vnumber_t; | ||
28 | typedef struct inode bhv_vnode_t; | 26 | typedef struct inode bhv_vnode_t; |
29 | 27 | ||
30 | #define VN_ISLNK(vp) S_ISLNK((vp)->i_mode) | 28 | #define VN_ISLNK(vp) S_ISLNK((vp)->i_mode) |
@@ -211,13 +209,6 @@ static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp) | |||
211 | } | 209 | } |
212 | 210 | ||
213 | /* | 211 | /* |
214 | * Vname handling macros. | ||
215 | */ | ||
216 | #define VNAME(dentry) ((char *) (dentry)->d_name.name) | ||
217 | #define VNAMELEN(dentry) ((dentry)->d_name.len) | ||
218 | #define VNAME_TO_INODE(dentry) (XFS_I((dentry)->d_inode)) | ||
219 | |||
220 | /* | ||
221 | * Dealing with bad inodes | 212 | * Dealing with bad inodes |
222 | */ | 213 | */ |
223 | static inline int VN_BAD(bhv_vnode_t *vp) | 214 | static inline int VN_BAD(bhv_vnode_t *vp) |
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index e92e73f0e6af..7cb26529766b 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include "xfs_error.h" | 44 | #include "xfs_error.h" |
45 | #include "xfs_vnodeops.h" | 45 | #include "xfs_vnodeops.h" |
46 | 46 | ||
47 | struct xfs_name xfs_name_dotdot = {"..", 2}; | ||
47 | 48 | ||
48 | void | 49 | void |
49 | xfs_dir_mount( | 50 | xfs_dir_mount( |
@@ -146,8 +147,7 @@ int | |||
146 | xfs_dir_createname( | 147 | xfs_dir_createname( |
147 | xfs_trans_t *tp, | 148 | xfs_trans_t *tp, |
148 | xfs_inode_t *dp, | 149 | xfs_inode_t *dp, |
149 | char *name, | 150 | struct xfs_name *name, |
150 | int namelen, | ||
151 | xfs_ino_t inum, /* new entry inode number */ | 151 | xfs_ino_t inum, /* new entry inode number */ |
152 | xfs_fsblock_t *first, /* bmap's firstblock */ | 152 | xfs_fsblock_t *first, /* bmap's firstblock */ |
153 | xfs_bmap_free_t *flist, /* bmap's freeblock list */ | 153 | xfs_bmap_free_t *flist, /* bmap's freeblock list */ |
@@ -162,9 +162,9 @@ xfs_dir_createname( | |||
162 | return rval; | 162 | return rval; |
163 | XFS_STATS_INC(xs_dir_create); | 163 | XFS_STATS_INC(xs_dir_create); |
164 | 164 | ||
165 | args.name = name; | 165 | args.name = name->name; |
166 | args.namelen = namelen; | 166 | args.namelen = name->len; |
167 | args.hashval = xfs_da_hashname(name, namelen); | 167 | args.hashval = xfs_da_hashname(name->name, name->len); |
168 | args.inumber = inum; | 168 | args.inumber = inum; |
169 | args.dp = dp; | 169 | args.dp = dp; |
170 | args.firstblock = first; | 170 | args.firstblock = first; |
@@ -197,8 +197,7 @@ int | |||
197 | xfs_dir_lookup( | 197 | xfs_dir_lookup( |
198 | xfs_trans_t *tp, | 198 | xfs_trans_t *tp, |
199 | xfs_inode_t *dp, | 199 | xfs_inode_t *dp, |
200 | char *name, | 200 | struct xfs_name *name, |
201 | int namelen, | ||
202 | xfs_ino_t *inum) /* out: inode number */ | 201 | xfs_ino_t *inum) /* out: inode number */ |
203 | { | 202 | { |
204 | xfs_da_args_t args; | 203 | xfs_da_args_t args; |
@@ -207,18 +206,14 @@ xfs_dir_lookup( | |||
207 | 206 | ||
208 | ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); | 207 | ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); |
209 | XFS_STATS_INC(xs_dir_lookup); | 208 | XFS_STATS_INC(xs_dir_lookup); |
209 | memset(&args, 0, sizeof(xfs_da_args_t)); | ||
210 | 210 | ||
211 | args.name = name; | 211 | args.name = name->name; |
212 | args.namelen = namelen; | 212 | args.namelen = name->len; |
213 | args.hashval = xfs_da_hashname(name, namelen); | 213 | args.hashval = xfs_da_hashname(name->name, name->len); |
214 | args.inumber = 0; | ||
215 | args.dp = dp; | 214 | args.dp = dp; |
216 | args.firstblock = NULL; | ||
217 | args.flist = NULL; | ||
218 | args.total = 0; | ||
219 | args.whichfork = XFS_DATA_FORK; | 215 | args.whichfork = XFS_DATA_FORK; |
220 | args.trans = tp; | 216 | args.trans = tp; |
221 | args.justcheck = args.addname = 0; | ||
222 | args.oknoent = 1; | 217 | args.oknoent = 1; |
223 | 218 | ||
224 | if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) | 219 | if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) |
@@ -247,8 +242,7 @@ int | |||
247 | xfs_dir_removename( | 242 | xfs_dir_removename( |
248 | xfs_trans_t *tp, | 243 | xfs_trans_t *tp, |
249 | xfs_inode_t *dp, | 244 | xfs_inode_t *dp, |
250 | char *name, | 245 | struct xfs_name *name, |
251 | int namelen, | ||
252 | xfs_ino_t ino, | 246 | xfs_ino_t ino, |
253 | xfs_fsblock_t *first, /* bmap's firstblock */ | 247 | xfs_fsblock_t *first, /* bmap's firstblock */ |
254 | xfs_bmap_free_t *flist, /* bmap's freeblock list */ | 248 | xfs_bmap_free_t *flist, /* bmap's freeblock list */ |
@@ -261,9 +255,9 @@ xfs_dir_removename( | |||
261 | ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); | 255 | ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); |
262 | XFS_STATS_INC(xs_dir_remove); | 256 | XFS_STATS_INC(xs_dir_remove); |
263 | 257 | ||
264 | args.name = name; | 258 | args.name = name->name; |
265 | args.namelen = namelen; | 259 | args.namelen = name->len; |
266 | args.hashval = xfs_da_hashname(name, namelen); | 260 | args.hashval = xfs_da_hashname(name->name, name->len); |
267 | args.inumber = ino; | 261 | args.inumber = ino; |
268 | args.dp = dp; | 262 | args.dp = dp; |
269 | args.firstblock = first; | 263 | args.firstblock = first; |
@@ -329,8 +323,7 @@ int | |||
329 | xfs_dir_replace( | 323 | xfs_dir_replace( |
330 | xfs_trans_t *tp, | 324 | xfs_trans_t *tp, |
331 | xfs_inode_t *dp, | 325 | xfs_inode_t *dp, |
332 | char *name, /* name of entry to replace */ | 326 | struct xfs_name *name, /* name of entry to replace */ |
333 | int namelen, | ||
334 | xfs_ino_t inum, /* new inode number */ | 327 | xfs_ino_t inum, /* new inode number */ |
335 | xfs_fsblock_t *first, /* bmap's firstblock */ | 328 | xfs_fsblock_t *first, /* bmap's firstblock */ |
336 | xfs_bmap_free_t *flist, /* bmap's freeblock list */ | 329 | xfs_bmap_free_t *flist, /* bmap's freeblock list */ |
@@ -345,9 +338,9 @@ xfs_dir_replace( | |||
345 | if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) | 338 | if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) |
346 | return rval; | 339 | return rval; |
347 | 340 | ||
348 | args.name = name; | 341 | args.name = name->name; |
349 | args.namelen = namelen; | 342 | args.namelen = name->len; |
350 | args.hashval = xfs_da_hashname(name, namelen); | 343 | args.hashval = xfs_da_hashname(name->name, name->len); |
351 | args.inumber = inum; | 344 | args.inumber = inum; |
352 | args.dp = dp; | 345 | args.dp = dp; |
353 | args.firstblock = first; | 346 | args.firstblock = first; |
@@ -374,28 +367,29 @@ xfs_dir_replace( | |||
374 | 367 | ||
375 | /* | 368 | /* |
376 | * See if this entry can be added to the directory without allocating space. | 369 | * See if this entry can be added to the directory without allocating space. |
370 | * First checks that the caller couldn't reserve enough space (resblks = 0). | ||
377 | */ | 371 | */ |
378 | int | 372 | int |
379 | xfs_dir_canenter( | 373 | xfs_dir_canenter( |
380 | xfs_trans_t *tp, | 374 | xfs_trans_t *tp, |
381 | xfs_inode_t *dp, | 375 | xfs_inode_t *dp, |
382 | char *name, /* name of entry to add */ | 376 | struct xfs_name *name, /* name of entry to add */ |
383 | int namelen) | 377 | uint resblks) |
384 | { | 378 | { |
385 | xfs_da_args_t args; | 379 | xfs_da_args_t args; |
386 | int rval; | 380 | int rval; |
387 | int v; /* type-checking value */ | 381 | int v; /* type-checking value */ |
388 | 382 | ||
383 | if (resblks) | ||
384 | return 0; | ||
385 | |||
389 | ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); | 386 | ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); |
387 | memset(&args, 0, sizeof(xfs_da_args_t)); | ||
390 | 388 | ||
391 | args.name = name; | 389 | args.name = name->name; |
392 | args.namelen = namelen; | 390 | args.namelen = name->len; |
393 | args.hashval = xfs_da_hashname(name, namelen); | 391 | args.hashval = xfs_da_hashname(name->name, name->len); |
394 | args.inumber = 0; | ||
395 | args.dp = dp; | 392 | args.dp = dp; |
396 | args.firstblock = NULL; | ||
397 | args.flist = NULL; | ||
398 | args.total = 0; | ||
399 | args.whichfork = XFS_DATA_FORK; | 393 | args.whichfork = XFS_DATA_FORK; |
400 | args.trans = tp; | 394 | args.trans = tp; |
401 | args.justcheck = args.addname = args.oknoent = 1; | 395 | args.justcheck = args.addname = args.oknoent = 1; |
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h index b265197e74cf..6392f939029f 100644 --- a/fs/xfs/xfs_dir2.h +++ b/fs/xfs/xfs_dir2.h | |||
@@ -59,6 +59,8 @@ typedef __uint32_t xfs_dir2_db_t; | |||
59 | */ | 59 | */ |
60 | typedef xfs_off_t xfs_dir2_off_t; | 60 | typedef xfs_off_t xfs_dir2_off_t; |
61 | 61 | ||
62 | extern struct xfs_name xfs_name_dotdot; | ||
63 | |||
62 | /* | 64 | /* |
63 | * Generic directory interface routines | 65 | * Generic directory interface routines |
64 | */ | 66 | */ |
@@ -68,21 +70,21 @@ extern int xfs_dir_isempty(struct xfs_inode *dp); | |||
68 | extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp, | 70 | extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp, |
69 | struct xfs_inode *pdp); | 71 | struct xfs_inode *pdp); |
70 | extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp, | 72 | extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp, |
71 | char *name, int namelen, xfs_ino_t inum, | 73 | struct xfs_name *name, xfs_ino_t inum, |
72 | xfs_fsblock_t *first, | 74 | xfs_fsblock_t *first, |
73 | struct xfs_bmap_free *flist, xfs_extlen_t tot); | 75 | struct xfs_bmap_free *flist, xfs_extlen_t tot); |
74 | extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp, | 76 | extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp, |
75 | char *name, int namelen, xfs_ino_t *inum); | 77 | struct xfs_name *name, xfs_ino_t *inum); |
76 | extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp, | 78 | extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp, |
77 | char *name, int namelen, xfs_ino_t ino, | 79 | struct xfs_name *name, xfs_ino_t ino, |
78 | xfs_fsblock_t *first, | 80 | xfs_fsblock_t *first, |
79 | struct xfs_bmap_free *flist, xfs_extlen_t tot); | 81 | struct xfs_bmap_free *flist, xfs_extlen_t tot); |
80 | extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp, | 82 | extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp, |
81 | char *name, int namelen, xfs_ino_t inum, | 83 | struct xfs_name *name, xfs_ino_t inum, |
82 | xfs_fsblock_t *first, | 84 | xfs_fsblock_t *first, |
83 | struct xfs_bmap_free *flist, xfs_extlen_t tot); | 85 | struct xfs_bmap_free *flist, xfs_extlen_t tot); |
84 | extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp, | 86 | extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp, |
85 | char *name, int namelen); | 87 | struct xfs_name *name, uint resblks); |
86 | extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino); | 88 | extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino); |
87 | 89 | ||
88 | /* | 90 | /* |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 77b39f66cead..1ed575110ff0 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -73,7 +73,7 @@ typedef int (*xfs_send_destroy_t)(struct xfs_inode *, dm_right_t); | |||
73 | typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *, | 73 | typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *, |
74 | struct xfs_inode *, dm_right_t, | 74 | struct xfs_inode *, dm_right_t, |
75 | struct xfs_inode *, dm_right_t, | 75 | struct xfs_inode *, dm_right_t, |
76 | char *, char *, mode_t, int, int); | 76 | const char *, const char *, mode_t, int, int); |
77 | typedef int (*xfs_send_mount_t)(struct xfs_mount *, dm_right_t, | 77 | typedef int (*xfs_send_mount_t)(struct xfs_mount *, dm_right_t, |
78 | char *, char *); | 78 | char *, char *); |
79 | typedef void (*xfs_send_unmount_t)(struct xfs_mount *, struct xfs_inode *, | 79 | typedef void (*xfs_send_unmount_t)(struct xfs_mount *, struct xfs_inode *, |
@@ -401,7 +401,7 @@ typedef struct xfs_mount { | |||
401 | 401 | ||
402 | /* | 402 | /* |
403 | * Allow large block sizes to be reported to userspace programs if the | 403 | * Allow large block sizes to be reported to userspace programs if the |
404 | * "largeio" mount option is used. | 404 | * "largeio" mount option is used. |
405 | * | 405 | * |
406 | * If compatibility mode is specified, simply return the basic unit of caching | 406 | * If compatibility mode is specified, simply return the basic unit of caching |
407 | * so that we don't get inefficient read/modify/write I/O from user apps. | 407 | * so that we don't get inefficient read/modify/write I/O from user apps. |
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index c4d0bac56a5a..ee371890d85d 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -83,26 +83,23 @@ int xfs_rename_skip, xfs_rename_nskip; | |||
83 | */ | 83 | */ |
84 | STATIC int | 84 | STATIC int |
85 | xfs_lock_for_rename( | 85 | xfs_lock_for_rename( |
86 | xfs_inode_t *dp1, /* old (source) directory inode */ | 86 | xfs_inode_t *dp1, /* in: old (source) directory inode */ |
87 | xfs_inode_t *dp2, /* new (target) directory inode */ | 87 | xfs_inode_t *dp2, /* in: new (target) directory inode */ |
88 | bhv_vname_t *vname1,/* old entry name */ | 88 | xfs_inode_t *ip1, /* in: inode of old entry */ |
89 | bhv_vname_t *vname2,/* new entry name */ | 89 | struct xfs_name *name2, /* in: new entry name */ |
90 | xfs_inode_t **ipp1, /* inode of old entry */ | 90 | xfs_inode_t **ipp2, /* out: inode of new entry, if it |
91 | xfs_inode_t **ipp2, /* inode of new entry, if it | ||
92 | already exists, NULL otherwise. */ | 91 | already exists, NULL otherwise. */ |
93 | xfs_inode_t **i_tab,/* array of inode returned, sorted */ | 92 | xfs_inode_t **i_tab,/* out: array of inode returned, sorted */ |
94 | int *num_inodes) /* number of inodes in array */ | 93 | int *num_inodes) /* out: number of inodes in array */ |
95 | { | 94 | { |
96 | xfs_inode_t *ip1 = VNAME_TO_INODE(vname1); | 95 | xfs_inode_t *ip2 = NULL; |
97 | xfs_inode_t *ip2, *temp; | 96 | xfs_inode_t *temp; |
98 | xfs_ino_t inum1, inum2; | 97 | xfs_ino_t inum1, inum2; |
99 | int error; | 98 | int error; |
100 | int i, j; | 99 | int i, j; |
101 | uint lock_mode; | 100 | uint lock_mode; |
102 | int diff_dirs = (dp1 != dp2); | 101 | int diff_dirs = (dp1 != dp2); |
103 | 102 | ||
104 | ip2 = NULL; | ||
105 | |||
106 | /* | 103 | /* |
107 | * First, find out the current inums of the entries so that we | 104 | * First, find out the current inums of the entries so that we |
108 | * can determine the initial locking order. We'll have to | 105 | * can determine the initial locking order. We'll have to |
@@ -115,17 +112,15 @@ xfs_lock_for_rename( | |||
115 | 112 | ||
116 | inum1 = ip1->i_ino; | 113 | inum1 = ip1->i_ino; |
117 | 114 | ||
118 | |||
119 | /* | 115 | /* |
120 | * Unlock dp1 and lock dp2 if they are different. | 116 | * Unlock dp1 and lock dp2 if they are different. |
121 | */ | 117 | */ |
122 | |||
123 | if (diff_dirs) { | 118 | if (diff_dirs) { |
124 | xfs_iunlock_map_shared(dp1, lock_mode); | 119 | xfs_iunlock_map_shared(dp1, lock_mode); |
125 | lock_mode = xfs_ilock_map_shared(dp2); | 120 | lock_mode = xfs_ilock_map_shared(dp2); |
126 | } | 121 | } |
127 | 122 | ||
128 | error = xfs_dir_lookup_int(dp2, lock_mode, vname2, &inum2, &ip2); | 123 | error = xfs_dir_lookup_int(dp2, lock_mode, name2, &inum2, &ip2); |
129 | if (error == ENOENT) { /* target does not need to exist. */ | 124 | if (error == ENOENT) { /* target does not need to exist. */ |
130 | inum2 = 0; | 125 | inum2 = 0; |
131 | } else if (error) { | 126 | } else if (error) { |
@@ -157,6 +152,7 @@ xfs_lock_for_rename( | |||
157 | *num_inodes = 4; | 152 | *num_inodes = 4; |
158 | i_tab[3] = ip2; | 153 | i_tab[3] = ip2; |
159 | } | 154 | } |
155 | *ipp2 = i_tab[3]; | ||
160 | 156 | ||
161 | /* | 157 | /* |
162 | * Sort the elements via bubble sort. (Remember, there are at | 158 | * Sort the elements via bubble sort. (Remember, there are at |
@@ -194,21 +190,6 @@ xfs_lock_for_rename( | |||
194 | xfs_lock_inodes(i_tab, *num_inodes, 0, XFS_ILOCK_SHARED); | 190 | xfs_lock_inodes(i_tab, *num_inodes, 0, XFS_ILOCK_SHARED); |
195 | } | 191 | } |
196 | 192 | ||
197 | /* | ||
198 | * Set the return value. Null out any unused entries in i_tab. | ||
199 | */ | ||
200 | *ipp1 = *ipp2 = NULL; | ||
201 | for (i=0; i < *num_inodes; i++) { | ||
202 | if (i_tab[i]->i_ino == inum1) { | ||
203 | *ipp1 = i_tab[i]; | ||
204 | } | ||
205 | if (i_tab[i]->i_ino == inum2) { | ||
206 | *ipp2 = i_tab[i]; | ||
207 | } | ||
208 | } | ||
209 | for (;i < 4; i++) { | ||
210 | i_tab[i] = NULL; | ||
211 | } | ||
212 | return 0; | 193 | return 0; |
213 | } | 194 | } |
214 | 195 | ||
@@ -218,12 +199,13 @@ xfs_lock_for_rename( | |||
218 | int | 199 | int |
219 | xfs_rename( | 200 | xfs_rename( |
220 | xfs_inode_t *src_dp, | 201 | xfs_inode_t *src_dp, |
221 | bhv_vname_t *src_vname, | 202 | struct xfs_name *src_name, |
203 | xfs_inode_t *src_ip, | ||
222 | xfs_inode_t *target_dp, | 204 | xfs_inode_t *target_dp, |
223 | bhv_vname_t *target_vname) | 205 | struct xfs_name *target_name) |
224 | { | 206 | { |
225 | xfs_trans_t *tp; | 207 | xfs_trans_t *tp; |
226 | xfs_inode_t *src_ip, *target_ip; | 208 | xfs_inode_t *target_ip; |
227 | xfs_mount_t *mp = src_dp->i_mount; | 209 | xfs_mount_t *mp = src_dp->i_mount; |
228 | int new_parent; /* moving to a new dir */ | 210 | int new_parent; /* moving to a new dir */ |
229 | int src_is_directory; /* src_name is a directory */ | 211 | int src_is_directory; /* src_name is a directory */ |
@@ -237,10 +219,6 @@ xfs_rename( | |||
237 | int spaceres; | 219 | int spaceres; |
238 | int target_link_zero = 0; | 220 | int target_link_zero = 0; |
239 | int num_inodes; | 221 | int num_inodes; |
240 | char *src_name = VNAME(src_vname); | ||
241 | char *target_name = VNAME(target_vname); | ||
242 | int src_namelen = VNAMELEN(src_vname); | ||
243 | int target_namelen = VNAMELEN(target_vname); | ||
244 | 222 | ||
245 | xfs_itrace_entry(src_dp); | 223 | xfs_itrace_entry(src_dp); |
246 | xfs_itrace_entry(target_dp); | 224 | xfs_itrace_entry(target_dp); |
@@ -250,7 +228,7 @@ xfs_rename( | |||
250 | error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME, | 228 | error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME, |
251 | src_dp, DM_RIGHT_NULL, | 229 | src_dp, DM_RIGHT_NULL, |
252 | target_dp, DM_RIGHT_NULL, | 230 | target_dp, DM_RIGHT_NULL, |
253 | src_name, target_name, | 231 | src_name->name, target_name->name, |
254 | 0, 0, 0); | 232 | 0, 0, 0); |
255 | if (error) { | 233 | if (error) { |
256 | return error; | 234 | return error; |
@@ -267,10 +245,8 @@ xfs_rename( | |||
267 | * does not exist in the source directory. | 245 | * does not exist in the source directory. |
268 | */ | 246 | */ |
269 | tp = NULL; | 247 | tp = NULL; |
270 | error = xfs_lock_for_rename(src_dp, target_dp, src_vname, | 248 | error = xfs_lock_for_rename(src_dp, target_dp, src_ip, target_name, |
271 | target_vname, &src_ip, &target_ip, inodes, | 249 | &target_ip, inodes, &num_inodes); |
272 | &num_inodes); | ||
273 | |||
274 | if (error) { | 250 | if (error) { |
275 | /* | 251 | /* |
276 | * We have nothing locked, no inode references, and | 252 | * We have nothing locked, no inode references, and |
@@ -316,7 +292,7 @@ xfs_rename( | |||
316 | XFS_BMAP_INIT(&free_list, &first_block); | 292 | XFS_BMAP_INIT(&free_list, &first_block); |
317 | tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME); | 293 | tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME); |
318 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; | 294 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; |
319 | spaceres = XFS_RENAME_SPACE_RES(mp, target_namelen); | 295 | spaceres = XFS_RENAME_SPACE_RES(mp, target_name->len); |
320 | error = xfs_trans_reserve(tp, spaceres, XFS_RENAME_LOG_RES(mp), 0, | 296 | error = xfs_trans_reserve(tp, spaceres, XFS_RENAME_LOG_RES(mp), 0, |
321 | XFS_TRANS_PERM_LOG_RES, XFS_RENAME_LOG_COUNT); | 297 | XFS_TRANS_PERM_LOG_RES, XFS_RENAME_LOG_COUNT); |
322 | if (error == ENOSPC) { | 298 | if (error == ENOSPC) { |
@@ -374,9 +350,8 @@ xfs_rename( | |||
374 | * If there's no space reservation, check the entry will | 350 | * If there's no space reservation, check the entry will |
375 | * fit before actually inserting it. | 351 | * fit before actually inserting it. |
376 | */ | 352 | */ |
377 | if (spaceres == 0 && | 353 | error = xfs_dir_canenter(tp, target_dp, target_name, spaceres); |
378 | (error = xfs_dir_canenter(tp, target_dp, target_name, | 354 | if (error) |
379 | target_namelen))) | ||
380 | goto error_return; | 355 | goto error_return; |
381 | /* | 356 | /* |
382 | * If target does not exist and the rename crosses | 357 | * If target does not exist and the rename crosses |
@@ -384,8 +359,8 @@ xfs_rename( | |||
384 | * to account for the ".." reference from the new entry. | 359 | * to account for the ".." reference from the new entry. |
385 | */ | 360 | */ |
386 | error = xfs_dir_createname(tp, target_dp, target_name, | 361 | error = xfs_dir_createname(tp, target_dp, target_name, |
387 | target_namelen, src_ip->i_ino, | 362 | src_ip->i_ino, &first_block, |
388 | &first_block, &free_list, spaceres); | 363 | &free_list, spaceres); |
389 | if (error == ENOSPC) | 364 | if (error == ENOSPC) |
390 | goto error_return; | 365 | goto error_return; |
391 | if (error) | 366 | if (error) |
@@ -424,7 +399,7 @@ xfs_rename( | |||
424 | * name at the destination directory, remove it first. | 399 | * name at the destination directory, remove it first. |
425 | */ | 400 | */ |
426 | error = xfs_dir_replace(tp, target_dp, target_name, | 401 | error = xfs_dir_replace(tp, target_dp, target_name, |
427 | target_namelen, src_ip->i_ino, | 402 | src_ip->i_ino, |
428 | &first_block, &free_list, spaceres); | 403 | &first_block, &free_list, spaceres); |
429 | if (error) | 404 | if (error) |
430 | goto abort_return; | 405 | goto abort_return; |
@@ -461,7 +436,8 @@ xfs_rename( | |||
461 | * Rewrite the ".." entry to point to the new | 436 | * Rewrite the ".." entry to point to the new |
462 | * directory. | 437 | * directory. |
463 | */ | 438 | */ |
464 | error = xfs_dir_replace(tp, src_ip, "..", 2, target_dp->i_ino, | 439 | error = xfs_dir_replace(tp, src_ip, &xfs_name_dotdot, |
440 | target_dp->i_ino, | ||
465 | &first_block, &free_list, spaceres); | 441 | &first_block, &free_list, spaceres); |
466 | ASSERT(error != EEXIST); | 442 | ASSERT(error != EEXIST); |
467 | if (error) | 443 | if (error) |
@@ -497,8 +473,8 @@ xfs_rename( | |||
497 | goto abort_return; | 473 | goto abort_return; |
498 | } | 474 | } |
499 | 475 | ||
500 | error = xfs_dir_removename(tp, src_dp, src_name, src_namelen, | 476 | error = xfs_dir_removename(tp, src_dp, src_name, src_ip->i_ino, |
501 | src_ip->i_ino, &first_block, &free_list, spaceres); | 477 | &first_block, &free_list, spaceres); |
502 | if (error) | 478 | if (error) |
503 | goto abort_return; | 479 | goto abort_return; |
504 | xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 480 | xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
@@ -583,7 +559,7 @@ std_return: | |||
583 | (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME, | 559 | (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME, |
584 | src_dp, DM_RIGHT_NULL, | 560 | src_dp, DM_RIGHT_NULL, |
585 | target_dp, DM_RIGHT_NULL, | 561 | target_dp, DM_RIGHT_NULL, |
586 | src_name, target_name, | 562 | src_name->name, target_name->name, |
587 | 0, error, 0); | 563 | 0, error, 0); |
588 | } | 564 | } |
589 | return error; | 565 | return error; |
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h index 5c89be475464..0f5191644ab2 100644 --- a/fs/xfs/xfs_types.h +++ b/fs/xfs/xfs_types.h | |||
@@ -160,4 +160,9 @@ typedef enum { | |||
160 | XFS_BTNUM_MAX | 160 | XFS_BTNUM_MAX |
161 | } xfs_btnum_t; | 161 | } xfs_btnum_t; |
162 | 162 | ||
163 | struct xfs_name { | ||
164 | const char *name; | ||
165 | int len; | ||
166 | }; | ||
167 | |||
163 | #endif /* __XFS_TYPES_H__ */ | 168 | #endif /* __XFS_TYPES_H__ */ |
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c index 47c45ff4a067..2b8dc7e40772 100644 --- a/fs/xfs/xfs_utils.c +++ b/fs/xfs/xfs_utils.c | |||
@@ -45,7 +45,7 @@ int | |||
45 | xfs_dir_lookup_int( | 45 | xfs_dir_lookup_int( |
46 | xfs_inode_t *dp, | 46 | xfs_inode_t *dp, |
47 | uint lock_mode, | 47 | uint lock_mode, |
48 | bhv_vname_t *dentry, | 48 | struct xfs_name *name, |
49 | xfs_ino_t *inum, | 49 | xfs_ino_t *inum, |
50 | xfs_inode_t **ipp) | 50 | xfs_inode_t **ipp) |
51 | { | 51 | { |
@@ -53,7 +53,7 @@ xfs_dir_lookup_int( | |||
53 | 53 | ||
54 | xfs_itrace_entry(dp); | 54 | xfs_itrace_entry(dp); |
55 | 55 | ||
56 | error = xfs_dir_lookup(NULL, dp, VNAME(dentry), VNAMELEN(dentry), inum); | 56 | error = xfs_dir_lookup(NULL, dp, name, inum); |
57 | if (!error) { | 57 | if (!error) { |
58 | /* | 58 | /* |
59 | * Unlock the directory. We do this because we can't | 59 | * Unlock the directory. We do this because we can't |
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h index 701accbbaea1..175b126d2cab 100644 --- a/fs/xfs/xfs_utils.h +++ b/fs/xfs/xfs_utils.h | |||
@@ -21,8 +21,8 @@ | |||
21 | #define IRELE(ip) VN_RELE(XFS_ITOV(ip)) | 21 | #define IRELE(ip) VN_RELE(XFS_ITOV(ip)) |
22 | #define IHOLD(ip) VN_HOLD(XFS_ITOV(ip)) | 22 | #define IHOLD(ip) VN_HOLD(XFS_ITOV(ip)) |
23 | 23 | ||
24 | extern int xfs_dir_lookup_int(xfs_inode_t *, uint, bhv_vname_t *, xfs_ino_t *, | 24 | extern int xfs_dir_lookup_int(xfs_inode_t *, uint, struct xfs_name *, |
25 | xfs_inode_t **); | 25 | xfs_ino_t *, xfs_inode_t **); |
26 | extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *); | 26 | extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *); |
27 | extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, | 27 | extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, |
28 | xfs_dev_t, cred_t *, prid_t, int, | 28 | xfs_dev_t, cred_t *, prid_t, int, |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index bc0a4707189a..ca38fb9a9937 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -1764,7 +1764,7 @@ xfs_inactive( | |||
1764 | int | 1764 | int |
1765 | xfs_lookup( | 1765 | xfs_lookup( |
1766 | xfs_inode_t *dp, | 1766 | xfs_inode_t *dp, |
1767 | bhv_vname_t *dentry, | 1767 | struct xfs_name *name, |
1768 | xfs_inode_t **ipp) | 1768 | xfs_inode_t **ipp) |
1769 | { | 1769 | { |
1770 | xfs_inode_t *ip; | 1770 | xfs_inode_t *ip; |
@@ -1778,7 +1778,7 @@ xfs_lookup( | |||
1778 | return XFS_ERROR(EIO); | 1778 | return XFS_ERROR(EIO); |
1779 | 1779 | ||
1780 | lock_mode = xfs_ilock_map_shared(dp); | 1780 | lock_mode = xfs_ilock_map_shared(dp); |
1781 | error = xfs_dir_lookup_int(dp, lock_mode, dentry, &e_inum, &ip); | 1781 | error = xfs_dir_lookup_int(dp, lock_mode, name, &e_inum, &ip); |
1782 | if (!error) { | 1782 | if (!error) { |
1783 | *ipp = ip; | 1783 | *ipp = ip; |
1784 | xfs_itrace_ref(ip); | 1784 | xfs_itrace_ref(ip); |
@@ -1790,17 +1790,16 @@ xfs_lookup( | |||
1790 | int | 1790 | int |
1791 | xfs_create( | 1791 | xfs_create( |
1792 | xfs_inode_t *dp, | 1792 | xfs_inode_t *dp, |
1793 | bhv_vname_t *dentry, | 1793 | struct xfs_name *name, |
1794 | mode_t mode, | 1794 | mode_t mode, |
1795 | xfs_dev_t rdev, | 1795 | xfs_dev_t rdev, |
1796 | xfs_inode_t **ipp, | 1796 | xfs_inode_t **ipp, |
1797 | cred_t *credp) | 1797 | cred_t *credp) |
1798 | { | 1798 | { |
1799 | char *name = VNAME(dentry); | 1799 | xfs_mount_t *mp = dp->i_mount; |
1800 | xfs_mount_t *mp = dp->i_mount; | ||
1801 | xfs_inode_t *ip; | 1800 | xfs_inode_t *ip; |
1802 | xfs_trans_t *tp; | 1801 | xfs_trans_t *tp; |
1803 | int error; | 1802 | int error; |
1804 | xfs_bmap_free_t free_list; | 1803 | xfs_bmap_free_t free_list; |
1805 | xfs_fsblock_t first_block; | 1804 | xfs_fsblock_t first_block; |
1806 | boolean_t unlock_dp_on_error = B_FALSE; | 1805 | boolean_t unlock_dp_on_error = B_FALSE; |
@@ -1810,17 +1809,14 @@ xfs_create( | |||
1810 | xfs_prid_t prid; | 1809 | xfs_prid_t prid; |
1811 | struct xfs_dquot *udqp, *gdqp; | 1810 | struct xfs_dquot *udqp, *gdqp; |
1812 | uint resblks; | 1811 | uint resblks; |
1813 | int namelen; | ||
1814 | 1812 | ||
1815 | ASSERT(!*ipp); | 1813 | ASSERT(!*ipp); |
1816 | xfs_itrace_entry(dp); | 1814 | xfs_itrace_entry(dp); |
1817 | 1815 | ||
1818 | namelen = VNAMELEN(dentry); | ||
1819 | |||
1820 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { | 1816 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { |
1821 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, | 1817 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, |
1822 | dp, DM_RIGHT_NULL, NULL, | 1818 | dp, DM_RIGHT_NULL, NULL, |
1823 | DM_RIGHT_NULL, name, NULL, | 1819 | DM_RIGHT_NULL, name->name, NULL, |
1824 | mode, 0, 0); | 1820 | mode, 0, 0); |
1825 | 1821 | ||
1826 | if (error) | 1822 | if (error) |
@@ -1852,7 +1848,7 @@ xfs_create( | |||
1852 | 1848 | ||
1853 | tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); | 1849 | tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); |
1854 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; | 1850 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; |
1855 | resblks = XFS_CREATE_SPACE_RES(mp, namelen); | 1851 | resblks = XFS_CREATE_SPACE_RES(mp, name->len); |
1856 | /* | 1852 | /* |
1857 | * Initially assume that the file does not exist and | 1853 | * Initially assume that the file does not exist and |
1858 | * reserve the resources for that case. If that is not | 1854 | * reserve the resources for that case. If that is not |
@@ -1885,7 +1881,8 @@ xfs_create( | |||
1885 | if (error) | 1881 | if (error) |
1886 | goto error_return; | 1882 | goto error_return; |
1887 | 1883 | ||
1888 | if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen))) | 1884 | error = xfs_dir_canenter(tp, dp, name, resblks); |
1885 | if (error) | ||
1889 | goto error_return; | 1886 | goto error_return; |
1890 | error = xfs_dir_ialloc(&tp, dp, mode, 1, | 1887 | error = xfs_dir_ialloc(&tp, dp, mode, 1, |
1891 | rdev, credp, prid, resblks > 0, | 1888 | rdev, credp, prid, resblks > 0, |
@@ -1915,7 +1912,7 @@ xfs_create( | |||
1915 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 1912 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
1916 | unlock_dp_on_error = B_FALSE; | 1913 | unlock_dp_on_error = B_FALSE; |
1917 | 1914 | ||
1918 | error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino, | 1915 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, |
1919 | &first_block, &free_list, resblks ? | 1916 | &first_block, &free_list, resblks ? |
1920 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 1917 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
1921 | if (error) { | 1918 | if (error) { |
@@ -1976,7 +1973,7 @@ std_return: | |||
1976 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, | 1973 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, |
1977 | dp, DM_RIGHT_NULL, | 1974 | dp, DM_RIGHT_NULL, |
1978 | *ipp ? ip : NULL, | 1975 | *ipp ? ip : NULL, |
1979 | DM_RIGHT_NULL, name, NULL, | 1976 | DM_RIGHT_NULL, name->name, NULL, |
1980 | mode, error, 0); | 1977 | mode, error, 0); |
1981 | } | 1978 | } |
1982 | return error; | 1979 | return error; |
@@ -2268,12 +2265,10 @@ int remove_which_error_return = 0; | |||
2268 | int | 2265 | int |
2269 | xfs_remove( | 2266 | xfs_remove( |
2270 | xfs_inode_t *dp, | 2267 | xfs_inode_t *dp, |
2271 | bhv_vname_t *dentry) | 2268 | struct xfs_name *name, |
2269 | xfs_inode_t *ip) | ||
2272 | { | 2270 | { |
2273 | char *name = VNAME(dentry); | ||
2274 | xfs_mount_t *mp = dp->i_mount; | 2271 | xfs_mount_t *mp = dp->i_mount; |
2275 | xfs_inode_t *ip = VNAME_TO_INODE(dentry); | ||
2276 | int namelen = VNAMELEN(dentry); | ||
2277 | xfs_trans_t *tp = NULL; | 2272 | xfs_trans_t *tp = NULL; |
2278 | int error = 0; | 2273 | int error = 0; |
2279 | xfs_bmap_free_t free_list; | 2274 | xfs_bmap_free_t free_list; |
@@ -2289,9 +2284,9 @@ xfs_remove( | |||
2289 | return XFS_ERROR(EIO); | 2284 | return XFS_ERROR(EIO); |
2290 | 2285 | ||
2291 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { | 2286 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { |
2292 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dp, | 2287 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dp, DM_RIGHT_NULL, |
2293 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, | 2288 | NULL, DM_RIGHT_NULL, name->name, NULL, |
2294 | name, NULL, ip->i_d.di_mode, 0, 0); | 2289 | ip->i_d.di_mode, 0, 0); |
2295 | if (error) | 2290 | if (error) |
2296 | return error; | 2291 | return error; |
2297 | } | 2292 | } |
@@ -2376,7 +2371,7 @@ xfs_remove( | |||
2376 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. | 2371 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. |
2377 | */ | 2372 | */ |
2378 | XFS_BMAP_INIT(&free_list, &first_block); | 2373 | XFS_BMAP_INIT(&free_list, &first_block); |
2379 | error = xfs_dir_removename(tp, dp, name, namelen, ip->i_ino, | 2374 | error = xfs_dir_removename(tp, dp, name, ip->i_ino, |
2380 | &first_block, &free_list, 0); | 2375 | &first_block, &free_list, 0); |
2381 | if (error) { | 2376 | if (error) { |
2382 | ASSERT(error != ENOENT); | 2377 | ASSERT(error != ENOENT); |
@@ -2444,7 +2439,7 @@ xfs_remove( | |||
2444 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, | 2439 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, |
2445 | dp, DM_RIGHT_NULL, | 2440 | dp, DM_RIGHT_NULL, |
2446 | NULL, DM_RIGHT_NULL, | 2441 | NULL, DM_RIGHT_NULL, |
2447 | name, NULL, ip->i_d.di_mode, error, 0); | 2442 | name->name, NULL, ip->i_d.di_mode, error, 0); |
2448 | } | 2443 | } |
2449 | return error; | 2444 | return error; |
2450 | 2445 | ||
@@ -2474,7 +2469,7 @@ int | |||
2474 | xfs_link( | 2469 | xfs_link( |
2475 | xfs_inode_t *tdp, | 2470 | xfs_inode_t *tdp, |
2476 | xfs_inode_t *sip, | 2471 | xfs_inode_t *sip, |
2477 | bhv_vname_t *dentry) | 2472 | struct xfs_name *target_name) |
2478 | { | 2473 | { |
2479 | xfs_mount_t *mp = tdp->i_mount; | 2474 | xfs_mount_t *mp = tdp->i_mount; |
2480 | xfs_trans_t *tp; | 2475 | xfs_trans_t *tp; |
@@ -2485,13 +2480,10 @@ xfs_link( | |||
2485 | int cancel_flags; | 2480 | int cancel_flags; |
2486 | int committed; | 2481 | int committed; |
2487 | int resblks; | 2482 | int resblks; |
2488 | char *target_name = VNAME(dentry); | ||
2489 | int target_namelen; | ||
2490 | 2483 | ||
2491 | xfs_itrace_entry(tdp); | 2484 | xfs_itrace_entry(tdp); |
2492 | xfs_itrace_entry(sip); | 2485 | xfs_itrace_entry(sip); |
2493 | 2486 | ||
2494 | target_namelen = VNAMELEN(dentry); | ||
2495 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); | 2487 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); |
2496 | 2488 | ||
2497 | if (XFS_FORCED_SHUTDOWN(mp)) | 2489 | if (XFS_FORCED_SHUTDOWN(mp)) |
@@ -2501,7 +2493,7 @@ xfs_link( | |||
2501 | error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK, | 2493 | error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK, |
2502 | tdp, DM_RIGHT_NULL, | 2494 | tdp, DM_RIGHT_NULL, |
2503 | sip, DM_RIGHT_NULL, | 2495 | sip, DM_RIGHT_NULL, |
2504 | target_name, NULL, 0, 0, 0); | 2496 | target_name->name, NULL, 0, 0, 0); |
2505 | if (error) | 2497 | if (error) |
2506 | return error; | 2498 | return error; |
2507 | } | 2499 | } |
@@ -2516,7 +2508,7 @@ xfs_link( | |||
2516 | 2508 | ||
2517 | tp = xfs_trans_alloc(mp, XFS_TRANS_LINK); | 2509 | tp = xfs_trans_alloc(mp, XFS_TRANS_LINK); |
2518 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; | 2510 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; |
2519 | resblks = XFS_LINK_SPACE_RES(mp, target_namelen); | 2511 | resblks = XFS_LINK_SPACE_RES(mp, target_name->len); |
2520 | error = xfs_trans_reserve(tp, resblks, XFS_LINK_LOG_RES(mp), 0, | 2512 | error = xfs_trans_reserve(tp, resblks, XFS_LINK_LOG_RES(mp), 0, |
2521 | XFS_TRANS_PERM_LOG_RES, XFS_LINK_LOG_COUNT); | 2513 | XFS_TRANS_PERM_LOG_RES, XFS_LINK_LOG_COUNT); |
2522 | if (error == ENOSPC) { | 2514 | if (error == ENOSPC) { |
@@ -2568,15 +2560,14 @@ xfs_link( | |||
2568 | goto error_return; | 2560 | goto error_return; |
2569 | } | 2561 | } |
2570 | 2562 | ||
2571 | if (resblks == 0 && | 2563 | error = xfs_dir_canenter(tp, tdp, target_name, resblks); |
2572 | (error = xfs_dir_canenter(tp, tdp, target_name, target_namelen))) | 2564 | if (error) |
2573 | goto error_return; | 2565 | goto error_return; |
2574 | 2566 | ||
2575 | XFS_BMAP_INIT(&free_list, &first_block); | 2567 | XFS_BMAP_INIT(&free_list, &first_block); |
2576 | 2568 | ||
2577 | error = xfs_dir_createname(tp, tdp, target_name, target_namelen, | 2569 | error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino, |
2578 | sip->i_ino, &first_block, &free_list, | 2570 | &first_block, &free_list, resblks); |
2579 | resblks); | ||
2580 | if (error) | 2571 | if (error) |
2581 | goto abort_return; | 2572 | goto abort_return; |
2582 | xfs_ichgtime(tdp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 2573 | xfs_ichgtime(tdp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
@@ -2612,7 +2603,7 @@ std_return: | |||
2612 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK, | 2603 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK, |
2613 | tdp, DM_RIGHT_NULL, | 2604 | tdp, DM_RIGHT_NULL, |
2614 | sip, DM_RIGHT_NULL, | 2605 | sip, DM_RIGHT_NULL, |
2615 | target_name, NULL, 0, error, 0); | 2606 | target_name->name, NULL, 0, error, 0); |
2616 | } | 2607 | } |
2617 | return error; | 2608 | return error; |
2618 | 2609 | ||
@@ -2629,13 +2620,11 @@ std_return: | |||
2629 | int | 2620 | int |
2630 | xfs_mkdir( | 2621 | xfs_mkdir( |
2631 | xfs_inode_t *dp, | 2622 | xfs_inode_t *dp, |
2632 | bhv_vname_t *dentry, | 2623 | struct xfs_name *dir_name, |
2633 | mode_t mode, | 2624 | mode_t mode, |
2634 | xfs_inode_t **ipp, | 2625 | xfs_inode_t **ipp, |
2635 | cred_t *credp) | 2626 | cred_t *credp) |
2636 | { | 2627 | { |
2637 | char *dir_name = VNAME(dentry); | ||
2638 | int dir_namelen = VNAMELEN(dentry); | ||
2639 | xfs_mount_t *mp = dp->i_mount; | 2628 | xfs_mount_t *mp = dp->i_mount; |
2640 | xfs_inode_t *cdp; /* inode of created dir */ | 2629 | xfs_inode_t *cdp; /* inode of created dir */ |
2641 | xfs_trans_t *tp; | 2630 | xfs_trans_t *tp; |
@@ -2659,7 +2648,7 @@ xfs_mkdir( | |||
2659 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { | 2648 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { |
2660 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, | 2649 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, |
2661 | dp, DM_RIGHT_NULL, NULL, | 2650 | dp, DM_RIGHT_NULL, NULL, |
2662 | DM_RIGHT_NULL, dir_name, NULL, | 2651 | DM_RIGHT_NULL, dir_name->name, NULL, |
2663 | mode, 0, 0); | 2652 | mode, 0, 0); |
2664 | if (error) | 2653 | if (error) |
2665 | return error; | 2654 | return error; |
@@ -2688,7 +2677,7 @@ xfs_mkdir( | |||
2688 | 2677 | ||
2689 | tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); | 2678 | tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); |
2690 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; | 2679 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; |
2691 | resblks = XFS_MKDIR_SPACE_RES(mp, dir_namelen); | 2680 | resblks = XFS_MKDIR_SPACE_RES(mp, dir_name->len); |
2692 | error = xfs_trans_reserve(tp, resblks, XFS_MKDIR_LOG_RES(mp), 0, | 2681 | error = xfs_trans_reserve(tp, resblks, XFS_MKDIR_LOG_RES(mp), 0, |
2693 | XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT); | 2682 | XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT); |
2694 | if (error == ENOSPC) { | 2683 | if (error == ENOSPC) { |
@@ -2720,8 +2709,8 @@ xfs_mkdir( | |||
2720 | if (error) | 2709 | if (error) |
2721 | goto error_return; | 2710 | goto error_return; |
2722 | 2711 | ||
2723 | if (resblks == 0 && | 2712 | error = xfs_dir_canenter(tp, dp, dir_name, resblks); |
2724 | (error = xfs_dir_canenter(tp, dp, dir_name, dir_namelen))) | 2713 | if (error) |
2725 | goto error_return; | 2714 | goto error_return; |
2726 | /* | 2715 | /* |
2727 | * create the directory inode. | 2716 | * create the directory inode. |
@@ -2750,9 +2739,9 @@ xfs_mkdir( | |||
2750 | 2739 | ||
2751 | XFS_BMAP_INIT(&free_list, &first_block); | 2740 | XFS_BMAP_INIT(&free_list, &first_block); |
2752 | 2741 | ||
2753 | error = xfs_dir_createname(tp, dp, dir_name, dir_namelen, cdp->i_ino, | 2742 | error = xfs_dir_createname(tp, dp, dir_name, cdp->i_ino, |
2754 | &first_block, &free_list, resblks ? | 2743 | &first_block, &free_list, resblks ? |
2755 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 2744 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
2756 | if (error) { | 2745 | if (error) { |
2757 | ASSERT(error != ENOSPC); | 2746 | ASSERT(error != ENOSPC); |
2758 | goto error1; | 2747 | goto error1; |
@@ -2817,7 +2806,7 @@ std_return: | |||
2817 | dp, DM_RIGHT_NULL, | 2806 | dp, DM_RIGHT_NULL, |
2818 | created ? cdp : NULL, | 2807 | created ? cdp : NULL, |
2819 | DM_RIGHT_NULL, | 2808 | DM_RIGHT_NULL, |
2820 | dir_name, NULL, | 2809 | dir_name->name, NULL, |
2821 | mode, error, 0); | 2810 | mode, error, 0); |
2822 | } | 2811 | } |
2823 | return error; | 2812 | return error; |
@@ -2841,13 +2830,11 @@ std_return: | |||
2841 | int | 2830 | int |
2842 | xfs_rmdir( | 2831 | xfs_rmdir( |
2843 | xfs_inode_t *dp, | 2832 | xfs_inode_t *dp, |
2844 | bhv_vname_t *dentry) | 2833 | struct xfs_name *name, |
2834 | xfs_inode_t *cdp) | ||
2845 | { | 2835 | { |
2846 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); | 2836 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); |
2847 | char *name = VNAME(dentry); | ||
2848 | int namelen = VNAMELEN(dentry); | ||
2849 | xfs_mount_t *mp = dp->i_mount; | 2837 | xfs_mount_t *mp = dp->i_mount; |
2850 | xfs_inode_t *cdp = VNAME_TO_INODE(dentry); | ||
2851 | xfs_trans_t *tp; | 2838 | xfs_trans_t *tp; |
2852 | int error; | 2839 | int error; |
2853 | xfs_bmap_free_t free_list; | 2840 | xfs_bmap_free_t free_list; |
@@ -2865,8 +2852,8 @@ xfs_rmdir( | |||
2865 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { | 2852 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { |
2866 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, | 2853 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, |
2867 | dp, DM_RIGHT_NULL, | 2854 | dp, DM_RIGHT_NULL, |
2868 | NULL, DM_RIGHT_NULL, | 2855 | NULL, DM_RIGHT_NULL, name->name, |
2869 | name, NULL, cdp->i_d.di_mode, 0, 0); | 2856 | NULL, cdp->i_d.di_mode, 0, 0); |
2870 | if (error) | 2857 | if (error) |
2871 | return XFS_ERROR(error); | 2858 | return XFS_ERROR(error); |
2872 | } | 2859 | } |
@@ -2960,7 +2947,7 @@ xfs_rmdir( | |||
2960 | goto error_return; | 2947 | goto error_return; |
2961 | } | 2948 | } |
2962 | 2949 | ||
2963 | error = xfs_dir_removename(tp, dp, name, namelen, cdp->i_ino, | 2950 | error = xfs_dir_removename(tp, dp, name, cdp->i_ino, |
2964 | &first_block, &free_list, resblks); | 2951 | &first_block, &free_list, resblks); |
2965 | if (error) | 2952 | if (error) |
2966 | goto error1; | 2953 | goto error1; |
@@ -3040,7 +3027,7 @@ xfs_rmdir( | |||
3040 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, | 3027 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, |
3041 | dp, DM_RIGHT_NULL, | 3028 | dp, DM_RIGHT_NULL, |
3042 | NULL, DM_RIGHT_NULL, | 3029 | NULL, DM_RIGHT_NULL, |
3043 | name, NULL, cdp->i_d.di_mode, | 3030 | name->name, NULL, cdp->i_d.di_mode, |
3044 | error, 0); | 3031 | error, 0); |
3045 | } | 3032 | } |
3046 | return error; | 3033 | return error; |
@@ -3058,8 +3045,8 @@ xfs_rmdir( | |||
3058 | int | 3045 | int |
3059 | xfs_symlink( | 3046 | xfs_symlink( |
3060 | xfs_inode_t *dp, | 3047 | xfs_inode_t *dp, |
3061 | bhv_vname_t *dentry, | 3048 | struct xfs_name *link_name, |
3062 | char *target_path, | 3049 | const char *target_path, |
3063 | mode_t mode, | 3050 | mode_t mode, |
3064 | xfs_inode_t **ipp, | 3051 | xfs_inode_t **ipp, |
3065 | cred_t *credp) | 3052 | cred_t *credp) |
@@ -3079,15 +3066,13 @@ xfs_symlink( | |||
3079 | int nmaps; | 3066 | int nmaps; |
3080 | xfs_bmbt_irec_t mval[SYMLINK_MAPS]; | 3067 | xfs_bmbt_irec_t mval[SYMLINK_MAPS]; |
3081 | xfs_daddr_t d; | 3068 | xfs_daddr_t d; |
3082 | char *cur_chunk; | 3069 | const char *cur_chunk; |
3083 | int byte_cnt; | 3070 | int byte_cnt; |
3084 | int n; | 3071 | int n; |
3085 | xfs_buf_t *bp; | 3072 | xfs_buf_t *bp; |
3086 | xfs_prid_t prid; | 3073 | xfs_prid_t prid; |
3087 | struct xfs_dquot *udqp, *gdqp; | 3074 | struct xfs_dquot *udqp, *gdqp; |
3088 | uint resblks; | 3075 | uint resblks; |
3089 | char *link_name = VNAME(dentry); | ||
3090 | int link_namelen; | ||
3091 | 3076 | ||
3092 | *ipp = NULL; | 3077 | *ipp = NULL; |
3093 | error = 0; | 3078 | error = 0; |
@@ -3099,8 +3084,6 @@ xfs_symlink( | |||
3099 | if (XFS_FORCED_SHUTDOWN(mp)) | 3084 | if (XFS_FORCED_SHUTDOWN(mp)) |
3100 | return XFS_ERROR(EIO); | 3085 | return XFS_ERROR(EIO); |
3101 | 3086 | ||
3102 | link_namelen = VNAMELEN(dentry); | ||
3103 | |||
3104 | /* | 3087 | /* |
3105 | * Check component lengths of the target path name. | 3088 | * Check component lengths of the target path name. |
3106 | */ | 3089 | */ |
@@ -3111,7 +3094,7 @@ xfs_symlink( | |||
3111 | if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) { | 3094 | if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) { |
3112 | error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp, | 3095 | error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp, |
3113 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, | 3096 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, |
3114 | link_name, target_path, 0, 0, 0); | 3097 | link_name->name, target_path, 0, 0, 0); |
3115 | if (error) | 3098 | if (error) |
3116 | return error; | 3099 | return error; |
3117 | } | 3100 | } |
@@ -3143,7 +3126,7 @@ xfs_symlink( | |||
3143 | fs_blocks = 0; | 3126 | fs_blocks = 0; |
3144 | else | 3127 | else |
3145 | fs_blocks = XFS_B_TO_FSB(mp, pathlen); | 3128 | fs_blocks = XFS_B_TO_FSB(mp, pathlen); |
3146 | resblks = XFS_SYMLINK_SPACE_RES(mp, link_namelen, fs_blocks); | 3129 | resblks = XFS_SYMLINK_SPACE_RES(mp, link_name->len, fs_blocks); |
3147 | error = xfs_trans_reserve(tp, resblks, XFS_SYMLINK_LOG_RES(mp), 0, | 3130 | error = xfs_trans_reserve(tp, resblks, XFS_SYMLINK_LOG_RES(mp), 0, |
3148 | XFS_TRANS_PERM_LOG_RES, XFS_SYMLINK_LOG_COUNT); | 3131 | XFS_TRANS_PERM_LOG_RES, XFS_SYMLINK_LOG_COUNT); |
3149 | if (error == ENOSPC && fs_blocks == 0) { | 3132 | if (error == ENOSPC && fs_blocks == 0) { |
@@ -3177,8 +3160,8 @@ xfs_symlink( | |||
3177 | /* | 3160 | /* |
3178 | * Check for ability to enter directory entry, if no space reserved. | 3161 | * Check for ability to enter directory entry, if no space reserved. |
3179 | */ | 3162 | */ |
3180 | if (resblks == 0 && | 3163 | error = xfs_dir_canenter(tp, dp, link_name, resblks); |
3181 | (error = xfs_dir_canenter(tp, dp, link_name, link_namelen))) | 3164 | if (error) |
3182 | goto error_return; | 3165 | goto error_return; |
3183 | /* | 3166 | /* |
3184 | * Initialize the bmap freelist prior to calling either | 3167 | * Initialize the bmap freelist prior to calling either |
@@ -3270,8 +3253,8 @@ xfs_symlink( | |||
3270 | /* | 3253 | /* |
3271 | * Create the directory entry for the symlink. | 3254 | * Create the directory entry for the symlink. |
3272 | */ | 3255 | */ |
3273 | error = xfs_dir_createname(tp, dp, link_name, link_namelen, ip->i_ino, | 3256 | error = xfs_dir_createname(tp, dp, link_name, ip->i_ino, |
3274 | &first_block, &free_list, resblks); | 3257 | &first_block, &free_list, resblks); |
3275 | if (error) | 3258 | if (error) |
3276 | goto error1; | 3259 | goto error1; |
3277 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 3260 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
@@ -3315,8 +3298,8 @@ std_return: | |||
3315 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, | 3298 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, |
3316 | dp, DM_RIGHT_NULL, | 3299 | dp, DM_RIGHT_NULL, |
3317 | error ? NULL : ip, | 3300 | error ? NULL : ip, |
3318 | DM_RIGHT_NULL, link_name, target_path, | 3301 | DM_RIGHT_NULL, link_name->name, |
3319 | 0, error, 0); | 3302 | target_path, 0, error, 0); |
3320 | } | 3303 | } |
3321 | 3304 | ||
3322 | if (!error) | 3305 | if (!error) |
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h index 12e581865bdf..24c53923dc2c 100644 --- a/fs/xfs/xfs_vnodeops.h +++ b/fs/xfs/xfs_vnodeops.h | |||
@@ -23,20 +23,22 @@ int xfs_fsync(struct xfs_inode *ip, int flag, xfs_off_t start, | |||
23 | xfs_off_t stop); | 23 | xfs_off_t stop); |
24 | int xfs_release(struct xfs_inode *ip); | 24 | int xfs_release(struct xfs_inode *ip); |
25 | int xfs_inactive(struct xfs_inode *ip); | 25 | int xfs_inactive(struct xfs_inode *ip); |
26 | int xfs_lookup(struct xfs_inode *dp, bhv_vname_t *dentry, | 26 | int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name, |
27 | struct xfs_inode **ipp); | 27 | struct xfs_inode **ipp); |
28 | int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry, mode_t mode, | 28 | int xfs_create(struct xfs_inode *dp, struct xfs_name *name, mode_t mode, |
29 | xfs_dev_t rdev, struct xfs_inode **ipp, struct cred *credp); | 29 | xfs_dev_t rdev, struct xfs_inode **ipp, struct cred *credp); |
30 | int xfs_remove(struct xfs_inode *dp, bhv_vname_t *dentry); | 30 | int xfs_remove(struct xfs_inode *dp, struct xfs_name *name, |
31 | struct xfs_inode *ip); | ||
31 | int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip, | 32 | int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip, |
32 | bhv_vname_t *dentry); | 33 | struct xfs_name *target_name); |
33 | int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry, | 34 | int xfs_mkdir(struct xfs_inode *dp, struct xfs_name *dir_name, |
34 | mode_t mode, struct xfs_inode **ipp, struct cred *credp); | 35 | mode_t mode, struct xfs_inode **ipp, struct cred *credp); |
35 | int xfs_rmdir(struct xfs_inode *dp, bhv_vname_t *dentry); | 36 | int xfs_rmdir(struct xfs_inode *dp, struct xfs_name *name, |
37 | struct xfs_inode *cdp); | ||
36 | int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, | 38 | int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, |
37 | xfs_off_t *offset, filldir_t filldir); | 39 | xfs_off_t *offset, filldir_t filldir); |
38 | int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, | 40 | int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name, |
39 | char *target_path, mode_t mode, struct xfs_inode **ipp, | 41 | const char *target_path, mode_t mode, struct xfs_inode **ipp, |
40 | struct cred *credp); | 42 | struct cred *credp); |
41 | int xfs_inode_flush(struct xfs_inode *ip, int flags); | 43 | int xfs_inode_flush(struct xfs_inode *ip, int flags); |
42 | int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); | 44 | int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); |
@@ -44,8 +46,9 @@ int xfs_reclaim(struct xfs_inode *ip); | |||
44 | int xfs_change_file_space(struct xfs_inode *ip, int cmd, | 46 | int xfs_change_file_space(struct xfs_inode *ip, int cmd, |
45 | xfs_flock64_t *bf, xfs_off_t offset, | 47 | xfs_flock64_t *bf, xfs_off_t offset, |
46 | struct cred *credp, int attr_flags); | 48 | struct cred *credp, int attr_flags); |
47 | int xfs_rename(struct xfs_inode *src_dp, bhv_vname_t *src_vname, | 49 | int xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name, |
48 | struct xfs_inode *target_dp, bhv_vname_t *target_vname); | 50 | struct xfs_inode *src_ip, struct xfs_inode *target_dp, |
51 | struct xfs_name *target_name); | ||
49 | int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value, | 52 | int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value, |
50 | int *valuelenp, int flags, cred_t *cred); | 53 | int *valuelenp, int flags, cred_t *cred); |
51 | int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value, | 54 | int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value, |