[PATCH 10/19] f2fs: add sbi and page pointer in f2fs_io_info

2015-05-01 Thread Jaegeuk Kim
This patch adds f2fs_sb_info and page pointers in f2fs_io_info structure.
With this change, we can reduce a lot of parameters for IO functions.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c |  9 +++--
 fs/f2fs/data.c   | 47 +--
 fs/f2fs/f2fs.h   | 18 --
 fs/f2fs/file.c   |  2 +-
 fs/f2fs/gc.c |  4 +++-
 fs/f2fs/inline.c |  4 +++-
 fs/f2fs/node.c   |  8 ++--
 fs/f2fs/segment.c| 38 --
 fs/f2fs/super.c  |  2 +-
 fs/f2fs/trace.c  |  6 +++---
 fs/f2fs/trace.h  |  2 +-
 11 files changed, 82 insertions(+), 58 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 72f64b3..6dbff2b 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -52,6 +52,7 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t 
index)
struct address_space *mapping = META_MAPPING(sbi);
struct page *page;
struct f2fs_io_info fio = {
+   .sbi = sbi,
.type = META,
.rw = READ_SYNC | REQ_META | REQ_PRIO,
.blk_addr = index,
@@ -65,7 +66,9 @@ repeat:
if (PageUptodate(page))
goto out;
 
-   if (f2fs_submit_page_bio(sbi, page, ))
+   fio.page = page;
+
+   if (f2fs_submit_page_bio())
goto repeat;
 
lock_page(page);
@@ -117,6 +120,7 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, 
int nrpages, int type
struct page *page;
block_t blkno = start;
struct f2fs_io_info fio = {
+   .sbi = sbi,
.type = META,
.rw = READ_SYNC | REQ_META | REQ_PRIO
};
@@ -160,7 +164,8 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, 
int nrpages, int type
continue;
}
 
-   f2fs_submit_page_mbio(sbi, page, );
+   fio.page = page;
+   f2fs_submit_page_mbio();
f2fs_put_page(page, 0);
}
 out:
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2a3a9cd..81d1fd5 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -158,16 +158,16 @@ void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
  * Fill the locked page with data located in the block address.
  * Return unlocked page.
  */
-int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page,
-   struct f2fs_io_info *fio)
+int f2fs_submit_page_bio(struct f2fs_io_info *fio)
 {
struct bio *bio;
+   struct page *page = fio->page;
 
trace_f2fs_submit_page_bio(page, fio);
-   f2fs_trace_ios(page, fio, 0);
+   f2fs_trace_ios(fio, 0);
 
/* Allocate a new bio */
-   bio = __bio_alloc(sbi, fio->blk_addr, 1, is_read_io(fio->rw));
+   bio = __bio_alloc(fio->sbi, fio->blk_addr, 1, is_read_io(fio->rw));
 
if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
bio_put(bio);
@@ -179,9 +179,9 @@ int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct 
page *page,
return 0;
 }
 
-void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page,
-   struct f2fs_io_info *fio)
+void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
 {
+   struct f2fs_sb_info *sbi = fio->sbi;
enum page_type btype = PAGE_TYPE_OF_BIO(fio->type);
struct f2fs_bio_info *io;
bool is_read = is_read_io(fio->rw);
@@ -206,17 +206,17 @@ alloc_new:
io->fio = *fio;
}
 
-   if (bio_add_page(io->bio, page, PAGE_CACHE_SIZE, 0) <
+   if (bio_add_page(io->bio, fio->page, PAGE_CACHE_SIZE, 0) <
PAGE_CACHE_SIZE) {
__submit_merged_bio(io);
goto alloc_new;
}
 
io->last_block_in_bio = fio->blk_addr;
-   f2fs_trace_ios(page, fio, 0);
+   f2fs_trace_ios(fio, 0);
 
up_write(>io_rwsem);
-   trace_f2fs_submit_page_mbio(page, fio);
+   trace_f2fs_submit_page_mbio(fio->page, fio);
 }
 
 /*
@@ -925,6 +925,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t 
index, bool sync)
struct extent_info ei;
int err;
struct f2fs_io_info fio = {
+   .sbi = F2FS_I_SB(inode),
.type = DATA,
.rw = sync ? READ_SYNC : READA,
};
@@ -971,7 +972,8 @@ got_it:
}
 
fio.blk_addr = dn.data_blkaddr;
-   err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, );
+   fio.page = page;
+   err = f2fs_submit_page_bio();
if (err)
return ERR_PTR(err);
 
@@ -998,6 +1000,7 @@ struct page *get_lock_data_page(struct inode *inode, 
pgoff_t index)
struct extent_info ei;
int err;
struct f2fs_io_info fio = {
+   .sbi = F2FS_I_SB(inode),
.type = DATA,
.rw = 

[PATCH 10/19] f2fs: add sbi and page pointer in f2fs_io_info

2015-05-01 Thread Jaegeuk Kim
This patch adds f2fs_sb_info and page pointers in f2fs_io_info structure.
With this change, we can reduce a lot of parameters for IO functions.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 fs/f2fs/checkpoint.c |  9 +++--
 fs/f2fs/data.c   | 47 +--
 fs/f2fs/f2fs.h   | 18 --
 fs/f2fs/file.c   |  2 +-
 fs/f2fs/gc.c |  4 +++-
 fs/f2fs/inline.c |  4 +++-
 fs/f2fs/node.c   |  8 ++--
 fs/f2fs/segment.c| 38 --
 fs/f2fs/super.c  |  2 +-
 fs/f2fs/trace.c  |  6 +++---
 fs/f2fs/trace.h  |  2 +-
 11 files changed, 82 insertions(+), 58 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 72f64b3..6dbff2b 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -52,6 +52,7 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t 
index)
struct address_space *mapping = META_MAPPING(sbi);
struct page *page;
struct f2fs_io_info fio = {
+   .sbi = sbi,
.type = META,
.rw = READ_SYNC | REQ_META | REQ_PRIO,
.blk_addr = index,
@@ -65,7 +66,9 @@ repeat:
if (PageUptodate(page))
goto out;
 
-   if (f2fs_submit_page_bio(sbi, page, fio))
+   fio.page = page;
+
+   if (f2fs_submit_page_bio(fio))
goto repeat;
 
lock_page(page);
@@ -117,6 +120,7 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, 
int nrpages, int type
struct page *page;
block_t blkno = start;
struct f2fs_io_info fio = {
+   .sbi = sbi,
.type = META,
.rw = READ_SYNC | REQ_META | REQ_PRIO
};
@@ -160,7 +164,8 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, 
int nrpages, int type
continue;
}
 
-   f2fs_submit_page_mbio(sbi, page, fio);
+   fio.page = page;
+   f2fs_submit_page_mbio(fio);
f2fs_put_page(page, 0);
}
 out:
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2a3a9cd..81d1fd5 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -158,16 +158,16 @@ void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
  * Fill the locked page with data located in the block address.
  * Return unlocked page.
  */
-int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page,
-   struct f2fs_io_info *fio)
+int f2fs_submit_page_bio(struct f2fs_io_info *fio)
 {
struct bio *bio;
+   struct page *page = fio-page;
 
trace_f2fs_submit_page_bio(page, fio);
-   f2fs_trace_ios(page, fio, 0);
+   f2fs_trace_ios(fio, 0);
 
/* Allocate a new bio */
-   bio = __bio_alloc(sbi, fio-blk_addr, 1, is_read_io(fio-rw));
+   bio = __bio_alloc(fio-sbi, fio-blk_addr, 1, is_read_io(fio-rw));
 
if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0)  PAGE_CACHE_SIZE) {
bio_put(bio);
@@ -179,9 +179,9 @@ int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct 
page *page,
return 0;
 }
 
-void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page,
-   struct f2fs_io_info *fio)
+void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
 {
+   struct f2fs_sb_info *sbi = fio-sbi;
enum page_type btype = PAGE_TYPE_OF_BIO(fio-type);
struct f2fs_bio_info *io;
bool is_read = is_read_io(fio-rw);
@@ -206,17 +206,17 @@ alloc_new:
io-fio = *fio;
}
 
-   if (bio_add_page(io-bio, page, PAGE_CACHE_SIZE, 0) 
+   if (bio_add_page(io-bio, fio-page, PAGE_CACHE_SIZE, 0) 
PAGE_CACHE_SIZE) {
__submit_merged_bio(io);
goto alloc_new;
}
 
io-last_block_in_bio = fio-blk_addr;
-   f2fs_trace_ios(page, fio, 0);
+   f2fs_trace_ios(fio, 0);
 
up_write(io-io_rwsem);
-   trace_f2fs_submit_page_mbio(page, fio);
+   trace_f2fs_submit_page_mbio(fio-page, fio);
 }
 
 /*
@@ -925,6 +925,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t 
index, bool sync)
struct extent_info ei;
int err;
struct f2fs_io_info fio = {
+   .sbi = F2FS_I_SB(inode),
.type = DATA,
.rw = sync ? READ_SYNC : READA,
};
@@ -971,7 +972,8 @@ got_it:
}
 
fio.blk_addr = dn.data_blkaddr;
-   err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, fio);
+   fio.page = page;
+   err = f2fs_submit_page_bio(fio);
if (err)
return ERR_PTR(err);
 
@@ -998,6 +1000,7 @@ struct page *get_lock_data_page(struct inode *inode, 
pgoff_t index)
struct extent_info ei;
int err;
struct f2fs_io_info fio = {
+   .sbi = F2FS_I_SB(inode),
.type = DATA,