Commit d31b53e3 authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: Don't save agno in the inode

Resizing the file system can result in an in-memory inode being remapped
to a different aggregate group (AG). A cached AG number can cause
problems when trying to free or allocate inodes. Instead, save the IAG's
agstart address and calculate the agno when we need it.
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
parent 28e0fa89
...@@ -66,9 +66,9 @@ static int jfs_open(struct inode *inode, struct file *file) ...@@ -66,9 +66,9 @@ static int jfs_open(struct inode *inode, struct file *file)
struct jfs_inode_info *ji = JFS_IP(inode); struct jfs_inode_info *ji = JFS_IP(inode);
spin_lock_irq(&ji->ag_lock); spin_lock_irq(&ji->ag_lock);
if (ji->active_ag == -1) { if (ji->active_ag == -1) {
ji->active_ag = ji->agno; struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb);
atomic_inc( ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb);
&JFS_SBI(inode->i_sb)->bmap->db_active[ji->agno]); atomic_inc( &jfs_sb->bmap->db_active[ji->active_ag]);
} }
spin_unlock_irq(&ji->ag_lock); spin_unlock_irq(&ji->ag_lock);
} }
......
...@@ -397,7 +397,7 @@ int diRead(struct inode *ip) ...@@ -397,7 +397,7 @@ int diRead(struct inode *ip)
release_metapage(mp); release_metapage(mp);
/* set the ag for the inode */ /* set the ag for the inode */
JFS_IP(ip)->agno = BLKTOAG(agstart, sbi); JFS_IP(ip)->agstart = agstart;
JFS_IP(ip)->active_ag = -1; JFS_IP(ip)->active_ag = -1;
return (rc); return (rc);
...@@ -901,7 +901,7 @@ int diFree(struct inode *ip) ...@@ -901,7 +901,7 @@ int diFree(struct inode *ip)
/* get the allocation group for this ino. /* get the allocation group for this ino.
*/ */
agno = JFS_IP(ip)->agno; agno = BLKTOAG(JFS_IP(ip)->agstart, JFS_SBI(ip->i_sb));
/* Lock the AG specific inode map information /* Lock the AG specific inode map information
*/ */
...@@ -1315,12 +1315,11 @@ int diFree(struct inode *ip) ...@@ -1315,12 +1315,11 @@ int diFree(struct inode *ip)
static inline void static inline void
diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp) diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp)
{ {
struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
struct jfs_inode_info *jfs_ip = JFS_IP(ip); struct jfs_inode_info *jfs_ip = JFS_IP(ip);
ip->i_ino = (iagno << L2INOSPERIAG) + ino; ip->i_ino = (iagno << L2INOSPERIAG) + ino;
jfs_ip->ixpxd = iagp->inoext[extno]; jfs_ip->ixpxd = iagp->inoext[extno];
jfs_ip->agno = BLKTOAG(le64_to_cpu(iagp->agstart), sbi); jfs_ip->agstart = le64_to_cpu(iagp->agstart);
jfs_ip->active_ag = -1; jfs_ip->active_ag = -1;
} }
...@@ -1379,7 +1378,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip) ...@@ -1379,7 +1378,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
*/ */
/* get the ag number of this iag */ /* get the ag number of this iag */
agno = JFS_IP(pip)->agno; agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb));
if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) { if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) {
/* /*
......
...@@ -50,8 +50,9 @@ struct jfs_inode_info { ...@@ -50,8 +50,9 @@ struct jfs_inode_info {
short btindex; /* btpage entry index*/ short btindex; /* btpage entry index*/
struct inode *ipimap; /* inode map */ struct inode *ipimap; /* inode map */
unsigned long cflag; /* commit flags */ unsigned long cflag; /* commit flags */
long agstart; /* agstart of the containing IAG */
u16 bxflag; /* xflag of pseudo buffer? */ u16 bxflag; /* xflag of pseudo buffer? */
unchar agno; /* ag number */ unchar pad;
signed char active_ag; /* ag currently allocating from */ signed char active_ag; /* ag currently allocating from */
lid_t blid; /* lid of pseudo buffer? */ lid_t blid; /* lid of pseudo buffer? */
lid_t atlhead; /* anonymous tlock list head */ lid_t atlhead; /* anonymous tlock list head */
......
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