aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-10-11 03:46:39 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 00:49:06 -0500
commitc43f408795c3210c9f5c925e4a49dbb93d41bb57 (patch)
treed60d693822eccbb242305a9945186dd0a4df1090 /fs/xfs
parent613d70436c1aeda6843ca8b70c7fab6d0484a591 (diff)
[XFS] simplify xfs_vn_getattr
Just fill in struct kstat directly from the xfs_inode instead of doing a detour through a bhv_vattr_t and xfs_getattr. SGI-PV: 970980 SGI-Modid: xfs-linux-melb:xfs-kern:29770a 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')
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c78
1 files changed, 53 insertions, 25 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 204ad238ce4a..b5afcfcdc7d5 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -555,33 +555,61 @@ xfs_vn_permission(
555 555
556STATIC int 556STATIC int
557xfs_vn_getattr( 557xfs_vn_getattr(
558 struct vfsmount *mnt, 558 struct vfsmount *mnt,
559 struct dentry *dentry, 559 struct dentry *dentry,
560 struct kstat *stat) 560 struct kstat *stat)
561{ 561{
562 struct inode *inode = dentry->d_inode; 562 struct inode *inode = dentry->d_inode;
563 bhv_vattr_t vattr = { .va_mask = XFS_AT_STAT }; 563 struct xfs_inode *ip = XFS_I(inode);
564 int error; 564 struct xfs_mount *mp = ip->i_mount;
565 565
566 error = xfs_getattr(XFS_I(inode), &vattr, ATTR_LAZY); 566 xfs_itrace_entry(ip);
567 if (likely(!error)) { 567
568 stat->size = i_size_read(inode); 568 if (XFS_FORCED_SHUTDOWN(mp))
569 stat->dev = inode->i_sb->s_dev; 569 return XFS_ERROR(EIO);
570 stat->rdev = (vattr.va_rdev == 0) ? 0 : 570
571 MKDEV(sysv_major(vattr.va_rdev) & 0x1ff, 571 stat->size = XFS_ISIZE(ip);
572 sysv_minor(vattr.va_rdev)); 572 stat->dev = inode->i_sb->s_dev;
573 stat->mode = vattr.va_mode; 573 stat->mode = ip->i_d.di_mode;
574 stat->nlink = vattr.va_nlink; 574 stat->nlink = ip->i_d.di_nlink;
575 stat->uid = vattr.va_uid; 575 stat->uid = ip->i_d.di_uid;
576 stat->gid = vattr.va_gid; 576 stat->gid = ip->i_d.di_gid;
577 stat->ino = vattr.va_nodeid; 577 stat->ino = ip->i_ino;
578 stat->atime = vattr.va_atime; 578#if XFS_BIG_INUMS
579 stat->mtime = vattr.va_mtime; 579 stat->ino += mp->m_inoadd;
580 stat->ctime = vattr.va_ctime; 580#endif
581 stat->blocks = vattr.va_nblocks; 581 stat->atime = inode->i_atime;
582 stat->blksize = vattr.va_blocksize; 582 stat->mtime.tv_sec = ip->i_d.di_mtime.t_sec;
583 stat->mtime.tv_nsec = ip->i_d.di_mtime.t_nsec;
584 stat->ctime.tv_sec = ip->i_d.di_ctime.t_sec;
585 stat->ctime.tv_nsec = ip->i_d.di_ctime.t_nsec;
586 stat->blocks =
587 XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
588
589
590 switch (inode->i_mode & S_IFMT) {
591 case S_IFBLK:
592 case S_IFCHR:
593 stat->blksize = BLKDEV_IOSIZE;
594 stat->rdev = MKDEV(sysv_major(ip->i_df.if_u2.if_rdev) & 0x1ff,
595 sysv_minor(ip->i_df.if_u2.if_rdev));
596 break;
597 default:
598 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) {
599 /*
600 * If the file blocks are being allocated from a
601 * realtime volume, then return the inode's realtime
602 * extent size or the realtime volume's extent size.
603 */
604 stat->blksize =
605 xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
606 } else
607 stat->blksize = xfs_preferred_iosize(mp);
608 stat->rdev = 0;
609 break;
583 } 610 }
584 return -error; 611
612 return 0;
585} 613}
586 614
587STATIC int 615STATIC int