]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/xfs_attr.c
[XFS] move syncing related members from struct bhv_vfs to struct xfs_mount
[linux-2.6-omap-h63xx.git] / fs / xfs / xfs_attr.c
index 9ada7bdbae5219a0803aac3b8c5f55a8d2f095c1..93fa64dd1be6ab49287bc5a1e8a4659767fa20f0 100644 (file)
@@ -49,6 +49,7 @@
 #include "xfs_trans_space.h"
 #include "xfs_acl.h"
 #include "xfs_rw.h"
+#include "xfs_vnodeops.h"
 
 /*
  * xfs_attr.c
@@ -57,9 +58,9 @@
  */
 
 #define ATTR_SYSCOUNT  2
-STATIC struct attrnames posix_acl_access;
-STATIC struct attrnames posix_acl_default;
-STATIC struct attrnames *attr_system_names[ATTR_SYSCOUNT];
+static struct attrnames posix_acl_access;
+static struct attrnames posix_acl_default;
+static struct attrnames *attr_system_names[ATTR_SYSCOUNT];
 
 /*========================================================================
  * Function prototypes for the kernel.
@@ -156,10 +157,14 @@ xfs_attr_fetch(xfs_inode_t *ip, const char *name, int namelen,
 }
 
 int
-xfs_attr_get(bhv_desc_t *bdp, const char *name, char *value, int *valuelenp,
-            int flags, struct cred *cred)
+xfs_attr_get(
+       xfs_inode_t     *ip,
+       const char      *name,
+       char            *value,
+       int             *valuelenp,
+       int             flags,
+       cred_t          *cred)
 {
-       xfs_inode_t     *ip = XFS_BHVTOI(bdp);
        int             error, namelen;
 
        XFS_STATS_INC(xs_attr_get);
@@ -198,19 +203,15 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen,
        if ((error = XFS_QM_DQATTACH(mp, dp, 0)))
                return (error);
 
-       /*
-        * Determine space new attribute will use, and if it would be
-        * "local" or "remote" (note: local != inline).
-        */
-       size = xfs_attr_leaf_newentsize(namelen, valuelen,
-                                       mp->m_sb.sb_blocksize, &local);
-
        /*
         * If the inode doesn't have an attribute fork, add one.
         * (inode must not be locked when we call this routine)
         */
        if (XFS_IFORK_Q(dp) == 0) {
-               if ((error = xfs_bmap_add_attrfork(dp, size, rsvd)))
+               int sf_size = sizeof(xfs_attr_sf_hdr_t) +
+                             XFS_ATTR_SF_ENTSIZE_BYNAME(namelen, valuelen);
+
+               if ((error = xfs_bmap_add_attrfork(dp, sf_size, rsvd)))
                        return(error);
        }
 
@@ -231,6 +232,13 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen,
        args.addname = 1;
        args.oknoent = 1;
 
+       /*
+        * Determine space new attribute will use, and if it would be
+        * "local" or "remote" (note: local != inline).
+        */
+       size = xfs_attr_leaf_newentsize(namelen, valuelen,
+                                       mp->m_sb.sb_blocksize, &local);
+
        nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK);
        if (local) {
                if (size > (mp->m_sb.sb_blocksize >> 1)) {
@@ -325,8 +333,7 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen,
                                xfs_trans_set_sync(args.trans);
                        }
                        err2 = xfs_trans_commit(args.trans,
-                                                XFS_TRANS_RELEASE_LOG_RES,
-                                                NULL);
+                                                XFS_TRANS_RELEASE_LOG_RES);
                        xfs_iunlock(dp, XFS_ILOCK_EXCL);
 
                        /*
@@ -346,7 +353,7 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen,
                error = xfs_attr_shortform_to_leaf(&args);
                if (!error) {
                        error = xfs_bmap_finish(&args.trans, args.flist,
-                                               *args.firstblock, &committed);
+                                               &committed);
                }
                if (error) {
                        ASSERT(committed);
@@ -394,8 +401,7 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen,
         * Commit the last in the sequence of transactions.
         */
        xfs_trans_log_inode(args.trans, dp, XFS_ILOG_CORE);
-       error = xfs_trans_commit(args.trans, XFS_TRANS_RELEASE_LOG_RES,
-                                NULL);
+       error = xfs_trans_commit(args.trans, XFS_TRANS_RELEASE_LOG_RES);
        xfs_iunlock(dp, XFS_ILOCK_EXCL);
 
        /*
@@ -416,10 +422,13 @@ out:
 }
 
 int
-xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int flags,
-            struct cred *cred)
+xfs_attr_set(
+       xfs_inode_t     *dp,
+       const char      *name,
+       char            *value,
+       int             valuelen,
+       int             flags)
 {
-       xfs_inode_t     *dp;
        int             namelen;
 
        namelen = strlen(name);
@@ -428,7 +437,6 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f
 
        XFS_STATS_INC(xs_attr_set);
 
-       dp = XFS_BHVTOI(bdp);
        if (XFS_FORCED_SHUTDOWN(dp->i_mount))
                return (EIO);
 
@@ -541,8 +549,7 @@ xfs_attr_remove_int(xfs_inode_t *dp, const char *name, int namelen, int flags)
         * Commit the last in the sequence of transactions.
         */
        xfs_trans_log_inode(args.trans, dp, XFS_ILOG_CORE);
-       error = xfs_trans_commit(args.trans, XFS_TRANS_RELEASE_LOG_RES,
-                                NULL);
+       error = xfs_trans_commit(args.trans, XFS_TRANS_RELEASE_LOG_RES);
        xfs_iunlock(dp, XFS_ILOCK_EXCL);
 
        /*
@@ -563,10 +570,12 @@ out:
 }
 
 int
-xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred)
+xfs_attr_remove(
+       xfs_inode_t     *dp,
+       const char      *name,
+       int             flags)
 {
-       xfs_inode_t         *dp;
-       int                 namelen;
+       int             namelen;
 
        namelen = strlen(name);
        if (namelen >= MAXNAMELEN)
@@ -574,7 +583,6 @@ xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred)
 
        XFS_STATS_INC(xs_attr_remove);
 
-       dp = XFS_BHVTOI(bdp);
        if (XFS_FORCED_SHUTDOWN(dp->i_mount))
                return (EIO);
 
@@ -702,11 +710,14 @@ xfs_attr_kern_list_sizes(xfs_attr_list_context_t *context, attrnames_t *namesp,
  * success.
  */
 int
-xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
-                     attrlist_cursor_kern_t *cursor, struct cred *cred)
+xfs_attr_list(
+       xfs_inode_t     *dp,
+       char            *buffer,
+       int             bufsize,
+       int             flags,
+       attrlist_cursor_kern_t *cursor)
 {
        xfs_attr_list_context_t context;
-       xfs_inode_t *dp;
        int error;
 
        XFS_STATS_INC(xs_attr_list);
@@ -731,7 +742,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
        /*
         * Initialize the output buffer.
         */
-       context.dp = dp = XFS_BHVTOI(bdp);
+       context.dp = dp;
        context.cursor = cursor;
        context.count = 0;
        context.dupcnt = 0;
@@ -856,8 +867,7 @@ xfs_attr_inactive(xfs_inode_t *dp)
         * Commit the last in the sequence of transactions.
         */
        xfs_trans_log_inode(trans, dp, XFS_ILOG_CORE);
-       error = xfs_trans_commit(trans, XFS_TRANS_RELEASE_LOG_RES,
-                                NULL);
+       error = xfs_trans_commit(trans, XFS_TRANS_RELEASE_LOG_RES);
        xfs_iunlock(dp, XFS_ILOCK_EXCL);
 
        return(error);
@@ -973,7 +983,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
                error = xfs_attr_leaf_to_node(args);
                if (!error) {
                        error = xfs_bmap_finish(&args->trans, args->flist,
-                                               *args->firstblock, &committed);
+                                               &committed);
                }
                if (error) {
                        ASSERT(committed);
@@ -1074,7 +1084,6 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
                        if (!error) {
                                error = xfs_bmap_finish(&args->trans,
                                                        args->flist,
-                                                       *args->firstblock,
                                                        &committed);
                        }
                        if (error) {
@@ -1152,7 +1161,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
                /* bp is gone due to xfs_da_shrink_inode */
                if (!error) {
                        error = xfs_bmap_finish(&args->trans, args->flist,
-                                               *args->firstblock, &committed);
+                                               &committed);
                }
                if (error) {
                        ASSERT(committed);
@@ -1307,7 +1316,6 @@ restart:
                        if (!error) {
                                error = xfs_bmap_finish(&args->trans,
                                                        args->flist,
-                                                       *args->firstblock,
                                                        &committed);
                        }
                        if (error) {
@@ -1347,7 +1355,7 @@ restart:
                error = xfs_da_split(state);
                if (!error) {
                        error = xfs_bmap_finish(&args->trans, args->flist,
-                                               *args->firstblock, &committed);
+                                               &committed);
                }
                if (error) {
                        ASSERT(committed);
@@ -1459,7 +1467,6 @@ restart:
                        if (!error) {
                                error = xfs_bmap_finish(&args->trans,
                                                        args->flist,
-                                                       *args->firstblock,
                                                        &committed);
                        }
                        if (error) {
@@ -1594,7 +1601,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
                error = xfs_da_join(state);
                if (!error) {
                        error = xfs_bmap_finish(&args->trans, args->flist,
-                                               *args->firstblock, &committed);
+                                               &committed);
                }
                if (error) {
                        ASSERT(committed);
@@ -1646,7 +1653,6 @@ xfs_attr_node_removename(xfs_da_args_t *args)
                        if (!error) {
                                error = xfs_bmap_finish(&args->trans,
                                                        args->flist,
-                                                       *args->firstblock,
                                                        &committed);
                        }
                        if (error) {
@@ -2090,7 +2096,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
                                  args->flist, NULL);
                if (!error) {
                        error = xfs_bmap_finish(&args->trans, args->flist,
-                                               *args->firstblock, &committed);
+                                               &committed);
                }
                if (error) {
                        ASSERT(committed);
@@ -2246,7 +2252,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
                                    NULL, &done);
                if (!error) {
                        error = xfs_bmap_finish(&args->trans, args->flist,
-                                               *args->firstblock, &committed);
+                                               &committed);
                }
                if (error) {
                        ASSERT(committed);
@@ -2477,7 +2483,7 @@ posix_acl_default_exists(
        return xfs_acl_vhasacl_default(vp);
 }
 
-STATIC struct attrnames posix_acl_access = {
+static struct attrnames posix_acl_access = {
        .attr_name      = "posix_acl_access",
        .attr_namelen   = sizeof("posix_acl_access") - 1,
        .attr_get       = posix_acl_access_get,
@@ -2486,7 +2492,7 @@ STATIC struct attrnames posix_acl_access = {
        .attr_exists    = posix_acl_access_exists,
 };
 
-STATIC struct attrnames posix_acl_default = {
+static struct attrnames posix_acl_default = {
        .attr_name      = "posix_acl_default",
        .attr_namelen   = sizeof("posix_acl_default") - 1,
        .attr_get       = posix_acl_default_get,
@@ -2495,7 +2501,7 @@ STATIC struct attrnames posix_acl_default = {
        .attr_exists    = posix_acl_default_exists,
 };
 
-STATIC struct attrnames *attr_system_names[] =
+static struct attrnames *attr_system_names[] =
        { &posix_acl_access, &posix_acl_default };
 
 
@@ -2507,7 +2513,7 @@ STATIC int
 attr_generic_set(
        bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
 {
-       return -bhv_vop_attr_set(vp, name, data, size, xflags, NULL);
+       return -xfs_attr_set(xfs_vtoi(vp), name, data, size, xflags);
 }
 
 STATIC int
@@ -2516,7 +2522,8 @@ attr_generic_get(
 {
        int     error, asize = size;
 
-       error = bhv_vop_attr_get(vp, name, data, &asize, xflags, NULL);
+       error = xfs_attr_get(xfs_vtoi(vp), name, data,
+                                   &asize, xflags, NULL);
        if (!error)
                return asize;
        return -error;
@@ -2526,7 +2533,7 @@ STATIC int
 attr_generic_remove(
        bhv_vnode_t *vp, char *name, int xflags)
 {
-       return -bhv_vop_attr_remove(vp, name, xflags, NULL);
+       return -xfs_attr_remove(xfs_vtoi(vp), name, xflags);
 }
 
 STATIC int
@@ -2581,7 +2588,7 @@ attr_generic_list(
        attrlist_cursor_kern_t  cursor = { 0 };
        int                     error;
 
-       error = bhv_vop_attr_list(vp, data, size, xflags, &cursor, NULL);
+       error = xfs_attr_list(xfs_vtoi(vp), data, size, xflags, &cursor);
        if (error > 0)
                return -error;
        *result = -error;