nilfs2: get rid of sc_sbi back pointer
Removes sci->sc_sbi which is a back pointer to nilfs_sb_info struct
from log writer object (nilfs_sc_info).
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index e3d1785..b14788e 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -772,7 +772,7 @@
static int nilfs_segctor_confirm(struct nilfs_sc_info *sci)
{
- struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
int ret = 0;
if (nilfs_test_metadata_dirty(nilfs, sci->sc_root))
@@ -788,8 +788,7 @@
static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci)
{
- struct nilfs_sb_info *sbi = sci->sc_sbi;
- struct the_nilfs *nilfs = sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
nilfs_mdt_clear_dirty(sci->sc_root->ifile);
nilfs_mdt_clear_dirty(nilfs->ns_cpfile);
@@ -799,7 +798,7 @@
static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci)
{
- struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
struct buffer_head *bh_cp;
struct nilfs_checkpoint *raw_cp;
int err;
@@ -823,8 +822,7 @@
static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci)
{
- struct nilfs_sb_info *sbi = sci->sc_sbi;
- struct the_nilfs *nilfs = sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
struct buffer_head *bh_cp;
struct nilfs_checkpoint *raw_cp;
int err;
@@ -1048,8 +1046,7 @@
static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
{
- struct nilfs_sb_info *sbi = sci->sc_sbi;
- struct the_nilfs *nilfs = sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
struct list_head *head;
struct nilfs_inode_info *ii;
size_t ndone;
@@ -1858,7 +1855,7 @@
{
struct nilfs_segment_buffer *segbuf;
struct page *bd_page = NULL, *fs_page = NULL;
- struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
int update_sr = false;
list_for_each_entry(segbuf, &sci->sc_write_logs, sb_list) {
@@ -2029,8 +2026,7 @@
*/
static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)
{
- struct nilfs_sb_info *sbi = sci->sc_sbi;
- struct the_nilfs *nilfs = sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
struct page *failed_page;
int err;
@@ -2388,7 +2384,7 @@
*/
static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode)
{
- struct nilfs_sb_info *sbi = sci->sc_sbi;
+ struct nilfs_sb_info *sbi = NILFS_SB(sci->sc_super);
struct the_nilfs *nilfs = sbi->s_nilfs;
struct nilfs_super_block **sbp;
int err = 0;
@@ -2501,7 +2497,7 @@
static void nilfs_segctor_thread_construct(struct nilfs_sc_info *sci, int mode)
{
- struct nilfs_sb_info *sbi = sci->sc_sbi;
+ struct nilfs_sb_info *sbi = NILFS_SB(sci->sc_super);
struct nilfs_transaction_info ti;
nilfs_transaction_lock(sbi, &ti, 0);
@@ -2561,7 +2557,7 @@
static int nilfs_segctor_thread(void *arg)
{
struct nilfs_sc_info *sci = (struct nilfs_sc_info *)arg;
- struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
int timeout = 0;
sci->sc_timer.data = (unsigned long)current;
@@ -2682,7 +2678,6 @@
if (!sci)
return NULL;
- sci->sc_sbi = sbi;
sci->sc_super = sbi->s_super;
nilfs_get_root(root);
@@ -2717,7 +2712,7 @@
/* The segctord thread was stopped and its timer was removed.
But some tasks remain. */
do {
- struct nilfs_sb_info *sbi = sci->sc_sbi;
+ struct nilfs_sb_info *sbi = NILFS_SB(sci->sc_super);
struct nilfs_transaction_info ti;
nilfs_transaction_lock(sbi, &ti, 0);
@@ -2737,7 +2732,7 @@
*/
static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
{
- struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs;
+ struct the_nilfs *nilfs = NILFS_SB(sci->sc_super)->s_nilfs;
int flag;
up_write(&nilfs->ns_segctor_sem);
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
index cd8056e..9544aa9 100644
--- a/fs/nilfs2/segment.h
+++ b/fs/nilfs2/segment.h
@@ -88,7 +88,6 @@
/**
* struct nilfs_sc_info - Segment constructor information
* @sc_super: Back pointer to super_block struct
- * @sc_sbi: Back pointer to nilfs_sb_info struct
* @sc_root: root object of the current filesystem tree
* @sc_nblk_inc: Block count of current generation
* @sc_dirty_files: List of files to be written
@@ -131,7 +130,6 @@
*/
struct nilfs_sc_info {
struct super_block *sc_super;
- struct nilfs_sb_info *sc_sbi;
struct nilfs_root *sc_root;
unsigned long sc_nblk_inc;