diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-09-19 01:27:39 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-16 21:10:14 -0400 |
commit | 6572bc28de150aaa6ca182eaf3e60c199ba48630 (patch) | |
tree | ad1be400b0648e91b021289c60c578735e7d225a /fs/xfs/linux-2.6 | |
parent | 150f29ef2e96392c6ddf24d49289dd40df2783f0 (diff) |
[XFS] simplify validata_fields
Stop using xfs_getattr and a onstack bhv_vattr_t just to get three fields
from the underlying inode and opencode copying from the inode fields
instead.
SGI-PV: 970662
SGI-Modid: xfs-linux-melb:xfs-kern:29711a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 9c4d99709705..11edd72baac7 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -179,18 +179,19 @@ xfs_ichgtime_fast( | |||
179 | */ | 179 | */ |
180 | STATIC void | 180 | STATIC void |
181 | xfs_validate_fields( | 181 | xfs_validate_fields( |
182 | struct inode *ip, | 182 | struct inode *inode) |
183 | bhv_vattr_t *vattr) | ||
184 | { | 183 | { |
185 | vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; | 184 | struct xfs_inode *ip = XFS_I(inode); |
186 | if (!xfs_getattr(XFS_I(ip), vattr, ATTR_LAZY)) { | 185 | loff_t size; |
187 | ip->i_nlink = vattr->va_nlink; | 186 | |
188 | ip->i_blocks = vattr->va_nblocks; | 187 | inode->i_nlink = ip->i_d.di_nlink; |
189 | 188 | inode->i_blocks = | |
190 | /* we're under i_sem so i_size can't change under us */ | 189 | XFS_FSB_TO_BB(ip->i_mount, ip->i_d.di_nblocks + |
191 | if (i_size_read(ip) != vattr->va_size) | 190 | ip->i_delayed_blks); |
192 | i_size_write(ip, vattr->va_size); | 191 | /* we're under i_sem so i_size can't change under us */ |
193 | } | 192 | size = XFS_ISIZE(ip); |
193 | if (i_size_read(inode) != size) | ||
194 | i_size_write(inode, size); | ||
194 | } | 195 | } |
195 | 196 | ||
196 | /* | 197 | /* |
@@ -334,9 +335,9 @@ xfs_vn_mknod( | |||
334 | if (S_ISCHR(mode) || S_ISBLK(mode)) | 335 | if (S_ISCHR(mode) || S_ISBLK(mode)) |
335 | ip->i_rdev = rdev; | 336 | ip->i_rdev = rdev; |
336 | else if (S_ISDIR(mode)) | 337 | else if (S_ISDIR(mode)) |
337 | xfs_validate_fields(ip, &vattr); | 338 | xfs_validate_fields(ip); |
338 | d_instantiate(dentry, ip); | 339 | d_instantiate(dentry, ip); |
339 | xfs_validate_fields(dir, &vattr); | 340 | xfs_validate_fields(dir); |
340 | } | 341 | } |
341 | return -error; | 342 | return -error; |
342 | } | 343 | } |
@@ -391,7 +392,6 @@ xfs_vn_link( | |||
391 | { | 392 | { |
392 | struct inode *ip; /* inode of guy being linked to */ | 393 | struct inode *ip; /* inode of guy being linked to */ |
393 | bhv_vnode_t *vp; /* vp of name being linked */ | 394 | bhv_vnode_t *vp; /* vp of name being linked */ |
394 | bhv_vattr_t vattr; | ||
395 | int error; | 395 | int error; |
396 | 396 | ||
397 | ip = old_dentry->d_inode; /* inode being linked to */ | 397 | ip = old_dentry->d_inode; /* inode being linked to */ |
@@ -403,7 +403,7 @@ xfs_vn_link( | |||
403 | VN_RELE(vp); | 403 | VN_RELE(vp); |
404 | } else { | 404 | } else { |
405 | xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED); | 405 | xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED); |
406 | xfs_validate_fields(ip, &vattr); | 406 | xfs_validate_fields(ip); |
407 | d_instantiate(dentry, ip); | 407 | d_instantiate(dentry, ip); |
408 | } | 408 | } |
409 | return -error; | 409 | return -error; |
@@ -415,15 +415,14 @@ xfs_vn_unlink( | |||
415 | struct dentry *dentry) | 415 | struct dentry *dentry) |
416 | { | 416 | { |
417 | struct inode *inode; | 417 | struct inode *inode; |
418 | bhv_vattr_t vattr; | ||
419 | int error; | 418 | int error; |
420 | 419 | ||
421 | inode = dentry->d_inode; | 420 | inode = dentry->d_inode; |
422 | 421 | ||
423 | error = xfs_remove(XFS_I(dir), dentry); | 422 | error = xfs_remove(XFS_I(dir), dentry); |
424 | if (likely(!error)) { | 423 | if (likely(!error)) { |
425 | xfs_validate_fields(dir, &vattr); /* size needs update */ | 424 | xfs_validate_fields(dir); /* size needs update */ |
426 | xfs_validate_fields(inode, &vattr); | 425 | xfs_validate_fields(inode); |
427 | } | 426 | } |
428 | return -error; | 427 | return -error; |
429 | } | 428 | } |
@@ -451,8 +450,8 @@ xfs_vn_symlink( | |||
451 | if (likely(!error)) { | 450 | if (likely(!error)) { |
452 | ip = vn_to_inode(cvp); | 451 | ip = vn_to_inode(cvp); |
453 | d_instantiate(dentry, ip); | 452 | d_instantiate(dentry, ip); |
454 | xfs_validate_fields(dir, &va); | 453 | xfs_validate_fields(dir); |
455 | xfs_validate_fields(ip, &va); | 454 | xfs_validate_fields(ip); |
456 | } else { | 455 | } else { |
457 | xfs_cleanup_inode(dir, cvp, dentry, 0); | 456 | xfs_cleanup_inode(dir, cvp, dentry, 0); |
458 | } | 457 | } |
@@ -466,13 +465,12 @@ xfs_vn_rmdir( | |||
466 | struct dentry *dentry) | 465 | struct dentry *dentry) |
467 | { | 466 | { |
468 | struct inode *inode = dentry->d_inode; | 467 | struct inode *inode = dentry->d_inode; |
469 | bhv_vattr_t vattr; | ||
470 | int error; | 468 | int error; |
471 | 469 | ||
472 | error = xfs_rmdir(XFS_I(dir), dentry); | 470 | error = xfs_rmdir(XFS_I(dir), dentry); |
473 | if (likely(!error)) { | 471 | if (likely(!error)) { |
474 | xfs_validate_fields(inode, &vattr); | 472 | xfs_validate_fields(inode); |
475 | xfs_validate_fields(dir, &vattr); | 473 | xfs_validate_fields(dir); |
476 | } | 474 | } |
477 | return -error; | 475 | return -error; |
478 | } | 476 | } |
@@ -486,7 +484,6 @@ xfs_vn_rename( | |||
486 | { | 484 | { |
487 | struct inode *new_inode = ndentry->d_inode; | 485 | struct inode *new_inode = ndentry->d_inode; |
488 | bhv_vnode_t *tvp; /* target directory */ | 486 | bhv_vnode_t *tvp; /* target directory */ |
489 | bhv_vattr_t vattr; | ||
490 | int error; | 487 | int error; |
491 | 488 | ||
492 | tvp = vn_from_inode(ndir); | 489 | tvp = vn_from_inode(ndir); |
@@ -494,10 +491,10 @@ xfs_vn_rename( | |||
494 | error = xfs_rename(XFS_I(odir), odentry, tvp, ndentry); | 491 | error = xfs_rename(XFS_I(odir), odentry, tvp, ndentry); |
495 | if (likely(!error)) { | 492 | if (likely(!error)) { |
496 | if (new_inode) | 493 | if (new_inode) |
497 | xfs_validate_fields(new_inode, &vattr); | 494 | xfs_validate_fields(new_inode); |
498 | xfs_validate_fields(odir, &vattr); | 495 | xfs_validate_fields(odir); |
499 | if (ndir != odir) | 496 | if (ndir != odir) |
500 | xfs_validate_fields(ndir, &vattr); | 497 | xfs_validate_fields(ndir); |
501 | } | 498 | } |
502 | return -error; | 499 | return -error; |
503 | } | 500 | } |