diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-28 20:58:01 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 20:40:00 -0400 |
commit | 739bfb2a7dfa369324f74aad1d020d6e0775e4f0 (patch) | |
tree | 8fbe3e739e0d550137e3f148a36ce5c083f5ef2c /fs/xfs/linux-2.6/xfs_iops.c | |
parent | 993386c19afa53fa54d00c7721e56ba820b3400d (diff) |
[XFS] call common xfs vnode-level helpers directly and remove vnode operations
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29493a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 77 |
1 files changed, 26 insertions, 51 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index ef941f99b2bc..4da034f4ae14 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "xfs_attr.h" | 46 | #include "xfs_attr.h" |
47 | #include "xfs_buf_item.h" | 47 | #include "xfs_buf_item.h" |
48 | #include "xfs_utils.h" | 48 | #include "xfs_utils.h" |
49 | #include "xfs_vnodeops.h" | ||
49 | 50 | ||
50 | #include <linux/capability.h> | 51 | #include <linux/capability.h> |
51 | #include <linux/xattr.h> | 52 | #include <linux/xattr.h> |
@@ -53,22 +54,6 @@ | |||
53 | #include <linux/security.h> | 54 | #include <linux/security.h> |
54 | 55 | ||
55 | /* | 56 | /* |
56 | * Get a XFS inode from a given vnode. | ||
57 | */ | ||
58 | xfs_inode_t * | ||
59 | xfs_vtoi( | ||
60 | bhv_vnode_t *vp) | ||
61 | { | ||
62 | bhv_desc_t *bdp; | ||
63 | |||
64 | bdp = bhv_lookup_range(VN_BHV_HEAD(vp), | ||
65 | VNODE_POSITION_XFS, VNODE_POSITION_XFS); | ||
66 | if (unlikely(bdp == NULL)) | ||
67 | return NULL; | ||
68 | return XFS_BHVTOI(bdp); | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * Bring the atime in the XFS inode uptodate. | 57 | * Bring the atime in the XFS inode uptodate. |
73 | * Used before logging the inode to disk or when the Linux inode goes away. | 58 | * Used before logging the inode to disk or when the Linux inode goes away. |
74 | */ | 59 | */ |
@@ -199,7 +184,7 @@ xfs_validate_fields( | |||
199 | bhv_vattr_t *vattr) | 184 | bhv_vattr_t *vattr) |
200 | { | 185 | { |
201 | vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; | 186 | vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; |
202 | if (!bhv_vop_getattr(vn_from_inode(ip), vattr, ATTR_LAZY, NULL)) { | 187 | if (!xfs_getattr(XFS_I(ip), vattr, ATTR_LAZY)) { |
203 | ip->i_nlink = vattr->va_nlink; | 188 | ip->i_nlink = vattr->va_nlink; |
204 | ip->i_blocks = vattr->va_nblocks; | 189 | ip->i_blocks = vattr->va_nblocks; |
205 | 190 | ||
@@ -233,7 +218,8 @@ xfs_init_security( | |||
233 | return -error; | 218 | return -error; |
234 | } | 219 | } |
235 | 220 | ||
236 | error = bhv_vop_attr_set(vp, name, value, length, ATTR_SECURE, NULL); | 221 | error = xfs_attr_set(XFS_I(ip), name, value, |
222 | length, ATTR_SECURE); | ||
237 | if (!error) | 223 | if (!error) |
238 | VMODIFY(vp); | 224 | VMODIFY(vp); |
239 | 225 | ||
@@ -256,7 +242,7 @@ xfs_has_fs_struct(struct task_struct *task) | |||
256 | 242 | ||
257 | STATIC void | 243 | STATIC void |
258 | xfs_cleanup_inode( | 244 | xfs_cleanup_inode( |
259 | bhv_vnode_t *dvp, | 245 | struct inode *dir, |
260 | bhv_vnode_t *vp, | 246 | bhv_vnode_t *vp, |
261 | struct dentry *dentry, | 247 | struct dentry *dentry, |
262 | int mode) | 248 | int mode) |
@@ -272,9 +258,9 @@ xfs_cleanup_inode( | |||
272 | teardown.d_name = dentry->d_name; | 258 | teardown.d_name = dentry->d_name; |
273 | 259 | ||
274 | if (S_ISDIR(mode)) | 260 | if (S_ISDIR(mode)) |
275 | bhv_vop_rmdir(dvp, &teardown, NULL); | 261 | xfs_rmdir(XFS_I(dir), &teardown); |
276 | else | 262 | else |
277 | bhv_vop_remove(dvp, &teardown, NULL); | 263 | xfs_remove(XFS_I(dir), &teardown); |
278 | VN_RELE(vp); | 264 | VN_RELE(vp); |
279 | } | 265 | } |
280 | 266 | ||
@@ -321,10 +307,10 @@ xfs_vn_mknod( | |||
321 | vattr.va_mask |= XFS_AT_RDEV; | 307 | vattr.va_mask |= XFS_AT_RDEV; |
322 | /*FALLTHROUGH*/ | 308 | /*FALLTHROUGH*/ |
323 | case S_IFREG: | 309 | case S_IFREG: |
324 | error = bhv_vop_create(dvp, dentry, &vattr, &vp, NULL); | 310 | error = xfs_create(XFS_I(dir), dentry, &vattr, &vp, NULL); |
325 | break; | 311 | break; |
326 | case S_IFDIR: | 312 | case S_IFDIR: |
327 | error = bhv_vop_mkdir(dvp, dentry, &vattr, &vp, NULL); | 313 | error = xfs_mkdir(XFS_I(dir), dentry, &vattr, &vp, NULL); |
328 | break; | 314 | break; |
329 | default: | 315 | default: |
330 | error = EINVAL; | 316 | error = EINVAL; |
@@ -334,7 +320,7 @@ xfs_vn_mknod( | |||
334 | if (unlikely(!error)) { | 320 | if (unlikely(!error)) { |
335 | error = xfs_init_security(vp, dir); | 321 | error = xfs_init_security(vp, dir); |
336 | if (error) | 322 | if (error) |
337 | xfs_cleanup_inode(dvp, vp, dentry, mode); | 323 | xfs_cleanup_inode(dir, vp, dentry, mode); |
338 | } | 324 | } |
339 | 325 | ||
340 | if (unlikely(default_acl)) { | 326 | if (unlikely(default_acl)) { |
@@ -343,7 +329,7 @@ xfs_vn_mknod( | |||
343 | if (!error) | 329 | if (!error) |
344 | VMODIFY(vp); | 330 | VMODIFY(vp); |
345 | else | 331 | else |
346 | xfs_cleanup_inode(dvp, vp, dentry, mode); | 332 | xfs_cleanup_inode(dir, vp, dentry, mode); |
347 | } | 333 | } |
348 | _ACL_FREE(default_acl); | 334 | _ACL_FREE(default_acl); |
349 | } | 335 | } |
@@ -387,13 +373,13 @@ xfs_vn_lookup( | |||
387 | struct dentry *dentry, | 373 | struct dentry *dentry, |
388 | struct nameidata *nd) | 374 | struct nameidata *nd) |
389 | { | 375 | { |
390 | bhv_vnode_t *vp = vn_from_inode(dir), *cvp; | 376 | bhv_vnode_t *cvp; |
391 | int error; | 377 | int error; |
392 | 378 | ||
393 | if (dentry->d_name.len >= MAXNAMELEN) | 379 | if (dentry->d_name.len >= MAXNAMELEN) |
394 | return ERR_PTR(-ENAMETOOLONG); | 380 | return ERR_PTR(-ENAMETOOLONG); |
395 | 381 | ||
396 | error = bhv_vop_lookup(vp, dentry, &cvp, 0, NULL, NULL); | 382 | error = xfs_lookup(XFS_I(dir), dentry, &cvp); |
397 | if (unlikely(error)) { | 383 | if (unlikely(error)) { |
398 | if (unlikely(error != ENOENT)) | 384 | if (unlikely(error != ENOENT)) |
399 | return ERR_PTR(-error); | 385 | return ERR_PTR(-error); |
@@ -411,21 +397,19 @@ xfs_vn_link( | |||
411 | struct dentry *dentry) | 397 | struct dentry *dentry) |
412 | { | 398 | { |
413 | struct inode *ip; /* inode of guy being linked to */ | 399 | struct inode *ip; /* inode of guy being linked to */ |
414 | bhv_vnode_t *tdvp; /* target directory for new name/link */ | ||
415 | bhv_vnode_t *vp; /* vp of name being linked */ | 400 | bhv_vnode_t *vp; /* vp of name being linked */ |
416 | bhv_vattr_t vattr; | 401 | bhv_vattr_t vattr; |
417 | int error; | 402 | int error; |
418 | 403 | ||
419 | ip = old_dentry->d_inode; /* inode being linked to */ | 404 | ip = old_dentry->d_inode; /* inode being linked to */ |
420 | tdvp = vn_from_inode(dir); | ||
421 | vp = vn_from_inode(ip); | 405 | vp = vn_from_inode(ip); |
422 | 406 | ||
423 | VN_HOLD(vp); | 407 | VN_HOLD(vp); |
424 | error = bhv_vop_link(tdvp, vp, dentry, NULL); | 408 | error = xfs_link(XFS_I(dir), vp, dentry); |
425 | if (unlikely(error)) { | 409 | if (unlikely(error)) { |
426 | VN_RELE(vp); | 410 | VN_RELE(vp); |
427 | } else { | 411 | } else { |
428 | VMODIFY(tdvp); | 412 | VMODIFY(vn_from_inode(dir)); |
429 | xfs_validate_fields(ip, &vattr); | 413 | xfs_validate_fields(ip, &vattr); |
430 | d_instantiate(dentry, ip); | 414 | d_instantiate(dentry, ip); |
431 | } | 415 | } |
@@ -438,14 +422,12 @@ xfs_vn_unlink( | |||
438 | struct dentry *dentry) | 422 | struct dentry *dentry) |
439 | { | 423 | { |
440 | struct inode *inode; | 424 | struct inode *inode; |
441 | bhv_vnode_t *dvp; /* directory containing name to remove */ | ||
442 | bhv_vattr_t vattr; | 425 | bhv_vattr_t vattr; |
443 | int error; | 426 | int error; |
444 | 427 | ||
445 | inode = dentry->d_inode; | 428 | inode = dentry->d_inode; |
446 | dvp = vn_from_inode(dir); | ||
447 | 429 | ||
448 | error = bhv_vop_remove(dvp, dentry, NULL); | 430 | error = xfs_remove(XFS_I(dir), dentry); |
449 | if (likely(!error)) { | 431 | if (likely(!error)) { |
450 | xfs_validate_fields(dir, &vattr); /* size needs update */ | 432 | xfs_validate_fields(dir, &vattr); /* size needs update */ |
451 | xfs_validate_fields(inode, &vattr); | 433 | xfs_validate_fields(inode, &vattr); |
@@ -461,18 +443,17 @@ xfs_vn_symlink( | |||
461 | { | 443 | { |
462 | struct inode *ip; | 444 | struct inode *ip; |
463 | bhv_vattr_t va = { 0 }; | 445 | bhv_vattr_t va = { 0 }; |
464 | bhv_vnode_t *dvp; /* directory containing name of symlink */ | ||
465 | bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */ | 446 | bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */ |
466 | int error; | 447 | int error; |
467 | 448 | ||
468 | dvp = vn_from_inode(dir); | ||
469 | cvp = NULL; | 449 | cvp = NULL; |
470 | 450 | ||
471 | va.va_mode = S_IFLNK | | 451 | va.va_mode = S_IFLNK | |
472 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); | 452 | (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); |
473 | va.va_mask = XFS_AT_TYPE|XFS_AT_MODE; | 453 | va.va_mask = XFS_AT_TYPE|XFS_AT_MODE; |
474 | 454 | ||
475 | error = bhv_vop_symlink(dvp, dentry, &va, (char *)symname, &cvp, NULL); | 455 | error = xfs_symlink(XFS_I(dir), dentry, &va, |
456 | (char *)symname, &cvp, NULL); | ||
476 | if (likely(!error && cvp)) { | 457 | if (likely(!error && cvp)) { |
477 | error = xfs_init_security(cvp, dir); | 458 | error = xfs_init_security(cvp, dir); |
478 | if (likely(!error)) { | 459 | if (likely(!error)) { |
@@ -481,7 +462,7 @@ xfs_vn_symlink( | |||
481 | xfs_validate_fields(dir, &va); | 462 | xfs_validate_fields(dir, &va); |
482 | xfs_validate_fields(ip, &va); | 463 | xfs_validate_fields(ip, &va); |
483 | } else { | 464 | } else { |
484 | xfs_cleanup_inode(dvp, cvp, dentry, 0); | 465 | xfs_cleanup_inode(dir, cvp, dentry, 0); |
485 | } | 466 | } |
486 | } | 467 | } |
487 | return -error; | 468 | return -error; |
@@ -493,11 +474,10 @@ xfs_vn_rmdir( | |||
493 | struct dentry *dentry) | 474 | struct dentry *dentry) |
494 | { | 475 | { |
495 | struct inode *inode = dentry->d_inode; | 476 | struct inode *inode = dentry->d_inode; |
496 | bhv_vnode_t *dvp = vn_from_inode(dir); | ||
497 | bhv_vattr_t vattr; | 477 | bhv_vattr_t vattr; |
498 | int error; | 478 | int error; |
499 | 479 | ||
500 | error = bhv_vop_rmdir(dvp, dentry, NULL); | 480 | error = xfs_rmdir(XFS_I(dir), dentry); |
501 | if (likely(!error)) { | 481 | if (likely(!error)) { |
502 | xfs_validate_fields(inode, &vattr); | 482 | xfs_validate_fields(inode, &vattr); |
503 | xfs_validate_fields(dir, &vattr); | 483 | xfs_validate_fields(dir, &vattr); |
@@ -513,15 +493,13 @@ xfs_vn_rename( | |||
513 | struct dentry *ndentry) | 493 | struct dentry *ndentry) |
514 | { | 494 | { |
515 | struct inode *new_inode = ndentry->d_inode; | 495 | struct inode *new_inode = ndentry->d_inode; |
516 | bhv_vnode_t *fvp; /* from directory */ | ||
517 | bhv_vnode_t *tvp; /* target directory */ | 496 | bhv_vnode_t *tvp; /* target directory */ |
518 | bhv_vattr_t vattr; | 497 | bhv_vattr_t vattr; |
519 | int error; | 498 | int error; |
520 | 499 | ||
521 | fvp = vn_from_inode(odir); | ||
522 | tvp = vn_from_inode(ndir); | 500 | tvp = vn_from_inode(ndir); |
523 | 501 | ||
524 | error = bhv_vop_rename(fvp, odentry, tvp, ndentry, NULL); | 502 | error = xfs_rename(XFS_I(odir), odentry, tvp, ndentry); |
525 | if (likely(!error)) { | 503 | if (likely(!error)) { |
526 | if (new_inode) | 504 | if (new_inode) |
527 | xfs_validate_fields(new_inode, &vattr); | 505 | xfs_validate_fields(new_inode, &vattr); |
@@ -542,7 +520,6 @@ xfs_vn_follow_link( | |||
542 | struct dentry *dentry, | 520 | struct dentry *dentry, |
543 | struct nameidata *nd) | 521 | struct nameidata *nd) |
544 | { | 522 | { |
545 | bhv_vnode_t *vp = vn_from_inode(dentry->d_inode); | ||
546 | char *link; | 523 | char *link; |
547 | int error = -ENOMEM; | 524 | int error = -ENOMEM; |
548 | 525 | ||
@@ -550,7 +527,7 @@ xfs_vn_follow_link( | |||
550 | if (!link) | 527 | if (!link) |
551 | goto out_err; | 528 | goto out_err; |
552 | 529 | ||
553 | error = -bhv_vop_readlink(vp, link); | 530 | error = -xfs_readlink(XFS_I(dentry->d_inode), link); |
554 | if (unlikely(error)) | 531 | if (unlikely(error)) |
555 | goto out_kfree; | 532 | goto out_kfree; |
556 | 533 | ||
@@ -583,7 +560,7 @@ xfs_vn_permission( | |||
583 | int mode, | 560 | int mode, |
584 | struct nameidata *nd) | 561 | struct nameidata *nd) |
585 | { | 562 | { |
586 | return -bhv_vop_access(vn_from_inode(inode), mode << 6, NULL); | 563 | return -xfs_access(XFS_I(inode), mode << 6, NULL); |
587 | } | 564 | } |
588 | #else | 565 | #else |
589 | #define xfs_vn_permission NULL | 566 | #define xfs_vn_permission NULL |
@@ -596,11 +573,10 @@ xfs_vn_getattr( | |||
596 | struct kstat *stat) | 573 | struct kstat *stat) |
597 | { | 574 | { |
598 | struct inode *inode = dentry->d_inode; | 575 | struct inode *inode = dentry->d_inode; |
599 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
600 | bhv_vattr_t vattr = { .va_mask = XFS_AT_STAT }; | 576 | bhv_vattr_t vattr = { .va_mask = XFS_AT_STAT }; |
601 | int error; | 577 | int error; |
602 | 578 | ||
603 | error = bhv_vop_getattr(vp, &vattr, ATTR_LAZY, NULL); | 579 | error = xfs_getattr(XFS_I(inode), &vattr, ATTR_LAZY); |
604 | if (likely(!error)) { | 580 | if (likely(!error)) { |
605 | stat->size = i_size_read(inode); | 581 | stat->size = i_size_read(inode); |
606 | stat->dev = inode->i_sb->s_dev; | 582 | stat->dev = inode->i_sb->s_dev; |
@@ -628,7 +604,6 @@ xfs_vn_setattr( | |||
628 | { | 604 | { |
629 | struct inode *inode = dentry->d_inode; | 605 | struct inode *inode = dentry->d_inode; |
630 | unsigned int ia_valid = attr->ia_valid; | 606 | unsigned int ia_valid = attr->ia_valid; |
631 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
632 | bhv_vattr_t vattr = { 0 }; | 607 | bhv_vattr_t vattr = { 0 }; |
633 | int flags = 0; | 608 | int flags = 0; |
634 | int error; | 609 | int error; |
@@ -672,9 +647,9 @@ xfs_vn_setattr( | |||
672 | flags |= ATTR_NONBLOCK; | 647 | flags |= ATTR_NONBLOCK; |
673 | #endif | 648 | #endif |
674 | 649 | ||
675 | error = bhv_vop_setattr(vp, &vattr, flags, NULL); | 650 | error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL); |
676 | if (likely(!error)) | 651 | if (likely(!error)) |
677 | __vn_revalidate(vp, &vattr); | 652 | __vn_revalidate(vn_from_inode(inode), &vattr); |
678 | return -error; | 653 | return -error; |
679 | } | 654 | } |
680 | 655 | ||