|
40 | 40 | struct wb_writeback_work { |
41 | 41 | long nr_pages; |
42 | 42 | struct super_block *sb; |
43 | | - /* |
44 | | - * Write only inodes dirtied before this time. Don't forget to set |
45 | | - * older_than_this_is_set when you set this. |
46 | | - */ |
47 | | - unsigned long older_than_this; |
| 43 | + unsigned long *older_than_this; |
48 | 44 | enum writeback_sync_modes sync_mode; |
49 | 45 | unsigned int tagged_writepages:1; |
50 | 46 | unsigned int for_kupdate:1; |
51 | 47 | unsigned int range_cyclic:1; |
52 | 48 | unsigned int for_background:1; |
53 | 49 | unsigned int for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ |
54 | | - unsigned int older_than_this_is_set:1; |
55 | 50 | enum wb_reason reason; /* why was writeback initiated? */ |
56 | 51 |
|
57 | 52 | struct list_head list; /* pending work list */ |
@@ -252,10 +247,10 @@ static int move_expired_inodes(struct list_head *delaying_queue, |
252 | 247 | int do_sb_sort = 0; |
253 | 248 | int moved = 0; |
254 | 249 |
|
255 | | - WARN_ON_ONCE(!work->older_than_this_is_set); |
256 | 250 | while (!list_empty(delaying_queue)) { |
257 | 251 | inode = wb_inode(delaying_queue->prev); |
258 | | - if (inode_dirtied_after(inode, work->older_than_this)) |
| 252 | + if (work->older_than_this && |
| 253 | + inode_dirtied_after(inode, *work->older_than_this)) |
259 | 254 | break; |
260 | 255 | list_move(&inode->i_wb_list, &tmp); |
261 | 256 | moved++; |
@@ -742,8 +737,6 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, |
742 | 737 | .sync_mode = WB_SYNC_NONE, |
743 | 738 | .range_cyclic = 1, |
744 | 739 | .reason = reason, |
745 | | - .older_than_this = jiffies, |
746 | | - .older_than_this_is_set = 1, |
747 | 740 | }; |
748 | 741 |
|
749 | 742 | spin_lock(&wb->list_lock); |
@@ -802,13 +795,12 @@ static long wb_writeback(struct bdi_writeback *wb, |
802 | 795 | { |
803 | 796 | unsigned long wb_start = jiffies; |
804 | 797 | long nr_pages = work->nr_pages; |
| 798 | + unsigned long oldest_jif; |
805 | 799 | struct inode *inode; |
806 | 800 | long progress; |
807 | 801 |
|
808 | | - if (!work->older_than_this_is_set) { |
809 | | - work->older_than_this = jiffies; |
810 | | - work->older_than_this_is_set = 1; |
811 | | - } |
| 802 | + oldest_jif = jiffies; |
| 803 | + work->older_than_this = &oldest_jif; |
812 | 804 |
|
813 | 805 | spin_lock(&wb->list_lock); |
814 | 806 | for (;;) { |
@@ -842,10 +834,10 @@ static long wb_writeback(struct bdi_writeback *wb, |
842 | 834 | * safe. |
843 | 835 | */ |
844 | 836 | if (work->for_kupdate) { |
845 | | - work->older_than_this = jiffies - |
| 837 | + oldest_jif = jiffies - |
846 | 838 | msecs_to_jiffies(dirty_expire_interval * 10); |
847 | 839 | } else if (work->for_background) |
848 | | - work->older_than_this = jiffies; |
| 840 | + oldest_jif = jiffies; |
849 | 841 |
|
850 | 842 | trace_writeback_start(wb->bdi, work); |
851 | 843 | if (list_empty(&wb->b_io)) |
@@ -1357,21 +1349,18 @@ EXPORT_SYMBOL(try_to_writeback_inodes_sb); |
1357 | 1349 |
|
1358 | 1350 | /** |
1359 | 1351 | * sync_inodes_sb - sync sb inode pages |
1360 | | - * @sb: the superblock |
1361 | | - * @older_than_this: timestamp |
| 1352 | + * @sb: the superblock |
1362 | 1353 | * |
1363 | 1354 | * This function writes and waits on any dirty inode belonging to this |
1364 | | - * superblock that has been dirtied before given timestamp. |
| 1355 | + * super_block. |
1365 | 1356 | */ |
1366 | | -void sync_inodes_sb(struct super_block *sb, unsigned long older_than_this) |
| 1357 | +void sync_inodes_sb(struct super_block *sb) |
1367 | 1358 | { |
1368 | 1359 | DECLARE_COMPLETION_ONSTACK(done); |
1369 | 1360 | struct wb_writeback_work work = { |
1370 | 1361 | .sb = sb, |
1371 | 1362 | .sync_mode = WB_SYNC_ALL, |
1372 | 1363 | .nr_pages = LONG_MAX, |
1373 | | - .older_than_this = older_than_this, |
1374 | | - .older_than_this_is_set = 1, |
1375 | 1364 | .range_cyclic = 0, |
1376 | 1365 | .done = &done, |
1377 | 1366 | .reason = WB_REASON_SYNC, |
|
0 commit comments