[XFS] Unwrap XFS_SB_LOCK.
[pandora-kernel.git] / fs / xfs / xfs_bmap.c
index bbef394..97f0328 100644 (file)
@@ -53,6 +53,7 @@
 #include "xfs_trans_space.h"
 #include "xfs_buf_item.h"
 #include "xfs_filestream.h"
+#include "xfs_vnodeops.h"
 
 
 #ifdef DEBUG
@@ -3492,8 +3493,8 @@ xfs_bmap_extents_to_btree(
        for (cnt = i = 0; i < nextents; i++) {
                ep = xfs_iext_get_ext(ifp, i);
                if (!ISNULLSTARTBLOCK(xfs_bmbt_get_startblock(ep))) {
-                       arp->l0 = INT_GET(ep->l0, ARCH_CONVERT);
-                       arp->l1 = INT_GET(ep->l1, ARCH_CONVERT);
+                       arp->l0 = cpu_to_be64(ep->l0);
+                       arp->l1 = cpu_to_be64(ep->l1);
                        arp++; cnt++;
                }
        }
@@ -3955,7 +3956,6 @@ xfs_bmap_add_attrfork(
        xfs_bmap_free_t         flist;          /* freed extent records */
        xfs_mount_t             *mp;            /* mount structure */
        xfs_trans_t             *tp;            /* transaction pointer */
-       unsigned long           s;              /* spinlock spl value */
        int                     blks;           /* space reservation */
        int                     version = 1;    /* superblock attr version */
        int                     committed;      /* xaction was committed */
@@ -4052,7 +4052,7 @@ xfs_bmap_add_attrfork(
           (!XFS_SB_VERSION_HASATTR2(&mp->m_sb) && version == 2)) {
                __int64_t sbfields = 0;
 
-               s = XFS_SB_LOCK(mp);
+               spin_lock(&mp->m_sb_lock);
                if (!XFS_SB_VERSION_HASATTR(&mp->m_sb)) {
                        XFS_SB_VERSION_ADDATTR(&mp->m_sb);
                        sbfields |= XFS_SB_VERSIONNUM;
@@ -4062,10 +4062,10 @@ xfs_bmap_add_attrfork(
                        sbfields |= (XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
                }
                if (sbfields) {
-                       XFS_SB_UNLOCK(mp, s);
+                       spin_unlock(&mp->m_sb_lock);
                        xfs_mod_sb(tp, sbfields);
                } else
-                       XFS_SB_UNLOCK(mp, s);
+                       spin_unlock(&mp->m_sb_lock);
        }
        if ((error = xfs_bmap_finish(&tp, &flist, &committed)))
                goto error2;
@@ -4566,8 +4566,8 @@ xfs_bmap_read_extents(
                start = i;
                for (j = 0; j < num_recs; j++, i++, frp++) {
                        xfs_bmbt_rec_host_t *trp = xfs_iext_get_ext(ifp, i);
-                       trp->l0 = INT_GET(frp->l0, ARCH_CONVERT);
-                       trp->l1 = INT_GET(frp->l1, ARCH_CONVERT);
+                       trp->l0 = be64_to_cpu(frp->l0);
+                       trp->l1 = be64_to_cpu(frp->l1);
                }
                if (exntf == XFS_EXTFMT_NOSTATE) {
                        /*
@@ -5764,7 +5764,7 @@ xfs_getbmapx_fix_eof_hole(
  */
 int                                            /* error code */
 xfs_getbmap(
-       bhv_desc_t              *bdp,           /* XFS behavior descriptor*/
+       xfs_inode_t             *ip,
        struct getbmap          *bmv,           /* user bmap structure */
        void                    __user *ap,     /* pointer to user's array */
        int                     interface)      /* interface flags */
@@ -5773,7 +5773,6 @@ xfs_getbmap(
        int                     error;          /* return value */
        __int64_t               fixlen;         /* length for -1 case */
        int                     i;              /* extent number */
-       xfs_inode_t             *ip;            /* xfs incore inode pointer */
        bhv_vnode_t             *vp;            /* corresponding vnode */
        int                     lock;           /* lock state */
        xfs_bmbt_irec_t         *map;           /* buffer for user's data */
@@ -5791,8 +5790,7 @@ xfs_getbmap(
        int                     bmapi_flags;    /* flags for xfs_bmapi */
        __int32_t               oflags;         /* getbmapx bmv_oflags field */
 
-       vp = BHV_TO_VNODE(bdp);
-       ip = XFS_BHVTOI(bdp);
+       vp = XFS_ITOV(ip);
        mp = ip->i_mount;
 
        whichfork = interface & BMV_IF_ATTRFORK ? XFS_ATTR_FORK : XFS_DATA_FORK;
@@ -5811,10 +5809,9 @@ xfs_getbmap(
         *      could misinterpret holes in a DMAPI file as true holes,
         *      when in fact they may represent offline user data.
         */
-       if (   (interface & BMV_IF_NO_DMAPI_READ) == 0
-           && DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)
-           && whichfork == XFS_DATA_FORK) {
-
+       if ((interface & BMV_IF_NO_DMAPI_READ) == 0 &&
+           DM_EVENT_ENABLED(ip, DM_EVENT_READ) &&
+           whichfork == XFS_DATA_FORK) {
                error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, 0, 0, 0, NULL);
                if (error)
                        return XFS_ERROR(error);
@@ -5871,7 +5868,8 @@ xfs_getbmap(
        if (whichfork == XFS_DATA_FORK &&
                (ip->i_delayed_blks || ip->i_size > ip->i_d.di_size)) {
                /* xfs_fsize_t last_byte = xfs_file_last_byte(ip); */
-               error = bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF);
+               error = xfs_flush_pages(ip, (xfs_off_t)0,
+                                              -1, 0, FI_REMAPF);
        }
 
        ASSERT(whichfork == XFS_ATTR_FORK || ip->i_delayed_blks == 0);