X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fxfs%2Fxfs_iget.c;fp=fs%2Fxfs%2Fxfs_iget.c;h=8e380a1fb79b691f03efa0e0aa126ce9c0e78727;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=b905e538f72ec356ca6749d148f685fd874bc5b2;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index b905e538f..8e380a1fb 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c @@ -24,12 +24,14 @@ #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" +#include "xfs_dir.h" #include "xfs_dir2.h" #include "xfs_dmapi.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h" #include "xfs_alloc_btree.h" #include "xfs_ialloc_btree.h" +#include "xfs_dir_sf.h" #include "xfs_dir2_sf.h" #include "xfs_attr_sf.h" #include "xfs_dinode.h" @@ -184,7 +186,7 @@ xfs_ihash_promote( */ STATIC int xfs_iget_core( - bhv_vnode_t *vp, + vnode_t *vp, xfs_mount_t *mp, xfs_trans_t *tp, xfs_ino_t ino, @@ -196,7 +198,7 @@ xfs_iget_core( xfs_ihash_t *ih; xfs_inode_t *ip; xfs_inode_t *iq; - bhv_vnode_t *inode_vp; + vnode_t *inode_vp; ulong version; int error; /* REFERENCED */ @@ -256,7 +258,7 @@ again: goto finish_inode; } else if (vp != inode_vp) { - struct inode *inode = vn_to_inode(inode_vp); + struct inode *inode = LINVFS_GET_IP(inode_vp); /* The inode is being torn down, pause and * try again. @@ -419,10 +421,7 @@ finish_inode: ip->i_chash = chlnew; chlnew->chl_ip = ip; chlnew->chl_blkno = ip->i_blkno; - if (ch->ch_list) - ch->ch_list->chl_prev = chlnew; chlnew->chl_next = ch->ch_list; - chlnew->chl_prev = NULL; ch->ch_list = chlnew; chlnew = NULL; } @@ -466,7 +465,7 @@ finish_inode: * If we have a real type for an on-disk inode, we can set ops(&unlock) * now. If it's a new inode being created, xfs_ialloc will handle it. */ - bhv_vfs_init_vnode(XFS_MTOVFS(mp), vp, XFS_ITOBHV(ip), 1); + VFS_INIT_VNODE(XFS_MTOVFS(mp), vp, XFS_ITOBHV(ip), 1); return 0; } @@ -487,7 +486,7 @@ xfs_iget( xfs_daddr_t bno) { struct inode *inode; - bhv_vnode_t *vp = NULL; + vnode_t *vp = NULL; int error; XFS_STATS_INC(xs_ig_attempts); @@ -496,7 +495,7 @@ retry: if ((inode = iget_locked(XFS_MTOVFS(mp)->vfs_super, ino))) { xfs_inode_t *ip; - vp = vn_from_inode(inode); + vp = LINVFS_GET_VP(inode); if (inode->i_state & I_NEW) { vn_initialize(inode); error = xfs_iget_core(vp, mp, tp, ino, flags, @@ -510,7 +509,7 @@ retry: } else { /* * If the inode is not fully constructed due to - * filehandle mismatches wait for the inode to go + * filehandle mistmatches wait for the inode to go * away and try again. * * iget_locked will call __wait_on_freeing_inode @@ -541,7 +540,7 @@ retry: void xfs_inode_lock_init( xfs_inode_t *ip, - bhv_vnode_t *vp) + vnode_t *vp) { mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, "xfsino", (long)vp->v_number); @@ -601,10 +600,12 @@ void xfs_iput(xfs_inode_t *ip, uint lock_flags) { - bhv_vnode_t *vp = XFS_ITOV(ip); + vnode_t *vp = XFS_ITOV(ip); vn_trace_entry(vp, "xfs_iput", (inst_t *)__return_address); + xfs_iunlock(ip, lock_flags); + VN_RELE(vp); } @@ -615,8 +616,8 @@ void xfs_iput_new(xfs_inode_t *ip, uint lock_flags) { - bhv_vnode_t *vp = XFS_ITOV(ip); - struct inode *inode = vn_to_inode(vp); + vnode_t *vp = XFS_ITOV(ip); + struct inode *inode = LINVFS_GET_IP(vp); vn_trace_entry(vp, "xfs_iput_new", (inst_t *)__return_address); @@ -641,7 +642,7 @@ xfs_iput_new(xfs_inode_t *ip, void xfs_ireclaim(xfs_inode_t *ip) { - bhv_vnode_t *vp; + vnode_t *vp; /* * Remove from old hash list and mount list. @@ -676,8 +677,6 @@ xfs_ireclaim(xfs_inode_t *ip) vn_bhv_remove(VN_BHV_HEAD(vp), XFS_ITOBHV(ip)); } - xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); - /* * Free all memory associated with the inode. */ @@ -724,15 +723,23 @@ xfs_iextract( ASSERT(ip->i_cnext == ip && ip->i_cprev == ip); ASSERT(ip->i_chash != NULL); chm=NULL; - chl = ip->i_chash; - if (chl->chl_prev) - chl->chl_prev->chl_next = chl->chl_next; - else - ch->ch_list = chl->chl_next; - if (chl->chl_next) - chl->chl_next->chl_prev = chl->chl_prev; - kmem_zone_free(xfs_chashlist_zone, chl); - } else { + for (chl = ch->ch_list; chl != NULL; chl = chl->chl_next) { + if (chl->chl_blkno == ip->i_blkno) { + if (chm == NULL) { + /* first item on the list */ + ch->ch_list = chl->chl_next; + } else { + chm->chl_next = chl->chl_next; + } + kmem_zone_free(xfs_chashlist_zone, chl); + break; + } else { + ASSERT(chl->chl_ip != ip); + chm = chl; + } + } + ASSERT_ALWAYS(chl != NULL); + } else { /* delete one inode from a non-empty list */ iq = ip->i_cnext; iq->i_cprev = ip->i_cprev; @@ -1031,6 +1038,6 @@ xfs_iflock_nowait(xfs_inode_t *ip) void xfs_ifunlock(xfs_inode_t *ip) { - ASSERT(issemalocked(&(ip->i_flock))); + ASSERT(valusema(&(ip->i_flock)) <= 0); vsema(&(ip->i_flock)); }