]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/xfs/xfs_inode.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6
[mv-sheeva.git] / fs / xfs / xfs_inode.c
index 3ca5d43b83456ccdf8ca4c61f13b363d13c9e76c..cdc4c28926d0cf62d972e807323f9ce3d92de4c0 100644 (file)
@@ -48,7 +48,9 @@
 #include "xfs_dir2_trace.h"
 #include "xfs_quota.h"
 #include "xfs_acl.h"
+#include "xfs_filestream.h"
 
+#include <linux/log2.h>
 
 kmem_zone_t *xfs_ifork_zone;
 kmem_zone_t *xfs_inode_zone;
@@ -643,8 +645,7 @@ xfs_iformat_extents(
                        ep->l1 = INT_GET(get_unaligned((__uint64_t*)&dp->l1),
                                                                ARCH_CONVERT);
                }
-               xfs_bmap_trace_exlist("xfs_iformat_extents", ip, nex,
-                       whichfork);
+               XFS_BMAP_TRACE_EXLIST(ip, nex, whichfork);
                if (whichfork != XFS_DATA_FORK ||
                        XFS_EXTFMT_INODE(ip) == XFS_EXTFMT_NOSTATE)
                                if (unlikely(xfs_check_nostate_extents(
@@ -817,6 +818,8 @@ _xfs_dic2xflags(
                        flags |= XFS_XFLAG_EXTSZINHERIT;
                if (di_flags & XFS_DIFLAG_NODEFRAG)
                        flags |= XFS_XFLAG_NODEFRAG;
+               if (di_flags & XFS_DIFLAG_FILESTREAM)
+                       flags |= XFS_XFLAG_FILESTREAM;
        }
 
        return flags;
@@ -1074,6 +1077,11 @@ xfs_iread_extents(
  * also returns the [locked] bp pointing to the head of the freelist
  * as ialloc_context.  The caller should hold this buffer across
  * the commit and pass it back into this routine on the second call.
+ *
+ * If we are allocating quota inodes, we do not have a parent inode
+ * to attach to or associate with (i.e. pip == NULL) because they
+ * are not linked into the directory structure - they are attached
+ * directly to the superblock - and so have no parent.
  */
 int
 xfs_ialloc(
@@ -1099,7 +1107,7 @@ xfs_ialloc(
         * Call the space management code to pick
         * the on-disk inode to be allocated.
         */
-       error = xfs_dialloc(tp, pip->i_ino, mode, okalloc,
+       error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, okalloc,
                            ialloc_context, call_again, &ino);
        if (error != 0) {
                return error;
@@ -1150,10 +1158,10 @@ xfs_ialloc(
        /*
         * Project ids won't be stored on disk if we are using a version 1 inode.
         */
-       if ( (prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1))
+       if ((prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1))
                xfs_bump_ino_vers2(tp, ip);
 
-       if (XFS_INHERIT_GID(pip, vp->v_vfsp)) {
+       if (pip && XFS_INHERIT_GID(pip, vp->v_vfsp)) {
                ip->i_d.di_gid = pip->i_d.di_gid;
                if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) {
                        ip->i_d.di_mode |= S_ISGID;
@@ -1195,8 +1203,16 @@ xfs_ialloc(
                flags |= XFS_ILOG_DEV;
                break;
        case S_IFREG:
+               if (pip && xfs_inode_is_filestream(pip)) {
+                       error = xfs_filestream_associate(pip, ip);
+                       if (error < 0)
+                               return -error;
+                       if (!error)
+                               xfs_iflags_set(ip, XFS_IFILESTREAM);
+               }
+               /* fall through */
        case S_IFDIR:
-               if (unlikely(pip->i_d.di_flags & XFS_DIFLAG_ANY)) {
+               if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) {
                        uint    di_flags = 0;
 
                        if ((mode & S_IFMT) == S_IFDIR) {
@@ -1233,6 +1249,8 @@ xfs_ialloc(
                        if ((pip->i_d.di_flags & XFS_DIFLAG_NODEFRAG) &&
                            xfs_inherit_nodefrag)
                                di_flags |= XFS_DIFLAG_NODEFRAG;
+                       if (pip->i_d.di_flags & XFS_DIFLAG_FILESTREAM)
+                               di_flags |= XFS_DIFLAG_FILESTREAM;
                        ip->i_d.di_flags |= di_flags;
                }
                /* FALLTHROUGH */
@@ -2875,9 +2893,6 @@ xfs_iextents_copy(
        int                     copied;
        xfs_bmbt_rec_t          *dest_ep;
        xfs_bmbt_rec_t          *ep;
-#ifdef XFS_BMAP_TRACE
-       static char             fname[] = "xfs_iextents_copy";
-#endif
        int                     i;
        xfs_ifork_t             *ifp;
        int                     nrecs;
@@ -2888,7 +2903,7 @@ xfs_iextents_copy(
        ASSERT(ifp->if_bytes > 0);
 
        nrecs = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
-       xfs_bmap_trace_exlist(fname, ip, nrecs, whichfork);
+       XFS_BMAP_TRACE_EXLIST(ip, nrecs, whichfork);
        ASSERT(nrecs > 0);
 
        /*
@@ -4184,7 +4199,7 @@ xfs_iext_realloc_direct(
                        ifp->if_bytes = new_size;
                        return;
                }
-               if ((new_size & (new_size - 1)) != 0) {
+               if (!is_power_of_2(new_size)){
                        rnew_size = xfs_iroundup(new_size);
                }
                if (rnew_size != ifp->if_real_bytes) {
@@ -4207,7 +4222,7 @@ xfs_iext_realloc_direct(
         */
        else {
                new_size += ifp->if_bytes;
-               if ((new_size & (new_size - 1)) != 0) {
+               if (!is_power_of_2(new_size)) {
                        rnew_size = xfs_iroundup(new_size);
                }
                xfs_iext_inline_to_direct(ifp, rnew_size);