From: NeilBrown Date: Mon, 7 Mar 2011 05:58:53 +0000 (+1100) Subject: Replace lots of ino_from_sb uses. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=3e0388df7485276e6739362a141189796de6de84;p=LaFS.git Replace lots of ino_from_sb uses. Most of these can now simply dereference ->filesys. Signed-off-by: NeilBrown --- diff --git a/clean.c b/clean.c index 8a608be..b5b026f 100644 --- a/clean.c +++ b/clean.c @@ -299,7 +299,7 @@ static void cleaner_parse(struct fs *fs, struct toclean *tc) if (ino == NULL || ino->i_ino != inum || - ino_from_sb(ino->i_sb)->i_ino != fsnum) { + LAFSI(ino)->filesys->i_ino != fsnum) { if (ino) lafs_iput_fs(ino); if (fsnum) { diff --git a/cluster.c b/cluster.c index 39dd928..7ab4043 100644 --- a/cluster.c +++ b/cluster.c @@ -68,8 +68,8 @@ static int cmp_blk(struct block *a, struct block *b) */ if (a->inode != b->inode) { - struct inode *fsinoa = ino_from_sb(a->inode->i_sb); - struct inode *fsinob = ino_from_sb(b->inode->i_sb); + struct inode *fsinoa = LAFSI(a->inode)->filesys; + struct inode *fsinob = LAFSI(b->inode)->filesys; if (fsinoa->i_ino < fsinob->i_ino) return -3; @@ -874,7 +874,7 @@ static void cluster_addhead(struct wc *wc, struct inode *ino, *headstart = gh; gh->inum = cpu_to_le32(ino->i_ino); - gh->fsnum = cpu_to_le32(ino_from_sb(ino->i_sb)->i_ino); + gh->fsnum = cpu_to_le32(LAFSI(ino)->filesys->i_ino); tnf = ((ino->i_generation<<8) | (LAFSI(ino)->trunc_gen & 0xff)) & 0x7fff; if (wc->cnum) diff --git a/file.c b/file.c index a92f559..ee07bd9 100644 --- a/file.c +++ b/file.c @@ -302,7 +302,7 @@ lafs_writepage(struct page *page, struct writeback_control *wbc) int blocks = PAGE_SIZE >> ino->i_blkbits; int i; int redirty = 0; - dprintk("WRITEPAGE %lu/%lu/%lu\n", ino_from_sb(ino->i_sb)->i_ino, ino->i_ino, page->index * blocks); + dprintk("WRITEPAGE %lu/%lu/%lu\n", LAFSI(ino)->filesys->i_ino, ino->i_ino, page->index * blocks); for (i = 0 ; i < blocks; i++) { struct datablock *b = lafs_get_block(ino, i, page, GFP_KERNEL, MKREF(writepage)); diff --git a/inode.c b/inode.c index e385afe..4e10c22 100644 --- a/inode.c +++ b/inode.c @@ -497,7 +497,7 @@ static void check_atime_ref(struct inode *ino, int async) return; if (test_bit(I_AccessTime, &LAFSI(ino)->iflags)) return; - root = ino_from_sb(ino->i_sb); + root = LAFSI(ino)->filesys; at = LAFSI(root)->md.fs.accesstime; if (at == NULL) return; @@ -625,7 +625,7 @@ static void store_atime_delta(struct inode *ino) return; /* We own a reference, so this lookup must succeed */ - at = LAFSI(ino_from_sb(ino->i_sb))->md.fs.accesstime; + at = LAFSI(LAFSI(ino)->filesys)->md.fs.accesstime; bnum = ino->i_ino >> (at->i_blkbits-1); b = lafs_get_block(at, bnum, NULL, GFP_NOFS, MKREF(store_atime)); BUG_ON(!b); @@ -713,7 +713,7 @@ struct datablock *lafs_inode_dblock(struct inode *ino, int async, REFARG) db = lafs_inode_get_dblock(ino, REF); if (!db) - db = lafs_get_block(ino_from_sb(ino->i_sb), ino->i_ino, NULL, + db = lafs_get_block(LAFSI(ino)->filesys, ino->i_ino, NULL, GFP_KERNEL, REF); if (!db) return ERR_PTR(-ENOMEM); @@ -1313,7 +1313,7 @@ void lafs_dirty_inode(struct inode *ino) } now = current_fs_time(ino->i_sb); - filesys = ino_from_sb(ino->i_sb); + filesys = LAFSI(ino)->filesys; if (!timespec_equal(&filesys->i_mtime, &now)) { filesys->i_mtime = now; set_bit(I_Dirty, &LAFSI(filesys)->iflags); diff --git a/orphan.c b/orphan.c index 8a09b09..f9805d0 100644 --- a/orphan.c +++ b/orphan.c @@ -174,7 +174,7 @@ static void orphan_commit(struct fs *fs, struct datablock *b, struct datablock * lafs_add_orphan(fs, b); dprintk("%p->orphan_slot=%d (%lu,%lu,%lu) %s\n", b, b->orphan_slot, - ino_from_sb(b->b.inode->i_sb)->i_ino, + LAFSI(b->b.inode)->filesys->i_ino, b->b.inode->i_ino, b->b.fileaddr, strblk(&b->b)); om->reserved--; @@ -184,7 +184,7 @@ static void orphan_commit(struct fs *fs, struct datablock *b, struct datablock * ent = b->orphan_slot - (ob->b.fileaddr << (fs->blocksize_bits-4)); or[ent].type = cpu_to_le32(1); - or[ent].filesys = cpu_to_le32(ino_from_sb(b->b.inode->i_sb)->i_ino); + or[ent].filesys = cpu_to_le32(LAFSI(b->b.inode)->filesys->i_ino); or[ent].inum = cpu_to_le32(b->b.inode->i_ino); or[ent].addr = cpu_to_le32(b->b.fileaddr); unmap_dblock(ob, or); diff --git a/summary.c b/summary.c index 1055930..ac811c5 100644 --- a/summary.c +++ b/summary.c @@ -60,7 +60,7 @@ void lafs_summary_update(struct fs *fs, struct inode *ino, spin_unlock(&ino->i_lock); /* per-filesystem */ - lai = LAFSI(ino_from_sb(lai->vfs_inode.i_sb)); + lai = LAFSI(lai->filesys); spin_lock(&lai->vfs_inode.i_lock); if (future) lai->md.fs.pblocks_used += diff; @@ -87,7 +87,7 @@ int lafs_summary_allocate(struct fs *fs, struct inode *ino, int diff) /* this is where quota checks happen */ int err = 0; struct lafs_inode *lai = LAFSI(ino); - lai = LAFSI(ino_from_sb(ino->i_sb)); + lai = LAFSI(LAFSI(ino)->filesys); spin_lock(&lai->vfs_inode.i_lock); if (lai->md.fs.blocks_allowed && diff > 0 && diff --git a/super.c b/super.c index 3137913..e473565 100644 --- a/super.c +++ b/super.c @@ -1385,7 +1385,7 @@ static int lafs_statfs(struct dentry *de, struct kstatfs *buf) u32 fsid; u32 *fsuuid; struct fs *fs = fs_from_inode(de->d_inode); - struct lafs_inode *fsroot = LAFSI(ino_from_sb(de->d_inode->i_sb)); + struct lafs_inode *fsroot = LAFSI(LAFSI(de->d_inode)->filesys); struct lafs_inode *laroot = LAFSI(fs->ss[0].root); fsid = 0;