]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/linux-2.6/xfs_super.c
[XFS] kill bhv_vnode_t
[linux-2.6-omap-h63xx.git] / fs / xfs / linux-2.6 / xfs_super.c
index 30ae96397e318854ab0eb93ecc124916e04bfde5..7605b071dc8809d0088af14e3c752b81f4b4db10 100644 (file)
@@ -613,10 +613,9 @@ xfs_set_inodeops(
 STATIC_INLINE void
 xfs_revalidate_inode(
        xfs_mount_t             *mp,
-       bhv_vnode_t             *vp,
+       struct inode            *inode,
        xfs_inode_t             *ip)
 {
-       struct inode            *inode = vn_to_inode(vp);
 
        inode->i_mode   = ip->i_d.di_mode;
        inode->i_nlink  = ip->i_d.di_nlink;
@@ -665,13 +664,12 @@ xfs_revalidate_inode(
 void
 xfs_initialize_vnode(
        struct xfs_mount        *mp,
-       bhv_vnode_t             *vp,
+       struct inode            *inode,
        struct xfs_inode        *ip)
 {
-       struct inode            *inode = vn_to_inode(vp);
 
        if (!ip->i_vnode) {
-               ip->i_vnode = vp;
+               ip->i_vnode = inode;
                inode->i_private = ip;
        }
 
@@ -683,7 +681,7 @@ xfs_initialize_vnode(
         * finish our work.
         */
        if (ip->i_d.di_mode != 0 && (inode->i_state & I_NEW)) {
-               xfs_revalidate_inode(mp, vp, ip);
+               xfs_revalidate_inode(mp, inode, ip);
                xfs_set_inodeops(inode);
 
                xfs_iflags_clear(ip, XFS_INEW);
@@ -982,26 +980,21 @@ STATIC struct inode *
 xfs_fs_alloc_inode(
        struct super_block      *sb)
 {
-       bhv_vnode_t             *vp;
-
-       vp = kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP);
-       if (unlikely(!vp))
-               return NULL;
-       return vn_to_inode(vp);
+       return kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP);
 }
 
 STATIC void
 xfs_fs_destroy_inode(
        struct inode            *inode)
 {
-       kmem_zone_free(xfs_vnode_zone, vn_from_inode(inode));
+       kmem_zone_free(xfs_vnode_zone, inode);
 }
 
 STATIC void
 xfs_fs_inode_init_once(
        void                    *vnode)
 {
-       inode_init_once(vn_to_inode((bhv_vnode_t *)vnode));
+       inode_init_once((struct inode *)vnode);
 }
 
 /*
@@ -1106,7 +1099,7 @@ void
 xfs_flush_inode(
        xfs_inode_t     *ip)
 {
-       struct inode    *inode = ip->i_vnode;
+       struct inode    *inode = VFS_I(ip);
 
        igrab(inode);
        xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inode_work);
@@ -1131,7 +1124,7 @@ void
 xfs_flush_device(
        xfs_inode_t     *ip)
 {
-       struct inode    *inode = vn_to_inode(XFS_ITOV(ip));
+       struct inode    *inode = VFS_I(ip);
 
        igrab(inode);
        xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_device_work);
@@ -1200,6 +1193,15 @@ xfssyncd(
        return 0;
 }
 
+STATIC void
+xfs_free_fsname(
+       struct xfs_mount        *mp)
+{
+       kfree(mp->m_fsname);
+       kfree(mp->m_rtname);
+       kfree(mp->m_logname);
+}
+
 STATIC void
 xfs_fs_put_super(
        struct super_block      *sb)
@@ -1261,6 +1263,7 @@ xfs_fs_put_super(
        xfs_close_devices(mp);
        xfs_qmops_put(mp);
        xfs_dmops_put(mp);
+       xfs_free_fsname(mp);
        kfree(mp);
 }
 
@@ -1517,6 +1520,8 @@ xfs_start_flags(
        struct xfs_mount_args   *ap,
        struct xfs_mount        *mp)
 {
+       int                     error;
+
        /* Values are in BBs */
        if ((ap->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) {
                /*
@@ -1549,17 +1554,27 @@ xfs_start_flags(
                        ap->logbufsize);
                return XFS_ERROR(EINVAL);
        }
+
+       error = ENOMEM;
+
        mp->m_logbsize = ap->logbufsize;
        mp->m_fsname_len = strlen(ap->fsname) + 1;
-       mp->m_fsname = kmem_alloc(mp->m_fsname_len, KM_SLEEP);
-       strcpy(mp->m_fsname, ap->fsname);
+
+       mp->m_fsname = kstrdup(ap->fsname, GFP_KERNEL);
+       if (!mp->m_fsname)
+               goto out;
+
        if (ap->rtname[0]) {
-               mp->m_rtname = kmem_alloc(strlen(ap->rtname) + 1, KM_SLEEP);
-               strcpy(mp->m_rtname, ap->rtname);
+               mp->m_rtname = kstrdup(ap->rtname, GFP_KERNEL);
+               if (!mp->m_rtname)
+                       goto out_free_fsname;
+
        }
+
        if (ap->logname[0]) {
-               mp->m_logname = kmem_alloc(strlen(ap->logname) + 1, KM_SLEEP);
-               strcpy(mp->m_logname, ap->logname);
+               mp->m_logname = kstrdup(ap->logname, GFP_KERNEL);
+               if (!mp->m_logname)
+                       goto out_free_rtname;
        }
 
        if (ap->flags & XFSMNT_WSYNC)
@@ -1632,6 +1647,14 @@ xfs_start_flags(
        if (ap->flags & XFSMNT_DMAPI)
                mp->m_flags |= XFS_MOUNT_DMAPI;
        return 0;
+
+
+ out_free_rtname:
+       kfree(mp->m_rtname);
+ out_free_fsname:
+       kfree(mp->m_fsname);
+ out:
+       return error;
 }
 
 /*
@@ -1792,10 +1815,10 @@ xfs_fs_fill_super(
         */
        error = xfs_start_flags(args, mp);
        if (error)
-               goto out_destroy_counters;
+               goto out_free_fsname;
        error = xfs_readsb(mp, flags);
        if (error)
-               goto out_destroy_counters;
+               goto out_free_fsname;
        error = xfs_finish_flags(args, mp);
        if (error)
                goto out_free_sb;
@@ -1825,7 +1848,7 @@ xfs_fs_fill_super(
        sb->s_time_gran = 1;
        set_posix_acl_flag(sb);
 
-       root = igrab(mp->m_rootip->i_vnode);
+       root = igrab(VFS_I(mp->m_rootip));
        if (!root) {
                error = ENOENT;
                goto fail_unmount;
@@ -1857,7 +1880,8 @@ xfs_fs_fill_super(
        xfs_filestream_unmount(mp);
  out_free_sb:
        xfs_freesb(mp);
- out_destroy_counters:
+ out_free_fsname:
+       xfs_free_fsname(mp);
        xfs_icsb_destroy_counters(mp);
        xfs_close_devices(mp);
  out_put_qmops:
@@ -1893,7 +1917,7 @@ xfs_fs_fill_super(
        IRELE(mp->m_rootip);
 
        xfs_unmountfs(mp);
-       goto out_destroy_counters;
+       goto out_free_fsname;
 }
 
 STATIC int
@@ -2014,7 +2038,7 @@ xfs_free_trace_bufs(void)
 STATIC int __init
 xfs_init_zones(void)
 {
-       xfs_vnode_zone = kmem_zone_init_flags(sizeof(bhv_vnode_t), "xfs_vnode",
+       xfs_vnode_zone = kmem_zone_init_flags(sizeof(struct inode), "xfs_vnode",
                                        KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
                                        KM_ZONE_SPREAD,
                                        xfs_fs_inode_init_once);