Skip to content

Commit 4e7ea81

Browse files
jankaratytso
authored andcommitted
ext4: restructure writeback path
There are two issues with current writeback path in ext4. For one we don't necessarily map complete pages when blocksize < pagesize and thus needn't do any writeback in one iteration. We always map some blocks though so we will eventually finish mapping the page. Just if writeback races with other operations on the file, forward progress is not really guaranteed. The second problem is that current code structure makes it hard to associate all the bios to some range of pages with one io_end structure so that unwritten extents can be converted after all the bios are finished. This will be especially difficult later when io_end will be associated with reserved transaction handle. We restructure the writeback path to a relatively simple loop which first prepares extent of pages, then maps one or more extents so that no page is partially mapped, and once page is fully mapped it is submitted for IO. We keep all the mapping and IO submission information in mpage_da_data structure to somewhat reduce stack usage. Resulting code is somewhat shorter than the old one and hopefully also easier to read. Reviewed-by: Zheng Liu <[email protected]> Signed-off-by: Jan Kara <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent fffb273 commit 4e7ea81

File tree

4 files changed

+527
-567
lines changed

4 files changed

+527
-567
lines changed

fs/ext4/ext4.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,6 @@ struct ext4_map_blocks {
176176
unsigned int m_flags;
177177
};
178178

179-
/*
180-
* For delayed allocation tracking
181-
*/
182-
struct mpage_da_data {
183-
struct inode *inode;
184-
sector_t b_blocknr; /* start block number of extent */
185-
size_t b_size; /* size of extent */
186-
unsigned long b_state; /* state of the extent */
187-
unsigned long first_page, next_page; /* extent of pages */
188-
struct writeback_control *wbc;
189-
int io_done;
190-
int pages_written;
191-
int retval;
192-
};
193-
194179
/*
195180
* Flags for ext4_io_end->flags
196181
*/

0 commit comments

Comments
 (0)