Commit 407a52fa authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: rework extent invalidation

All callers of invalidate_metapages() actually have a dxd_t or pxd_t to
invalidate, so add invalidate_pxd_metapages() and invalidate_dxd_metapages()
routines with a common __invalidate_metapages() backend instead.

Start to invalidate the EA/ACL extents, we'll need that soon.

Submitted by Christoph Hellwig
parent 5e051f29
...@@ -914,8 +914,6 @@ int diFree(struct inode *ip) ...@@ -914,8 +914,6 @@ int diFree(struct inode *ip)
u32 bitmap, mask; u32 bitmap, mask;
struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap; struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap;
imap_t *imap = JFS_IP(ipimap)->i_imap; imap_t *imap = JFS_IP(ipimap)->i_imap;
s64 xaddr;
s64 xlen;
pxd_t freepxd; pxd_t freepxd;
tid_t tid; tid_t tid;
struct inode *iplist[3]; struct inode *iplist[3];
...@@ -1181,9 +1179,7 @@ int diFree(struct inode *ip) ...@@ -1181,9 +1179,7 @@ int diFree(struct inode *ip)
* invalidate any page of the inode extent freed from buffer cache; * invalidate any page of the inode extent freed from buffer cache;
*/ */
freepxd = iagp->inoext[extno]; freepxd = iagp->inoext[extno];
xaddr = addressPXD(&iagp->inoext[extno]); invalidate_pxd_metapages(JFS_SBI(ip->i_sb)->direct_inode, freepxd);
xlen = lengthPXD(&iagp->inoext[extno]);
invalidate_metapages(JFS_SBI(ip->i_sb)->direct_inode, xaddr, xlen);
/* /*
* update iag list(s) (careful update step 2) * update iag list(s) (careful update step 2)
......
...@@ -557,8 +557,7 @@ void release_metapage(metapage_t * mp) ...@@ -557,8 +557,7 @@ void release_metapage(metapage_t * mp)
jFYI(1, ("release_metapage: done\n")); jFYI(1, ("release_metapage: done\n"));
} }
void invalidate_metapages(struct inode *ip, unsigned long addr, void __invalidate_metapages(struct inode *ip, s64 addr, int len)
unsigned long len)
{ {
metapage_t **hash_ptr; metapage_t **hash_ptr;
unsigned long lblock; unsigned long lblock;
......
...@@ -107,9 +107,13 @@ static inline void discard_metapage(metapage_t *mp) ...@@ -107,9 +107,13 @@ static inline void discard_metapage(metapage_t *mp)
} }
/* /*
* This routine uses hash to explicitly find small number of pages * This routines invalidate all pages for an extent.
*/ */
extern void invalidate_metapages(struct inode *, unsigned long, unsigned long); extern void __invalidate_metapages(struct inode *, s64, int);
#define invalidate_pxd_metapages(ip, pxd) \
__invalidate_metapages((ip), addressPXD(&(pxd)), lengthPXD(&(pxd)))
#define invalidate_dxd_metapages(ip, dxd) \
__invalidate_metapages((ip), addressDXD(&(dxd)), lengthDXD(&(dxd)))
/* /*
* This one uses mp_list to invalidate all pages for an inode * This one uses mp_list to invalidate all pages for an inode
......
...@@ -672,17 +672,13 @@ int freeZeroLink(struct inode *ip) ...@@ -672,17 +672,13 @@ int freeZeroLink(struct inode *ip)
* free EA * free EA
*/ */
if (JFS_IP(ip)->ea.flag & DXD_EXTENT) { if (JFS_IP(ip)->ea.flag & DXD_EXTENT) {
s64 xaddr; s64 xaddr = addressDXD(&JFS_IP(ip)->ea);
int xlen; int xlen = lengthDXD(&JFS_IP(ip)->ea);
maplock_t maplock; /* maplock for COMMIT_WMAP */ maplock_t maplock; /* maplock for COMMIT_WMAP */
pxdlock_t *pxdlock; /* maplock for COMMIT_WMAP */ pxdlock_t *pxdlock; /* maplock for COMMIT_WMAP */
/* free EA pages from cache */ /* free EA pages from cache */
xaddr = addressDXD(&JFS_IP(ip)->ea); invalidate_dxd_metapages(ip, JFS_IP(ip)->ea);
xlen = lengthDXD(&JFS_IP(ip)->ea);
#ifdef _STILL_TO_PORT
bmExtentInvalidate(ip, xaddr, xlen);
#endif
/* free EA extent from working block map */ /* free EA extent from working block map */
maplock.index = 1; maplock.index = 1;
...@@ -697,17 +693,12 @@ int freeZeroLink(struct inode *ip) ...@@ -697,17 +693,12 @@ int freeZeroLink(struct inode *ip)
* free ACL * free ACL
*/ */
if (JFS_IP(ip)->acl.flag & DXD_EXTENT) { if (JFS_IP(ip)->acl.flag & DXD_EXTENT) {
s64 xaddr; s64 xaddr = addressDXD(&JFS_IP(ip)->acl);
int xlen; int xlen = lengthDXD(&JFS_IP(ip)->acl);
maplock_t maplock; /* maplock for COMMIT_WMAP */ maplock_t maplock; /* maplock for COMMIT_WMAP */
pxdlock_t *pxdlock; /* maplock for COMMIT_WMAP */ pxdlock_t *pxdlock; /* maplock for COMMIT_WMAP */
/* free ACL pages from cache */ invalidate_dxd_metapages(ip, JFS_IP(ip)->acl);
xaddr = addressDXD(&JFS_IP(ip)->acl);
xlen = lengthDXD(&JFS_IP(ip)->acl);
#ifdef _STILL_TO_PORT
bmExtentInvalidate(ip, xaddr, xlen);
#endif
/* free ACL extent from working block map */ /* free ACL extent from working block map */
maplock.index = 1; maplock.index = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment