Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ef28f9a authored by Ryusuke Konishi's avatar Ryusuke Konishi
Browse files

nilfs2: get rid of NILFS_I_NILFS



This replaces all references of NILFS_I_NILFS(inode)->ns_bdev with
inode->i_sb->s_bdev and unfolds remaining uses of NILFS_I_NILFS inline
function.

Before 2.6.37, referring to a nilfs object from inodes needed a
conditional judgement, and NILFS_I_NILFS was helpful to simplify it.
But now we can simply do it by going through a super block instance
like inode->i_sb->s_fs_info.

Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
parent 0cc12838
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -34,7 +34,9 @@


struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *bmap)
struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *bmap)
{
{
	return NILFS_I_NILFS(bmap->b_inode)->ns_dat;
	struct the_nilfs *nilfs = bmap->b_inode->i_sb->s_fs_info;

	return nilfs->ns_dat;
}
}


static int nilfs_bmap_convert_error(struct nilfs_bmap *bmap,
static int nilfs_bmap_convert_error(struct nilfs_bmap *bmap,
+5 −4
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
		BUG();
		BUG();
	}
	}
	memset(bh->b_data, 0, 1 << inode->i_blkbits);
	memset(bh->b_data, 0, 1 << inode->i_blkbits);
	bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
	bh->b_bdev = inode->i_sb->s_bdev;
	bh->b_blocknr = blocknr;
	bh->b_blocknr = blocknr;
	set_buffer_mapped(bh);
	set_buffer_mapped(bh);
	set_buffer_uptodate(bh);
	set_buffer_uptodate(bh);
@@ -94,10 +94,11 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
	if (pblocknr == 0) {
	if (pblocknr == 0) {
		pblocknr = blocknr;
		pblocknr = blocknr;
		if (inode->i_ino != NILFS_DAT_INO) {
		if (inode->i_ino != NILFS_DAT_INO) {
			struct inode *dat = NILFS_I_NILFS(inode)->ns_dat;
			struct the_nilfs *nilfs = inode->i_sb->s_fs_info;


			/* blocknr is a virtual block number */
			/* blocknr is a virtual block number */
			err = nilfs_dat_translate(dat, blocknr, &pblocknr);
			err = nilfs_dat_translate(nilfs->ns_dat, blocknr,
						  &pblocknr);
			if (unlikely(err)) {
			if (unlikely(err)) {
				brelse(bh);
				brelse(bh);
				goto out_locked;
				goto out_locked;
@@ -120,7 +121,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
		goto found;
		goto found;
	}
	}
	set_buffer_mapped(bh);
	set_buffer_mapped(bh);
	bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
	bh->b_bdev = inode->i_sb->s_bdev;
	bh->b_blocknr = pblocknr; /* set block address for read */
	bh->b_blocknr = pblocknr; /* set block address for read */
	bh->b_end_io = end_buffer_read_sync;
	bh->b_end_io = end_buffer_read_sync;
	get_bh(bh);
	get_bh(bh);
+4 −4
Original line number Original line Diff line number Diff line
@@ -84,9 +84,9 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
		goto out;
		goto out;


	if (pbn == 0) {
	if (pbn == 0) {
		struct inode *dat_inode = NILFS_I_NILFS(inode)->ns_dat;
		struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
					  /* use original dat, not gc dat. */

		err = nilfs_dat_translate(dat_inode, vbn, &pbn);
		err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
		if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
		if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
			brelse(bh);
			brelse(bh);
			goto failed;
			goto failed;
@@ -100,7 +100,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
	}
	}


	if (!buffer_mapped(bh)) {
	if (!buffer_mapped(bh)) {
		bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
		bh->b_bdev = inode->i_sb->s_bdev;
		set_buffer_mapped(bh);
		set_buffer_mapped(bh);
	}
	}
	bh->b_blocknr = pbn;
	bh->b_blocknr = pbn;
+4 −4
Original line number Original line Diff line number Diff line
@@ -74,14 +74,14 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
		    struct buffer_head *bh_result, int create)
		    struct buffer_head *bh_result, int create)
{
{
	struct nilfs_inode_info *ii = NILFS_I(inode);
	struct nilfs_inode_info *ii = NILFS_I(inode);
	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
	__u64 blknum = 0;
	__u64 blknum = 0;
	int err = 0, ret;
	int err = 0, ret;
	struct inode *dat = NILFS_I_NILFS(inode)->ns_dat;
	unsigned maxblocks = bh_result->b_size >> inode->i_blkbits;
	unsigned maxblocks = bh_result->b_size >> inode->i_blkbits;


	down_read(&NILFS_MDT(dat)->mi_sem);
	down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
	ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks);
	ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks);
	up_read(&NILFS_MDT(dat)->mi_sem);
	up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
	if (ret >= 0) {	/* found */
	if (ret >= 0) {	/* found */
		map_bh(bh_result, inode->i_sb, blknum);
		map_bh(bh_result, inode->i_sb, blknum);
		if (ret > 0)
		if (ret > 0)
@@ -940,7 +940,7 @@ void nilfs_dirty_inode(struct inode *inode)
int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
		 __u64 start, __u64 len)
		 __u64 start, __u64 len)
{
{
	struct the_nilfs *nilfs = NILFS_I_NILFS(inode);
	struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
	__u64 logical = 0, phys = 0, size = 0;
	__u64 logical = 0, phys = 0, size = 0;
	__u32 flags = 0;
	__u32 flags = 0;
	loff_t isize;
	loff_t isize;
+1 −6
Original line number Original line Diff line number Diff line
@@ -64,11 +64,6 @@ static inline struct nilfs_mdt_info *NILFS_MDT(const struct inode *inode)
	return inode->i_private;
	return inode->i_private;
}
}


static inline struct the_nilfs *NILFS_I_NILFS(struct inode *inode)
{
	return inode->i_sb->s_fs_info;
}

/* Default GFP flags using highmem */
/* Default GFP flags using highmem */
#define NILFS_MDT_GFP      (__GFP_WAIT | __GFP_IO | __GFP_HIGHMEM)
#define NILFS_MDT_GFP      (__GFP_WAIT | __GFP_IO | __GFP_HIGHMEM)


@@ -108,7 +103,7 @@ static inline void nilfs_mdt_clear_dirty(struct inode *inode)


static inline __u64 nilfs_mdt_cno(struct inode *inode)
static inline __u64 nilfs_mdt_cno(struct inode *inode)
{
{
	return NILFS_I_NILFS(inode)->ns_cno;
	return ((struct the_nilfs *)inode->i_sb->s_fs_info)->ns_cno;
}
}


#define nilfs_mdt_bgl_lock(inode, bg) \
#define nilfs_mdt_bgl_lock(inode, bg) \
Loading