xfs
[Top] [All Lists]

[PATCH] xfs: remove bhv_lookup

To: nathans@xxxxxxx
Subject: [PATCH] xfs: remove bhv_lookup
From: Christoph Hellwig <hch@xxxxxx>
Date: Mon, 10 Jul 2006 19:05:50 +0200
Cc: xfs@xxxxxxxxxxx
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
There's no point in using bhv_lookup.  The _range version works aswell
in all cases and has much more useful semantics.


Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs-2.6.x/fs/xfs/dmapi/xfs_dm.c
===================================================================
--- xfs-2.6.x.orig/fs/xfs/dmapi/xfs_dm.c        2006-07-09 19:28:18.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/dmapi/xfs_dm.c     2006-07-09 19:30:52.000000000 +0200
@@ -50,10 +50,6 @@
 
 #define MAXNAMLEN MAXNAMELEN
 
-#define XFS_BHV_LOOKUP(vp, xbdp)  \
-       xbdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops); \
-       ASSERT(xbdp);
-
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #define MIN_DIO_SIZE(mp)               ((mp)->m_sb.sb_sectsize)
 #define MAX_DIO_SIZE(mp)               (INT_MAX & ~(MIN_DIO_SIZE(mp) - 1))
@@ -179,7 +175,10 @@
 
        /* Returns positive errors to XFS */
 
-       XFS_BHV_LOOKUP(vp, bdp);
+       bdp = bhv_lookup_range(VN_BHV_HEAD(vp),
+                       VNODE_POSITION_XFS, VNODE_POSITION_XFS);
+       ASSERT(bdp);
+
        ip = xfs_vtoi(vp);
        do {
                dmstate = ip->i_iocore.io_dmstate;
@@ -2378,7 +2377,10 @@
        if (error)
                return -EBUSY;
 
-       XFS_BHV_LOOKUP(vp, xbdp);
+       xbdp = bhv_lookup_range(VN_BHV_HEAD(vp),
+                       VNODE_POSITION_XFS, VNODE_POSITION_XFS);
+       ASSERT(xbdp);
+
        xip = xfs_vtoi(vp);
        mp = xip->i_mount;
        bsize = mp->m_sb.sb_blocksize;
Index: xfs-2.6.x/fs/xfs/linux-2.4/xfs_vnode.h
===================================================================
--- xfs-2.6.x.orig/fs/xfs/linux-2.4/xfs_vnode.h 2006-07-09 19:28:20.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/linux-2.4/xfs_vnode.h      2006-07-09 19:30:52.000000000 
+0200
@@ -83,8 +83,6 @@
 #define VN_BHV_HEAD(vp)                        ((bhv_head_t *)(&((vp)->v_bh)))
 #define vn_bhv_head_init(bhp,name)     bhv_head_init(bhp,name)
 #define vn_bhv_remove(bhp,bdp)         bhv_remove(bhp,bdp)
-#define vn_bhv_lookup(bhp,ops)         bhv_lookup(bhp,ops)
-#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
 
 /*
  * Vnode to Linux inode mapping.
Index: xfs-2.6.x/fs/xfs/linux-2.6/xfs_vnode.h
===================================================================
--- xfs-2.6.x.orig/fs/xfs/linux-2.6/xfs_vnode.h 2006-07-09 19:28:21.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/linux-2.6/xfs_vnode.h      2006-07-09 19:30:52.000000000 
+0200
@@ -85,8 +85,6 @@
 #define VN_BHV_HEAD(vp)                        ((bhv_head_t *)(&((vp)->v_bh)))
 #define vn_bhv_head_init(bhp,name)     bhv_head_init(bhp,name)
 #define vn_bhv_remove(bhp,bdp)         bhv_remove(bhp,bdp)
-#define vn_bhv_lookup(bhp,ops)         bhv_lookup(bhp,ops)
-#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
 
 /*
  * Vnode to Linux inode mapping.
Index: xfs-2.6.x/fs/xfs/xfs_behavior.c
===================================================================
--- xfs-2.6.x.orig/fs/xfs/xfs_behavior.c        2006-07-09 19:28:16.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/xfs_behavior.c     2006-07-09 19:30:52.000000000 +0200
@@ -110,26 +110,6 @@
 }
 
 /*
- * Look for a specific ops vector on the specified behavior chain.
- * Return the associated behavior descriptor.  Or NULL, if not found.
- */
-bhv_desc_t *
-bhv_lookup(bhv_head_t *bhp, void *ops)
-{
-       bhv_desc_t      *curdesc;
-
-       for (curdesc = bhp->bh_first;
-            curdesc != NULL;
-            curdesc = curdesc->bd_next) {
-
-               if (curdesc->bd_ops == ops)
-                       return curdesc;
-       }
-
-       return NULL;
-}
-
-/*
  * Looks for the first behavior within a specified range of positions.
  * Return the associated behavior descriptor.  Or NULL, if none found.
  */
Index: xfs-2.6.x/fs/xfs/xfs_behavior.h
===================================================================
--- xfs-2.6.x.orig/fs/xfs/xfs_behavior.h        2006-07-09 19:28:16.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/xfs_behavior.h     2006-07-09 19:30:52.000000000 +0200
@@ -179,12 +179,10 @@
  * Behavior module prototypes.
  */
 extern void            bhv_remove_not_first(bhv_head_t *bhp, bhv_desc_t *bdp);
-extern bhv_desc_t *    bhv_lookup(bhv_head_t *bhp, void *ops);
 extern bhv_desc_t *    bhv_lookup_range(bhv_head_t *bhp, int low, int high);
 extern bhv_desc_t *    bhv_base(bhv_head_t *bhp);
 
 /* No bhv locking on Linux */
-#define bhv_lookup_unlocked    bhv_lookup
 #define bhv_base_unlocked      bhv_base
 
 #endif /* __XFS_BEHAVIOR_H__ */
Index: xfs-2.6.x/fs/xfs/xfs_mount.h
===================================================================
--- xfs-2.6.x.orig/fs/xfs/xfs_mount.h   2006-07-09 19:28:17.000000000 +0200
+++ xfs-2.6.x/fs/xfs/xfs_mount.h        2006-07-09 19:30:52.000000000 +0200
@@ -541,7 +541,8 @@
 #define XFS_VFSTOM(vfs) xfs_vfstom(vfs)
 static inline xfs_mount_t *xfs_vfstom(bhv_vfs_t *vfs)
 {
-       return XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfs), &xfs_vfsops));
+       return XFS_BHVTOM(bhv_lookup_range(VFS_BHVHEAD(vfs),
+                               VFS_POSITION_XFS, VFS_POSITION_XFS));
 }
 
 #define XFS_DADDR_TO_AGNO(mp,d)         xfs_daddr_to_agno(mp,d)
Index: xfs-2.6.x/fs/xfs/linux-2.4/xfs_ksyms.c
===================================================================
--- xfs-2.6.x.orig/fs/xfs/linux-2.4/xfs_ksyms.c 2006-07-09 19:28:20.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/linux-2.4/xfs_ksyms.c      2006-07-09 19:30:52.000000000 
+0200
@@ -158,7 +158,6 @@
 EXPORT_SYMBOL(bhv_head_destroy);
 EXPORT_SYMBOL(bhv_insert);
 EXPORT_SYMBOL(bhv_insert_initial);
-EXPORT_SYMBOL(bhv_lookup);
 EXPORT_SYMBOL(bhv_lookup_range);
 EXPORT_SYMBOL(bhv_remove_vfsops);
 EXPORT_SYMBOL(bhv_remove_all_vfsops);
Index: xfs-2.6.x/fs/xfs/linux-2.6/xfs_ksyms.c
===================================================================
--- xfs-2.6.x.orig/fs/xfs/linux-2.6/xfs_ksyms.c 2006-07-09 19:28:21.000000000 
+0200
+++ xfs-2.6.x/fs/xfs/linux-2.6/xfs_ksyms.c      2006-07-09 19:30:52.000000000 
+0200
@@ -142,7 +142,6 @@
 EXPORT_SYMBOL(bhv_head_destroy);
 EXPORT_SYMBOL(bhv_insert);
 EXPORT_SYMBOL(bhv_insert_initial);
-EXPORT_SYMBOL(bhv_lookup);
 EXPORT_SYMBOL(bhv_lookup_range);
 EXPORT_SYMBOL(bhv_module_init);
 EXPORT_SYMBOL(bhv_module_exit);


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] xfs: remove bhv_lookup, Christoph Hellwig <=