]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[XFS] Fix merge failures
authorLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Mon, 29 Dec 2008 05:47:18 +0000 (16:47 +1100)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Mon, 29 Dec 2008 05:47:18 +0000 (16:47 +1100)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6

Conflicts:

fs/xfs/linux-2.6/xfs_cred.h
fs/xfs/linux-2.6/xfs_globals.h
fs/xfs/linux-2.6/xfs_ioctl.c
fs/xfs/xfs_vnodeops.h

Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
1  2 
fs/xfs/linux-2.6/xfs_cred.h
fs/xfs/linux-2.6/xfs_ioctl.c
fs/xfs/xfs_inode.h
fs/xfs/xfs_vnodeops.h
include/linux/fs.h

index e279d00779f4dfb07defbd51f77216790d0daea9,8c022cd0ad672dc9f68687c54cb305dc5f846a19..55bddf3b60912022267801cd883bb1c21e93f832
  /*
   * Credentials
   */
- typedef struct cred {
-        /* EMPTY */
- } cred_t;
+ typedef const struct cred cred_t;
  
 -extern cred_t *sys_cred;
 -
 -/* this is a hack.. (assumes sys_cred is the only cred_t in the system) */
 -static inline int capable_cred(cred_t *cr, int cid)
 -{
 -      return (cr == sys_cred) ? 1 : capable(cid);
 -}
 -
  #endif  /* __XFS_CRED_H__ */
index 0264c8719ffd9d2ecf52a6f92848c0fdc117a0ca,281cbd5a25cfd1550645370cf339e0e251d1f721..67205f6198ba58019eb549ffc6440e56b84af8b4
   * XFS_IOC_PATH_TO_HANDLE
   *    returns full handle for a path
   */
 -STATIC int
 +int
  xfs_find_handle(
        unsigned int            cmd,
 -      void                    __user *arg)
 +      xfs_fsop_handlereq_t    *hreq)
  {
        int                     hsize;
        xfs_handle_t            handle;
 -      xfs_fsop_handlereq_t    hreq;
        struct inode            *inode;
  
 -      if (copy_from_user(&hreq, arg, sizeof(hreq)))
 -              return -XFS_ERROR(EFAULT);
 -
        memset((char *)&handle, 0, sizeof(handle));
  
        switch (cmd) {
        case XFS_IOC_PATH_TO_FSHANDLE:
        case XFS_IOC_PATH_TO_HANDLE: {
                struct path path;
 -              int error = user_lpath((const char __user *)hreq.path, &path);
 +              int error = user_lpath((const char __user *)hreq->path, &path);
                if (error)
                        return error;
  
        case XFS_IOC_FD_TO_HANDLE: {
                struct file     *file;
  
 -              file = fget(hreq.fd);
 +              file = fget(hreq->fd);
                if (!file)
                    return -EBADF;
  
        }
  
        /* now copy our handle into the user buffer & write out the size */
 -      if (copy_to_user(hreq.ohandle, &handle, hsize) ||
 -          copy_to_user(hreq.ohandlen, &hsize, sizeof(__s32))) {
 +      if (copy_to_user(hreq->ohandle, &handle, hsize) ||
 +          copy_to_user(hreq->ohandlen, &hsize, sizeof(__s32))) {
                iput(inode);
                return -XFS_ERROR(EFAULT);
        }
@@@ -245,24 -249,28 +245,25 @@@ xfs_vget_fsop_handlereq
        return 0;
  }
  
 -STATIC int
 +int
  xfs_open_by_handle(
        xfs_mount_t             *mp,
 -      void                    __user *arg,
 +      xfs_fsop_handlereq_t    *hreq,
        struct file             *parfilp,
        struct inode            *parinode)
  {
+       const struct cred       *cred = current_cred();
        int                     error;
        int                     new_fd;
        int                     permflag;
        struct file             *filp;
        struct inode            *inode;
        struct dentry           *dentry;
 -      xfs_fsop_handlereq_t    hreq;
  
        if (!capable(CAP_SYS_ADMIN))
                return -XFS_ERROR(EPERM);
 -      if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
 -              return -XFS_ERROR(EFAULT);
  
 -      error = xfs_vget_fsop_handlereq(mp, parinode, &hreq, &inode);
 +      error = xfs_vget_fsop_handlereq(mp, parinode, hreq, &inode);
        if (error)
                return -error;
  
        }
  
  #if BITS_PER_LONG != 32
 -      hreq.oflags |= O_LARGEFILE;
 +      hreq->oflags |= O_LARGEFILE;
  #endif
        /* Put open permission in namei format. */
 -      permflag = hreq.oflags;
 +      permflag = hreq->oflags;
        if ((permflag+1) & O_ACCMODE)
                permflag++;
        if (permflag & O_TRUNC)
        mntget(parfilp->f_path.mnt);
  
        /* Create file pointer. */
-       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq->oflags);
 -      filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags, cred);
++      filp = dentry_open(dentry, parfilp->f_path.mnt, hreq->oflags, cred);
        if (IS_ERR(filp)) {
                put_unused_fd(new_fd);
                return -XFS_ERROR(-PTR_ERR(filp));
        }
 +
        if (inode->i_mode & S_IFREG) {
                /* invisible operation should not change atime */
                filp->f_flags |= O_NOATIME;
 -              filp->f_op = &xfs_invis_file_operations;
 +              filp->f_mode |= FMODE_NOCMTIME;
        }
  
        fd_install(new_fd, filp);
@@@ -356,21 -363,24 +357,21 @@@ do_readlink
  }
  
  
 -STATIC int
 +int
  xfs_readlink_by_handle(
        xfs_mount_t             *mp,
 -      void                    __user *arg,
 +      xfs_fsop_handlereq_t    *hreq,
        struct inode            *parinode)
  {
        struct inode            *inode;
 -      xfs_fsop_handlereq_t    hreq;
        __u32                   olen;
        void                    *link;
        int                     error;
  
        if (!capable(CAP_SYS_ADMIN))
                return -XFS_ERROR(EPERM);
 -      if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
 -              return -XFS_ERROR(EFAULT);
  
 -      error = xfs_vget_fsop_handlereq(mp, parinode, &hreq, &inode);
 +      error = xfs_vget_fsop_handlereq(mp, parinode, hreq, &inode);
        if (error)
                return -error;
  
                goto out_iput;
        }
  
 -      if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) {
 +      if (copy_from_user(&olen, hreq->ohandlen, sizeof(__u32))) {
                error = -XFS_ERROR(EFAULT);
                goto out_iput;
        }
        error = -xfs_readlink(XFS_I(inode), link);
        if (error)
                goto out_kfree;
 -      error = do_readlink(hreq.ohandle, olen, link);
 +      error = do_readlink(hreq->ohandle, olen, link);
        if (error)
                goto out_kfree;
  
@@@ -491,7 -501,7 +492,7 @@@ xfs_attrlist_by_handle
        return -error;
  }
  
 -STATIC int
 +int
  xfs_attrmulti_attr_get(
        struct inode            *inode,
        char                    *name,
        return error;
  }
  
 -STATIC int
 +int
  xfs_attrmulti_attr_set(
        struct inode            *inode,
        char                    *name,
        return error;
  }
  
 -STATIC int
 +int
  xfs_attrmulti_attr_remove(
        struct inode            *inode,
        char                    *name,
@@@ -652,26 -662,19 +653,26 @@@ xfs_attrmulti_by_handle
        return -error;
  }
  
 -STATIC int
 +int
  xfs_ioc_space(
        struct xfs_inode        *ip,
        struct inode            *inode,
        struct file             *filp,
        int                     ioflags,
        unsigned int            cmd,
 -      void                    __user *arg)
 +      xfs_flock64_t           *bf)
  {
 -      xfs_flock64_t           bf;
        int                     attr_flags = 0;
        int                     error;
  
 +      /*
 +       * Only allow the sys admin to reserve space unless
 +       * unwritten extents are enabled.
 +       */
 +      if (!xfs_sb_version_hasextflgbit(&ip->i_mount->m_sb) &&
 +          !capable(CAP_SYS_ADMIN))
 +              return -XFS_ERROR(EPERM);
 +
        if (inode->i_flags & (S_IMMUTABLE|S_APPEND))
                return -XFS_ERROR(EPERM);
  
        if (!S_ISREG(inode->i_mode))
                return -XFS_ERROR(EINVAL);
  
 -      if (copy_from_user(&bf, arg, sizeof(bf)))
 -              return -XFS_ERROR(EFAULT);
 -
        if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
                attr_flags |= XFS_ATTR_NONBLOCK;
        if (ioflags & IO_INVIS)
                attr_flags |= XFS_ATTR_DMI;
  
 -      error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos,
 -                                            NULL, attr_flags);
 +      error = xfs_change_file_space(ip, cmd, bf, filp->f_pos, attr_flags);
        return -error;
  }
  
@@@ -1098,6 -1105,10 +1099,6 @@@ xfs_ioctl_setattr
  
        /*
         * Change file ownership.  Must be the owner or privileged.
 -       * If the system was configured with the "restricted_chown"
 -       * option, the owner is not permitted to give away the file,
 -       * and can change the group id only to a group of which he
 -       * or she is a member.
         */
        if (mask & FSX_PROJID) {
                /*
                         * the superblock version number since projids didn't
                         * exist before DINODE_VERSION_2 and SB_VERSION_NLINK.
                         */
 -                      if (ip->i_d.di_version == XFS_DINODE_VERSION_1)
 +                      if (ip->i_d.di_version == 1)
                                xfs_bump_ino_vers2(tp, ip);
                }
  
@@@ -1244,19 -1255,6 +1245,19 @@@ xfs_ioc_setxflags
        return -xfs_ioctl_setattr(ip, &fa, mask);
  }
  
 +STATIC int
 +xfs_getbmap_format(void **ap, struct getbmapx *bmv, int *full)
 +{
 +      struct getbmap __user   *base = *ap;
 +
 +      /* copy only getbmap portion (not getbmapx) */
 +      if (copy_to_user(base, bmv, sizeof(struct getbmap)))
 +              return XFS_ERROR(EFAULT);
 +
 +      *ap += sizeof(struct getbmap);
 +      return 0;
 +}
 +
  STATIC int
  xfs_ioc_getbmap(
        struct xfs_inode        *ip,
        unsigned int            cmd,
        void                    __user *arg)
  {
 -      struct getbmap          bm;
 -      int                     iflags;
 +      struct getbmapx         bmx;
        int                     error;
  
 -      if (copy_from_user(&bm, arg, sizeof(bm)))
 +      if (copy_from_user(&bmx, arg, sizeof(struct getbmapx)))
                return -XFS_ERROR(EFAULT);
  
 -      if (bm.bmv_count < 2)
 +      if (bmx.bmv_count < 2)
                return -XFS_ERROR(EINVAL);
  
 -      iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0);
 +      bmx.bmv_iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0);
        if (ioflags & IO_INVIS)
 -              iflags |= BMV_IF_NO_DMAPI_READ;
 +              bmx.bmv_iflags |= BMV_IF_NO_DMAPI_READ;
  
 -      error = xfs_getbmap(ip, &bm, (struct getbmap __user *)arg+1, iflags);
 +      error = xfs_getbmap(ip, &bmx, xfs_getbmap_format,
 +                          (struct getbmap *)arg+1);
        if (error)
                return -error;
  
 -      if (copy_to_user(arg, &bm, sizeof(bm)))
 +      /* copy back header - only size of getbmap */
 +      if (copy_to_user(arg, &bmx, sizeof(struct getbmap)))
                return -XFS_ERROR(EFAULT);
        return 0;
  }
  
 +STATIC int
 +xfs_getbmapx_format(void **ap, struct getbmapx *bmv, int *full)
 +{
 +      struct getbmapx __user  *base = *ap;
 +
 +      if (copy_to_user(base, bmv, sizeof(struct getbmapx)))
 +              return XFS_ERROR(EFAULT);
 +
 +      *ap += sizeof(struct getbmapx);
 +      return 0;
 +}
 +
  STATIC int
  xfs_ioc_getbmapx(
        struct xfs_inode        *ip,
        void                    __user *arg)
  {
        struct getbmapx         bmx;
 -      struct getbmap          bm;
 -      int                     iflags;
        int                     error;
  
        if (copy_from_user(&bmx, arg, sizeof(bmx)))
        if (bmx.bmv_count < 2)
                return -XFS_ERROR(EINVAL);
  
 -      /*
 -       * Map input getbmapx structure to a getbmap
 -       * structure for xfs_getbmap.
 -       */
 -      GETBMAP_CONVERT(bmx, bm);
 -
 -      iflags = bmx.bmv_iflags;
 -
 -      if (iflags & (~BMV_IF_VALID))
 +      if (bmx.bmv_iflags & (~BMV_IF_VALID))
                return -XFS_ERROR(EINVAL);
  
 -      iflags |= BMV_IF_EXTENDED;
 -
 -      error = xfs_getbmap(ip, &bm, (struct getbmapx __user *)arg+1, iflags);
 +      error = xfs_getbmap(ip, &bmx, xfs_getbmapx_format,
 +                          (struct getbmapx *)arg+1);
        if (error)
                return -error;
  
 -      GETBMAP_CONVERT(bm, bmx);
 -
 -      if (copy_to_user(arg, &bmx, sizeof(bmx)))
 +      /* copy back header */
 +      if (copy_to_user(arg, &bmx, sizeof(struct getbmapx)))
                return -XFS_ERROR(EFAULT);
  
        return 0;
  }
  
 -int
 -xfs_ioctl(
 -      xfs_inode_t             *ip,
 +/*
 + * Note: some of the ioctl's return positive numbers as a
 + * byte count indicating success, such as readlink_by_handle.
 + * So we don't "sign flip" like most other routines.  This means
 + * true errors need to be returned as a negative value.
 + */
 +long
 +xfs_file_ioctl(
        struct file             *filp,
 -      int                     ioflags,
        unsigned int            cmd,
 -      void                    __user *arg)
 +      unsigned long           p)
  {
        struct inode            *inode = filp->f_path.dentry->d_inode;
 -      xfs_mount_t             *mp = ip->i_mount;
 +      struct xfs_inode        *ip = XFS_I(inode);
 +      struct xfs_mount        *mp = ip->i_mount;
 +      void                    __user *arg = (void __user *)p;
 +      int                     ioflags = 0;
        int                     error;
  
 -      xfs_itrace_entry(XFS_I(inode));
 -      switch (cmd) {
 +      if (filp->f_mode & FMODE_NOCMTIME)
 +              ioflags |= IO_INVIS;
  
 +      xfs_itrace_entry(ip);
 +
 +      switch (cmd) {
        case XFS_IOC_ALLOCSP:
        case XFS_IOC_FREESP:
        case XFS_IOC_RESVSP:
        case XFS_IOC_ALLOCSP64:
        case XFS_IOC_FREESP64:
        case XFS_IOC_RESVSP64:
 -      case XFS_IOC_UNRESVSP64:
 -              /*
 -               * Only allow the sys admin to reserve space unless
 -               * unwritten extents are enabled.
 -               */
 -              if (!xfs_sb_version_hasextflgbit(&mp->m_sb) &&
 -                  !capable(CAP_SYS_ADMIN))
 -                      return -EPERM;
 -
 -              return xfs_ioc_space(ip, inode, filp, ioflags, cmd, arg);
 +      case XFS_IOC_UNRESVSP64: {
 +              xfs_flock64_t           bf;
  
 +              if (copy_from_user(&bf, arg, sizeof(bf)))
 +                      return -XFS_ERROR(EFAULT);
 +              return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf);
 +      }
        case XFS_IOC_DIOINFO: {
                struct dioattr  da;
                xfs_buftarg_t   *target =
  
        case XFS_IOC_FD_TO_HANDLE:
        case XFS_IOC_PATH_TO_HANDLE:
 -      case XFS_IOC_PATH_TO_FSHANDLE:
 -              return xfs_find_handle(cmd, arg);
 +      case XFS_IOC_PATH_TO_FSHANDLE: {
 +              xfs_fsop_handlereq_t    hreq;
  
 -      case XFS_IOC_OPEN_BY_HANDLE:
 -              return xfs_open_by_handle(mp, arg, filp, inode);
 +              if (copy_from_user(&hreq, arg, sizeof(hreq)))
 +                      return -XFS_ERROR(EFAULT);
 +              return xfs_find_handle(cmd, &hreq);
 +      }
 +      case XFS_IOC_OPEN_BY_HANDLE: {
 +              xfs_fsop_handlereq_t    hreq;
  
 +              if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
 +                      return -XFS_ERROR(EFAULT);
 +              return xfs_open_by_handle(mp, &hreq, filp, inode);
 +      }
        case XFS_IOC_FSSETDM_BY_HANDLE:
                return xfs_fssetdm_by_handle(mp, arg, inode);
  
 -      case XFS_IOC_READLINK_BY_HANDLE:
 -              return xfs_readlink_by_handle(mp, arg, inode);
 +      case XFS_IOC_READLINK_BY_HANDLE: {
 +              xfs_fsop_handlereq_t    hreq;
  
 +              if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
 +                      return -XFS_ERROR(EFAULT);
 +              return xfs_readlink_by_handle(mp, &hreq, inode);
 +      }
        case XFS_IOC_ATTRLIST_BY_HANDLE:
                return xfs_attrlist_by_handle(mp, arg, inode);
  
                return xfs_attrmulti_by_handle(mp, arg, filp, inode);
  
        case XFS_IOC_SWAPEXT: {
 -              error = xfs_swapext((struct xfs_swapext __user *)arg);
 +              struct xfs_swapext      sxp;
 +
 +              if (copy_from_user(&sxp, arg, sizeof(xfs_swapext_t)))
 +                      return -XFS_ERROR(EFAULT);
 +              error = xfs_swapext(&sxp);
                return -error;
        }
  
        case XFS_IOC_FSGROWFSDATA: {
                xfs_growfs_data_t in;
  
 -              if (!capable(CAP_SYS_ADMIN))
 -                      return -EPERM;
 -
                if (copy_from_user(&in, arg, sizeof(in)))
                        return -XFS_ERROR(EFAULT);
  
        case XFS_IOC_FSGROWFSLOG: {
                xfs_growfs_log_t in;
  
 -              if (!capable(CAP_SYS_ADMIN))
 -                      return -EPERM;
 -
                if (copy_from_user(&in, arg, sizeof(in)))
                        return -XFS_ERROR(EFAULT);
  
        case XFS_IOC_FSGROWFSRT: {
                xfs_growfs_rt_t in;
  
 -              if (!capable(CAP_SYS_ADMIN))
 -                      return -EPERM;
 -
                if (copy_from_user(&in, arg, sizeof(in)))
                        return -XFS_ERROR(EFAULT);
  
diff --combined fs/xfs/xfs_inode.h
index f0e4d79833e19dcb272dfd4b19c8000c0e344497,6be310d41daf105556239a2f338dafaeb940e35f..1f175fa34b225df1da087a6fceadb201205fcbe8
@@@ -19,7 -19,8 +19,7 @@@
  #define       __XFS_INODE_H__
  
  struct xfs_dinode;
 -struct xfs_dinode_core;
 -
 +struct xfs_inode;
  
  /*
   * Fork identifiers.
@@@ -62,7 -63,7 +62,7 @@@ typedef struct xfs_ext_irec 
  typedef struct xfs_ifork {
        int                     if_bytes;       /* bytes in if_u1 */
        int                     if_real_bytes;  /* bytes allocated in if_u1 */
 -      xfs_bmbt_block_t        *if_broot;      /* file's incore btree root */
 +      struct xfs_btree_block  *if_broot;      /* file's incore btree root */
        short                   if_broot_bytes; /* bytes allocated for root */
        unsigned char           if_flags;       /* per-fork flags */
        unsigned char           if_ext_max;     /* max # of extent records */
  } xfs_ifork_t;
  
  /*
 - * Flags for xfs_ichgtime().
 + * Inode location information.  Stored in the inode and passed to
 + * xfs_imap_to_bp() to get a buffer and dinode for a given inode.
   */
 -#define       XFS_ICHGTIME_MOD        0x1     /* data fork modification timestamp */
 -#define       XFS_ICHGTIME_CHG        0x2     /* inode field change timestamp */
 -
 -/*
 - * Per-fork incore inode flags.
 - */
 -#define       XFS_IFINLINE    0x01    /* Inline data is read in */
 -#define       XFS_IFEXTENTS   0x02    /* All extent pointers are read in */
 -#define       XFS_IFBROOT     0x04    /* i_broot points to the bmap b-tree root */
 -#define       XFS_IFEXTIREC   0x08    /* Indirection array of extent blocks */
 -
 -/*
 - * Flags for xfs_itobp(), xfs_imap() and xfs_dilocate().
 - */
 -#define XFS_IMAP_LOOKUP               0x1
 -#define XFS_IMAP_BULKSTAT     0x2
 -
 -#ifdef __KERNEL__
 -struct bhv_desc;
 -struct cred;
 -struct ktrace;
 -struct xfs_buf;
 -struct xfs_bmap_free;
 -struct xfs_bmbt_irec;
 -struct xfs_bmbt_block;
 -struct xfs_inode;
 -struct xfs_inode_log_item;
 -struct xfs_mount;
 -struct xfs_trans;
 -struct xfs_dquot;
 -
 -#if defined(XFS_ILOCK_TRACE)
 -#define XFS_ILOCK_KTRACE_SIZE 32
 -extern ktrace_t *xfs_ilock_trace_buf;
 -extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
 -#else
 -#define       xfs_ilock_trace(i,n,f,ra)
 -#endif
 -
 -typedef struct dm_attrs_s {
 -      __uint32_t      da_dmevmask;    /* DMIG event mask */
 -      __uint16_t      da_dmstate;     /* DMIG state info */
 -      __uint16_t      da_pad;         /* DMIG extra padding */
 -} dm_attrs_t;
 +struct xfs_imap {
 +      xfs_daddr_t     im_blkno;       /* starting BB of inode chunk */
 +      ushort          im_len;         /* length in BBs of inode chunk */
 +      ushort          im_boffset;     /* inode offset in block in bytes */
 +};
  
  /*
   * This is the xfs in-core inode structure.
@@@ -121,7 -160,7 +121,7 @@@ typedef struct xfs_ictimestamp 
  } xfs_ictimestamp_t;
  
  /*
 - * NOTE:  This structure must be kept identical to struct xfs_dinode_core
 + * NOTE:  This structure must be kept identical to struct xfs_dinode
   *      in xfs_dinode.h except for the endianess annotations.
   */
  typedef struct xfs_icdinode {
        __uint32_t      di_gen;         /* generation number */
  } xfs_icdinode_t;
  
 -typedef struct {
 -      struct xfs_inode        *ip_mnext;      /* next inode in mount list */
 -      struct xfs_inode        *ip_mprev;      /* ptr to prev inode */
 -      struct xfs_mount        *ip_mount;      /* fs mount struct ptr */
 -} xfs_iptr_t;
 +/*
 + * Flags for xfs_ichgtime().
 + */
 +#define       XFS_ICHGTIME_MOD        0x1     /* data fork modification timestamp */
 +#define       XFS_ICHGTIME_CHG        0x2     /* inode field change timestamp */
 +
 +/*
 + * Per-fork incore inode flags.
 + */
 +#define       XFS_IFINLINE    0x01    /* Inline data is read in */
 +#define       XFS_IFEXTENTS   0x02    /* All extent pointers are read in */
 +#define       XFS_IFBROOT     0x04    /* i_broot points to the bmap b-tree root */
 +#define       XFS_IFEXTIREC   0x08    /* Indirection array of extent blocks */
 +
 +/*
 + * Fork handling.
 + */
 +
 +#define XFS_IFORK_Q(ip)                       ((ip)->i_d.di_forkoff != 0)
 +#define XFS_IFORK_BOFF(ip)            ((int)((ip)->i_d.di_forkoff << 3))
 +
 +#define XFS_IFORK_PTR(ip,w)           \
 +      ((w) == XFS_DATA_FORK ? \
 +              &(ip)->i_df : \
 +              (ip)->i_afp)
 +#define XFS_IFORK_DSIZE(ip) \
 +      (XFS_IFORK_Q(ip) ? \
 +              XFS_IFORK_BOFF(ip) : \
 +              XFS_LITINO((ip)->i_mount))
 +#define XFS_IFORK_ASIZE(ip) \
 +      (XFS_IFORK_Q(ip) ? \
 +              XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \
 +              0)
 +#define XFS_IFORK_SIZE(ip,w) \
 +      ((w) == XFS_DATA_FORK ? \
 +              XFS_IFORK_DSIZE(ip) : \
 +              XFS_IFORK_ASIZE(ip))
 +#define XFS_IFORK_FORMAT(ip,w) \
 +      ((w) == XFS_DATA_FORK ? \
 +              (ip)->i_d.di_format : \
 +              (ip)->i_d.di_aformat)
 +#define XFS_IFORK_FMT_SET(ip,w,n) \
 +      ((w) == XFS_DATA_FORK ? \
 +              ((ip)->i_d.di_format = (n)) : \
 +              ((ip)->i_d.di_aformat = (n)))
 +#define XFS_IFORK_NEXTENTS(ip,w) \
 +      ((w) == XFS_DATA_FORK ? \
 +              (ip)->i_d.di_nextents : \
 +              (ip)->i_d.di_anextents)
 +#define XFS_IFORK_NEXT_SET(ip,w,n) \
 +      ((w) == XFS_DATA_FORK ? \
 +              ((ip)->i_d.di_nextents = (n)) : \
 +              ((ip)->i_d.di_anextents = (n)))
 +
 +
 +
 +#ifdef __KERNEL__
 +
 +struct bhv_desc;
 +struct cred;
 +struct ktrace;
 +struct xfs_buf;
 +struct xfs_bmap_free;
 +struct xfs_bmbt_irec;
 +struct xfs_inode_log_item;
 +struct xfs_mount;
 +struct xfs_trans;
 +struct xfs_dquot;
 +
 +#if defined(XFS_ILOCK_TRACE)
 +#define XFS_ILOCK_KTRACE_SIZE 32
 +extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
 +#else
 +#define       xfs_ilock_trace(i,n,f,ra)
 +#endif
 +
 +typedef struct dm_attrs_s {
 +      __uint32_t      da_dmevmask;    /* DMIG event mask */
 +      __uint16_t      da_dmstate;     /* DMIG state info */
 +      __uint16_t      da_pad;         /* DMIG extra padding */
 +} dm_attrs_t;
  
  typedef struct xfs_inode {
        /* Inode linking and identification information. */
 -      struct xfs_inode        *i_mnext;       /* next inode in mount list */
 -      struct xfs_inode        *i_mprev;       /* ptr to prev inode */
        struct xfs_mount        *i_mount;       /* fs mount struct ptr */
 -      struct list_head        i_reclaim;      /* reclaim list */
 -      struct inode            *i_vnode;       /* vnode backpointer */
        struct xfs_dquot        *i_udquot;      /* user dquot */
        struct xfs_dquot        *i_gdquot;      /* group dquot */
  
        /* Inode location stuff */
        xfs_ino_t               i_ino;          /* inode number (agno/agino)*/
 -      xfs_daddr_t             i_blkno;        /* blkno of inode buffer */
 -      ushort                  i_len;          /* len of inode buffer */
 -      ushort                  i_boffset;      /* off of inode in buffer */
 +      struct xfs_imap         i_imap;         /* location for xfs_imap() */
  
        /* Extent information. */
        xfs_ifork_t             *i_afp;         /* attribute fork pointer */
        unsigned short          i_flags;        /* see defined flags below */
        unsigned char           i_update_core;  /* timestamps/size is dirty */
        unsigned char           i_update_size;  /* di_size field is dirty */
 -      unsigned int            i_gen;          /* generation count */
        unsigned int            i_delayed_blks; /* count of delay alloc blks */
  
        xfs_icdinode_t          i_d;            /* most of ondisk inode */
        xfs_fsize_t             i_size;         /* in-memory size */
        xfs_fsize_t             i_new_size;     /* size when write completes */
        atomic_t                i_iocount;      /* outstanding I/O count */
 +
 +      /* VFS inode */
 +      struct inode            i_vnode;        /* embedded VFS inode */
 +
        /* Trace buffers per inode. */
  #ifdef XFS_INODE_TRACE
        struct ktrace           *i_trace;       /* general inode trace */
  #ifdef XFS_BMAP_TRACE
        struct ktrace           *i_xtrace;      /* inode extent list trace */
  #endif
 -#ifdef XFS_BMBT_TRACE
 +#ifdef XFS_BTREE_TRACE
        struct ktrace           *i_btrace;      /* inode bmap btree trace */
  #endif
  #ifdef XFS_RW_TRACE
  /* Convert from vfs inode to xfs inode */
  static inline struct xfs_inode *XFS_I(struct inode *inode)
  {
 -      return (struct xfs_inode *)inode->i_private;
 +      return container_of(inode, struct xfs_inode, i_vnode);
  }
  
  /* convert from xfs inode to vfs inode */
  static inline struct inode *VFS_I(struct xfs_inode *ip)
  {
 -      return (struct inode *)ip->i_vnode;
 +      return &ip->i_vnode;
 +}
 +
 +/*
 + * Get rid of a partially initialized inode.
 + *
 + * We have to go through destroy_inode to make sure allocations
 + * from init_inode_always like the security data are undone.
 + *
 + * We mark the inode bad so that it takes the short cut in
 + * the reclaim path instead of going through the flush path
 + * which doesn't make sense for an inode that has never seen the
 + * light of day.
 + */
 +static inline void xfs_destroy_inode(struct xfs_inode *ip)
 +{
 +      make_bad_inode(VFS_I(ip));
 +      return destroy_inode(VFS_I(ip));
  }
  
  /*
@@@ -378,36 -327,65 +378,36 @@@ xfs_iflags_test_and_clear(xfs_inode_t *
        spin_unlock(&ip->i_flags_lock);
        return ret;
  }
 -#endif        /* __KERNEL__ */
 -
  
  /*
 - * Fork handling.
 + * Manage the i_flush queue embedded in the inode.  This completion
 + * queue synchronizes processes attempting to flush the in-core
 + * inode back to disk.
   */
 +static inline void xfs_iflock(xfs_inode_t *ip)
 +{
 +      wait_for_completion(&ip->i_flush);
 +}
  
 -#define XFS_IFORK_Q(ip)                       ((ip)->i_d.di_forkoff != 0)
 -#define XFS_IFORK_BOFF(ip)            ((int)((ip)->i_d.di_forkoff << 3))
 -
 -#define XFS_IFORK_PTR(ip,w)           \
 -      ((w) == XFS_DATA_FORK ? \
 -              &(ip)->i_df : \
 -              (ip)->i_afp)
 -#define XFS_IFORK_DSIZE(ip) \
 -      (XFS_IFORK_Q(ip) ? \
 -              XFS_IFORK_BOFF(ip) : \
 -              XFS_LITINO((ip)->i_mount))
 -#define XFS_IFORK_ASIZE(ip) \
 -      (XFS_IFORK_Q(ip) ? \
 -              XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \
 -              0)
 -#define XFS_IFORK_SIZE(ip,w) \
 -      ((w) == XFS_DATA_FORK ? \
 -              XFS_IFORK_DSIZE(ip) : \
 -              XFS_IFORK_ASIZE(ip))
 -#define XFS_IFORK_FORMAT(ip,w) \
 -      ((w) == XFS_DATA_FORK ? \
 -              (ip)->i_d.di_format : \
 -              (ip)->i_d.di_aformat)
 -#define XFS_IFORK_FMT_SET(ip,w,n) \
 -      ((w) == XFS_DATA_FORK ? \
 -              ((ip)->i_d.di_format = (n)) : \
 -              ((ip)->i_d.di_aformat = (n)))
 -#define XFS_IFORK_NEXTENTS(ip,w) \
 -      ((w) == XFS_DATA_FORK ? \
 -              (ip)->i_d.di_nextents : \
 -              (ip)->i_d.di_anextents)
 -#define XFS_IFORK_NEXT_SET(ip,w,n) \
 -      ((w) == XFS_DATA_FORK ? \
 -              ((ip)->i_d.di_nextents = (n)) : \
 -              ((ip)->i_d.di_anextents = (n)))
 +static inline int xfs_iflock_nowait(xfs_inode_t *ip)
 +{
 +      return try_wait_for_completion(&ip->i_flush);
 +}
  
 -#ifdef __KERNEL__
 +static inline void xfs_ifunlock(xfs_inode_t *ip)
 +{
 +      complete(&ip->i_flush);
 +}
  
  /*
   * In-core inode flags.
   */
 -#define XFS_IGRIO     0x0001  /* inode used for guaranteed rate i/o */
 -#define XFS_IUIOSZ    0x0002  /* inode i/o sizes have been explicitly set */
 -#define XFS_IQUIESCE    0x0004  /* we have started quiescing for this inode */
 -#define XFS_IRECLAIM    0x0008  /* we have started reclaiming this inode    */
 -#define XFS_ISTALE    0x0010  /* inode has been staled */
 -#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */
 -#define XFS_INEW      0x0040
 -#define XFS_IFILESTREAM       0x0080  /* inode is in a filestream directory */
 -#define XFS_IMODIFIED 0x0100  /* XFS inode state possibly differs */
 -                              /* to the Linux inode state. */
 -#define XFS_ITRUNCATED        0x0200  /* truncated down so flush-on-close */
 +#define XFS_IRECLAIM    0x0001  /* we have started reclaiming this inode    */
 +#define XFS_ISTALE    0x0002  /* inode has been staled */
 +#define XFS_IRECLAIMABLE 0x0004 /* inode can be reclaimed */
 +#define XFS_INEW      0x0008  /* inode has just been allocated */
 +#define XFS_IFILESTREAM       0x0010  /* inode is in a filestream directory */
 +#define XFS_ITRUNCATED        0x0020  /* truncated down so flush-on-close */
  
  /*
   * Flags for inode locking.
        (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \
         ((pip)->i_d.di_mode & S_ISGID))
  
 -/*
 - * Flags for xfs_iget()
 - */
 -#define XFS_IGET_CREATE               0x1
 -#define XFS_IGET_BULKSTAT     0x2
 -
  /*
   * xfs_iget.c prototypes.
   */
 -void          xfs_ihash_init(struct xfs_mount *);
 -void          xfs_ihash_free(struct xfs_mount *);
  xfs_inode_t   *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
                                  struct xfs_trans *);
  int           xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
@@@ -498,13 -484,25 +498,13 @@@ int             xfs_isilocked(xfs_inode_t *, uint)
  uint          xfs_ilock_map_shared(xfs_inode_t *);
  void          xfs_iunlock_map_shared(xfs_inode_t *, uint);
  void          xfs_ireclaim(xfs_inode_t *);
 -int           xfs_finish_reclaim(xfs_inode_t *, int, int);
 -int           xfs_finish_reclaim_all(struct xfs_mount *, int);
  
  /*
   * xfs_inode.c prototypes.
   */
 -int           xfs_itobp(struct xfs_mount *, struct xfs_trans *,
 -                        xfs_inode_t *, struct xfs_dinode **, struct xfs_buf **,
 -                        xfs_daddr_t, uint, uint);
 -int           xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
 -                        xfs_inode_t **, xfs_daddr_t, uint);
 -int           xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
  int           xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
-                          xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
+                          xfs_nlink_t, xfs_dev_t, cred_t *, xfs_prid_t,
                           int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
 -void          xfs_dinode_from_disk(struct xfs_icdinode *,
 -                                   struct xfs_dinode_core *);
 -void          xfs_dinode_to_disk(struct xfs_dinode_core *,
 -                                 struct xfs_icdinode *);
  
  uint          xfs_ip2xflags(struct xfs_inode *);
  uint          xfs_dic2xflags(struct xfs_dinode *);
@@@ -515,10 -513,17 +515,10 @@@ int             xfs_itruncate_finish(struct xfs_tr
                                     xfs_fsize_t, int, int);
  int           xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
  
 -void          xfs_idestroy_fork(xfs_inode_t *, int);
 -void          xfs_idestroy(xfs_inode_t *);
 -void          xfs_idata_realloc(xfs_inode_t *, int, int);
 -void          xfs_iextract(xfs_inode_t *);
  void          xfs_iext_realloc(xfs_inode_t *, int, int);
 -void          xfs_iroot_realloc(xfs_inode_t *, int, int);
  void          xfs_ipin(xfs_inode_t *);
  void          xfs_iunpin(xfs_inode_t *);
 -int           xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
  int           xfs_iflush(xfs_inode_t *, uint);
 -void          xfs_iflush_all(struct xfs_mount *);
  void          xfs_ichgtime(xfs_inode_t *, int);
  xfs_fsize_t   xfs_file_last_byte(xfs_inode_t *);
  void          xfs_lock_inodes(xfs_inode_t **, int, uint);
@@@ -527,77 -532,6 +527,77 @@@ void             xfs_lock_two_inodes(xfs_inode_t *
  void          xfs_synchronize_atime(xfs_inode_t *);
  void          xfs_mark_inode_dirty_sync(xfs_inode_t *);
  
 +#if defined(XFS_INODE_TRACE)
 +
 +#define       INODE_TRACE_SIZE        16              /* number of trace entries */
 +#define       INODE_KTRACE_ENTRY      1
 +#define       INODE_KTRACE_EXIT       2
 +#define       INODE_KTRACE_HOLD       3
 +#define       INODE_KTRACE_REF        4
 +#define       INODE_KTRACE_RELE       5
 +
 +extern void _xfs_itrace_entry(struct xfs_inode *, const char *, inst_t *);
 +extern void _xfs_itrace_exit(struct xfs_inode *, const char *, inst_t *);
 +extern void xfs_itrace_hold(struct xfs_inode *, char *, int, inst_t *);
 +extern void _xfs_itrace_ref(struct xfs_inode *, char *, int, inst_t *);
 +extern void xfs_itrace_rele(struct xfs_inode *, char *, int, inst_t *);
 +#define xfs_itrace_entry(ip)  \
 +      _xfs_itrace_entry(ip, __func__, (inst_t *)__return_address)
 +#define xfs_itrace_exit(ip)   \
 +      _xfs_itrace_exit(ip, __func__, (inst_t *)__return_address)
 +#define xfs_itrace_exit_tag(ip, tag)  \
 +      _xfs_itrace_exit(ip, tag, (inst_t *)__return_address)
 +#define xfs_itrace_ref(ip)    \
 +      _xfs_itrace_ref(ip, __FILE__, __LINE__, (inst_t *)__return_address)
 +
 +#else
 +#define       xfs_itrace_entry(a)
 +#define       xfs_itrace_exit(a)
 +#define       xfs_itrace_exit_tag(a, b)
 +#define       xfs_itrace_hold(a, b, c, d)
 +#define       xfs_itrace_ref(a)
 +#define       xfs_itrace_rele(a, b, c, d)
 +#endif
 +
 +#define IHOLD(ip) \
 +do { \
 +      ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
 +      atomic_inc(&(VFS_I(ip)->i_count)); \
 +      xfs_itrace_hold((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
 +} while (0)
 +
 +#define IRELE(ip) \
 +do { \
 +      xfs_itrace_rele((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
 +      iput(VFS_I(ip)); \
 +} while (0)
 +
 +#endif /* __KERNEL__ */
 +
 +/*
 + * Flags for xfs_iget()
 + */
 +#define XFS_IGET_CREATE               0x1
 +#define XFS_IGET_BULKSTAT     0x2
 +
 +int           xfs_inotobp(struct xfs_mount *, struct xfs_trans *,
 +                          xfs_ino_t, struct xfs_dinode **,
 +                          struct xfs_buf **, int *, uint);
 +int           xfs_itobp(struct xfs_mount *, struct xfs_trans *,
 +                        struct xfs_inode *, struct xfs_dinode **,
 +                        struct xfs_buf **, uint);
 +int           xfs_iread(struct xfs_mount *, struct xfs_trans *,
 +                        struct xfs_inode *, xfs_daddr_t, uint);
 +void          xfs_dinode_from_disk(struct xfs_icdinode *,
 +                                   struct xfs_dinode *);
 +void          xfs_dinode_to_disk(struct xfs_dinode *,
 +                                 struct xfs_icdinode *);
 +void          xfs_idestroy_fork(struct xfs_inode *, int);
 +void          xfs_idata_realloc(struct xfs_inode *, int, int);
 +void          xfs_iroot_realloc(struct xfs_inode *, int, int);
 +int           xfs_iread_extents(struct xfs_trans *, struct xfs_inode *, int);
 +int           xfs_iextents_copy(struct xfs_inode *, xfs_bmbt_rec_t *, int);
 +
  xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
  void          xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
                                xfs_bmbt_irec_t *);
@@@ -627,8 -561,7 +627,8 @@@ void               xfs_iext_irec_update_extoffs(xfs_
  #define xfs_ipincount(ip)     ((unsigned int) atomic_read(&ip->i_pincount))
  
  #ifdef DEBUG
 -void          xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t);
 +void          xfs_isize_check(struct xfs_mount *, struct xfs_inode *,
 +                              xfs_fsize_t);
  #else /* DEBUG */
  #define xfs_isize_check(mp, ip, isize)
  #endif        /* DEBUG */
@@@ -643,4 -576,26 +643,4 @@@ extern struct kmem_zone   *xfs_ifork_zone
  extern struct kmem_zone       *xfs_inode_zone;
  extern struct kmem_zone       *xfs_ili_zone;
  
 -/*
 - * Manage the i_flush queue embedded in the inode.  This completion
 - * queue synchronizes processes attempting to flush the in-core
 - * inode back to disk.
 - */
 -static inline void xfs_iflock(xfs_inode_t *ip)
 -{
 -      wait_for_completion(&ip->i_flush);
 -}
 -
 -static inline int xfs_iflock_nowait(xfs_inode_t *ip)
 -{
 -      return try_wait_for_completion(&ip->i_flush);
 -}
 -
 -static inline void xfs_ifunlock(xfs_inode_t *ip)
 -{
 -      complete(&ip->i_flush);
 -}
 -
 -#endif        /* __KERNEL__ */
 -
  #endif        /* __XFS_INODE_H__ */
diff --combined fs/xfs/xfs_vnodeops.h
index 55d955ec4ecea071033ab8b2c23070c23c38dc5c,7b0c2ab88333885b5f9075b1b99c2d14b71b4578..76df328c61b42c16641ed4e7a8a18021efba7253
@@@ -14,7 -14,9 +14,7 @@@ struct xfs_inode
  struct xfs_iomap;
  
  
 -int xfs_open(struct xfs_inode *ip);
 -int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags,
 -              cred_t *credp);
 +int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags);
  #define       XFS_ATTR_DMI            0x01    /* invocation from a DMI function */
  #define       XFS_ATTR_NONBLOCK       0x02    /* return EAGAIN if operation would block */
  #define XFS_ATTR_NOLOCK               0x04    /* Don't grab any conflicting locks */
@@@ -26,23 -28,24 +26,23 @@@ int xfs_inactive(struct xfs_inode *ip)
  int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
                struct xfs_inode **ipp, struct xfs_name *ci_name);
  int xfs_create(struct xfs_inode *dp, struct xfs_name *name, mode_t mode,
-               xfs_dev_t rdev, struct xfs_inode **ipp, struct cred *credp);
+               xfs_dev_t rdev, struct xfs_inode **ipp, cred_t *credp);
  int xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
                struct xfs_inode *ip);
  int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
                struct xfs_name *target_name);
  int xfs_mkdir(struct xfs_inode *dp, struct xfs_name *dir_name,
-               mode_t mode, struct xfs_inode **ipp, struct cred *credp);
+               mode_t mode, struct xfs_inode **ipp, cred_t *credp);
  int xfs_readdir(struct xfs_inode      *dp, void *dirent, size_t bufsize,
                       xfs_off_t *offset, filldir_t filldir);
  int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
                const char *target_path, mode_t mode, struct xfs_inode **ipp,
-               struct cred *credp);
+               cred_t *credp);
  int xfs_inode_flush(struct xfs_inode *ip, int flags);
  int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state);
  int xfs_reclaim(struct xfs_inode *ip);
  int xfs_change_file_space(struct xfs_inode *ip, int cmd,
 -              xfs_flock64_t *bf, xfs_off_t offset,
 -              cred_t *credp, int      attr_flags);
 +              xfs_flock64_t *bf, xfs_off_t offset, int attr_flags);
  int xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name,
                struct xfs_inode *src_ip, struct xfs_inode *target_dp,
                struct xfs_name *target_name, struct xfs_inode *target_ip);
@@@ -53,6 -56,8 +53,6 @@@ int xfs_attr_set(struct xfs_inode *dp, 
  int xfs_attr_remove(struct xfs_inode *dp, const char *name, int flags);
  int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
                int flags, struct attrlist_cursor_kern *cursor);
 -int xfs_ioctl(struct xfs_inode *ip, struct file *filp,
 -              int ioflags, unsigned int cmd, void __user *arg);
  ssize_t xfs_read(struct xfs_inode *ip, struct kiocb *iocb,
                const struct iovec *iovp, unsigned int segs,
                loff_t *offset, int ioflags);
@@@ -73,6 -78,5 +73,6 @@@ int xfs_flushinval_pages(struct xfs_ino
                xfs_off_t last, int fiopt);
  int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
                xfs_off_t last, uint64_t flags, int fiopt);
 +int xfs_wait_on_pages(struct xfs_inode *ip, xfs_off_t first, xfs_off_t last);
  
  #endif /* _XFS_VNODEOPS_H */
diff --combined include/linux/fs.h
index 1ba7630e329c625f401820029704afa372e8c9dc,195a8cb2a749912bc0e8d930b489a8552e3a8121..001ded4845b4b9d4e1a5105fbbb1682d7961efca
@@@ -82,14 -82,6 +82,14 @@@ extern int dir_notify_enable
     (specialy hack for floppy.c) */
  #define FMODE_WRITE_IOCTL     ((__force fmode_t)128)
  
 +/*
 + * Don't update ctime and mtime.
 + *
 + * Currently a special hack for the XFS open_by_handle ioctl, but we'll
 + * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
 + */
 +#define FMODE_NOCMTIME                ((__force fmode_t)2048)
 +
  #define RW_MASK               1
  #define RWA_MASK      2
  #define READ 0
@@@ -324,6 -316,7 +324,7 @@@ struct poll_table_struct
  struct kstatfs;
  struct vm_area_struct;
  struct vfsmount;
+ struct cred;
  
  extern void __init inode_init(void);
  extern void __init inode_init_early(void);
@@@ -835,7 -828,7 +836,7 @@@ struct file 
        fmode_t                 f_mode;
        loff_t                  f_pos;
        struct fown_struct      f_owner;
-       unsigned int            f_uid, f_gid;
+       const struct cred       *f_cred;
        struct file_ra_state    f_ra;
  
        u64                     f_version;
@@@ -1202,7 -1195,7 +1203,7 @@@ enum 
  #define has_fs_excl() atomic_read(&current->fs_excl)
  
  #define is_owner_or_cap(inode)        \
-       ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
+       ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER))
  
  /* not quite ready to be deprecated, but... */
  extern void lock_super(struct super_block *);
@@@ -1682,7 -1675,8 +1683,8 @@@ extern int do_truncate(struct dentry *
  extern long do_sys_open(int dfd, const char __user *filename, int flags,
                        int mode);
  extern struct file *filp_open(const char *, int, int);
- extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
+ extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
+                                const struct cred *);
  extern int filp_close(struct file *, fl_owner_t id);
  extern char * getname(const char __user *);
  
@@@ -1883,9 -1877,7 +1885,9 @@@ extern loff_t default_llseek(struct fil
  
  extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
  
 +extern struct inode * inode_init_always(struct super_block *, struct inode *);
  extern void inode_init_once(struct inode *);
 +extern void inode_add_to_lists(struct super_block *, struct inode *);
  extern void iput(struct inode *);
  extern struct inode * igrab(struct inode *);
  extern ino_t iunique(struct super_block *, ino_t);