Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / xfs / linux-2.6 / xfs_linux.h
index e7da755..39e014c 100644 (file)
@@ -1,33 +1,19 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef __XFS_LINUX__
 #define __XFS_LINUX__
@@ -64,7 +50,6 @@
 #include <sema.h>
 #include <time.h>
 
-#include <support/qsort.h>
 #include <support/ktrace.h>
 #include <support/debug.h>
 #include <support/move.h>
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/proc_fs.h>
-#include <linux/version.h>
 #include <linux/sort.h>
+#include <linux/cpu.h>
+#include <linux/notifier.h>
+#include <linux/delay.h>
 
 #include <asm/page.h>
 #include <asm/div64.h>
 #include <xfs_stats.h>
 #include <xfs_sysctl.h>
 #include <xfs_iops.h>
+#include <xfs_aops.h>
 #include <xfs_super.h>
 #include <xfs_globals.h>
 #include <xfs_fs_subr.h>
  */
 #undef  HAVE_REFCACHE  /* reference cache not needed for NFS in 2.6 */
 #define HAVE_SENDFILE  /* sendfile(2) exists in 2.6, but not in 2.4 */
+#define HAVE_SPLICE    /* a splice(2) exists in 2.6, but not in 2.4 */
+#ifdef CONFIG_SMP
+#define HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */
+#else
+#undef  HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */
+#endif
 
 /*
  * State flag for unwritten extent buffers.
  * delalloc and these ondisk-uninitialised buffers.
  */
 BUFFER_FNS(PrivateStart, unwritten);
-static inline void set_buffer_unwritten_io(struct buffer_head *bh)
-{
-       bh->b_end_io = linvfs_unwritten_done;
-}
 
 #define restricted_chown       xfs_params.restrict_chown.val
 #define irix_sgid_inherit      xfs_params.sgid_inherit.val
@@ -145,14 +135,14 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
 #define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val
 #define xfs_rotorstep          xfs_params.rotorstep.val
 
-#ifndef __smp_processor_id
-#define __smp_processor_id()   smp_processor_id()
+#ifndef raw_smp_processor_id
+#define raw_smp_processor_id() smp_processor_id()
 #endif
-#define current_cpu()          __smp_processor_id()
+#define current_cpu()          raw_smp_processor_id()
 #define current_pid()          (current->pid)
 #define current_fsuid(cred)    (current->fsuid)
 #define current_fsgid(cred)    (current->fsgid)
-#define current_fsxid(cred,vp) (vx_current_fsxid(LINVFS_GET_IP(vp)->i_sb))
+#define current_fsxid(cred,vp) (vx_current_fsxid(vn_to_inode(vp)->i_sb))
 
 #define NBPP           PAGE_SIZE
 #define DPPSHFT                (PAGE_SHIFT - 9)
@@ -198,10 +188,6 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
 /* bytes to clicks */
 #define btoc(x)         (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
 
-#ifndef CELL_CAPABLE
-#define FSC_NOTIFY_NAME_CHANGED(vp)
-#endif
-
 #ifndef ENOATTR
 #define ENOATTR                ENODATA         /* Attribute not found */
 #endif
@@ -231,22 +217,12 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
  * field (see the QCMD macro in quota.h).  These macros help keep the
  * code portable - they are not visible from the syscall interface.
  */
-#define Q_XSETGQLIM    XQM_CMD(0x8)    /* set groups disk limits */
-#define Q_XGETGQUOTA   XQM_CMD(0x9)    /* get groups disk limits */
-
-/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */
-/* we may well need to fine-tune this if it ever becomes an issue.  */
-#define DQUOT_MAX_HEURISTIC    1024    /* NR_DQUOTS */
-#define ndquot                 DQUOT_MAX_HEURISTIC
-
-/* IRIX uses the current size of the name cache to guess a good value */
-/* - this isn't the same but is a good enough starting point for now. */
-#define DQUOT_HASH_HEURISTIC   files_stat.nr_files
-
-/* IRIX inodes maintain the project ID also, zero this field on Linux */
-#define DEFAULT_PROJID 0
-#define dfltprid       DEFAULT_PROJID
+#define Q_XSETGQLIM    XQM_CMD(8)      /* set groups disk limits */
+#define Q_XGETGQUOTA   XQM_CMD(9)      /* get groups disk limits */
+#define Q_XSETPQLIM    XQM_CMD(10)     /* set projects disk limits */
+#define Q_XGETPQUOTA   XQM_CMD(11)     /* get projects disk limits */
 
+#define dfltprid       0
 #define MAXPATHLEN     1024
 
 #define MIN(a,b)       (min(a,b))
@@ -254,10 +230,17 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
 #define howmany(x, y)  (((x)+((y)-1))/(y))
 #define roundup(x, y)  ((((x)+((y)-1))/(y))*(y))
 
+/*
+ * Various platform dependent calls that don't fit anywhere else
+ */
+#define xfs_sort(a,n,s,fn)     sort(a,n,s,fn,NULL)
 #define xfs_stack_trace()      dump_stack()
-
 #define xfs_itruncate_data(ip, off)    \
-       (-vmtruncate(LINVFS_GET_IP(XFS_ITOV(ip)), (off)))
+       (-vmtruncate(vn_to_inode(XFS_ITOV(ip)), (off)))
+#define xfs_statvfs_fsid(statp, mp)    \
+       ({ u64 id = huge_encode_dev((mp)->m_ddev_targp->bt_dev); \
+          __kernel_fsid_t *fsid = &(statp)->f_fsid;    \
+       (fsid->val[0] = (u32)id, fsid->val[1] = (u32)(id >> 32)); })
 
 
 /* Move the kernel do_div definition off to one side */
@@ -370,6 +353,4 @@ static inline __uint64_t roundup_64(__uint64_t x, __uint32_t y)
        return(x * y);
 }
 
-#define qsort(a, n, s, cmp) sort(a, n, s, cmp, NULL)
-
 #endif /* __XFS_LINUX__ */