Skip to contentSkip to conversation

fs: ext4: remove unnecessary wbc parameter from ext4_bio_write_page

PATCH Applied [email protected] 2 participants 2 messages Dec 11, 2020 – Dec 17, 2020 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: ext4: remove unnecessary wbc parameter from ext4_bio_write_page

From: Lei Chen <[email protected]>

ext4_bio_write_page does not need wbc parameter, since its parameter io contains the io_wbc field. The io::io_wbc is initialized by ext4_io_submit_init which is called in ext4_writepages and ext4_writepage functions prior to ext4_bio_write_page. Therefor, when ext4_bio_write_page is called, wbc info has already been included in io parameter.

---
 fs/ext4/ext4.h    | 1 -
 fs/ext4/inode.c   | 4 ++--
 fs/ext4/page-io.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
fs/ext4/ext4.h +0 -1
index cd95965..1385898 100644
@@ -3638,7 +3638,6 @@ extern void ext4_io_submit_init(struct ext4_io_submit *io,
 extern int ext4_bio_write_page(struct ext4_io_submit *io,
 			       struct page *page,
 			       int len,
-			       struct writeback_control *wbc,
 			       bool keep_towrite);
 extern struct ext4_io_end_vec *ext4_alloc_io_end_vec(ext4_io_end_t *io_end);
 extern struct ext4_io_end_vec *ext4_last_io_end_vec(ext4_io_end_t *io_end);
fs/ext4/inode.c +2 -2
index b147c2e..7360e7a 100644
@@ -2055,7 +2055,7 @@ static int ext4_writepage(struct page *page,
 		unlock_page(page);
 		return -ENOMEM;
 	}
-	ret = ext4_bio_write_page(&io_submit, page, len, wbc, keep_towrite);
+	ret = ext4_bio_write_page(&io_submit, page, len, keep_towrite);
 	ext4_io_submit(&io_submit);
 	/* Drop io_end reference we got from init */
 	ext4_put_io_end_defer(io_submit.io_end);
@@ -2089,7 +2089,7 @@ static int mpage_submit_page(struct mpage_da_data *mpd, struct page *page)
 		len = size & ~PAGE_MASK;
 	else
 		len = PAGE_SIZE;
-	err = ext4_bio_write_page(&mpd->io_submit, page, len, mpd->wbc, false);
+	err = ext4_bio_write_page(&mpd->io_submit, page, len, false);
 	if (!err)
 		mpd->wbc->nr_to_write--;
 	mpd->first_page++;
fs/ext4/page-io.c +1 -1
index cb135a9..03a44a0 100644
@@ -435,7 +435,6 @@ static void io_submit_add_bh(struct ext4_io_submit *io,
 int ext4_bio_write_page(struct ext4_io_submit *io,
 			struct page *page,
 			int len,
-			struct writeback_control *wbc,
 			bool keep_towrite)
 {
 	struct page *bounce_page = NULL;
@@ -445,6 +444,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
 	int ret = 0;
 	int nr_submitted = 0;
 	int nr_to_submit = 0;
+	struct writeback_control *wbc = io->io_wbc;
 
 	BUG_ON(!PageLocked(page));
 	BUG_ON(PageWriteback(page));
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 10 lines · On Fri, Dec 11, 2020 at 02:54:24PM +0800, [email protected] wrote:

From: Lei Chen <[email protected]>

ext4_bio_write_page does not need wbc parameter, since its parameter io contains the io_wbc field. The io::io_wbc is initialized by ext4_io_submit_init which is called in ext4_writepages and ext4_writepage functions prior to ext4_bio_write_page. Therefor, when ext4_bio_write_page is called, wbc info has already been included in io parameter.

Thanks, applied.

- Ted