diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs-writeback.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index c8471b3ddccf..73acab4dc2b7 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -26,15 +26,9 @@ | |||
26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
29 | #include <linux/tracepoint.h> | ||
29 | #include "internal.h" | 30 | #include "internal.h" |
30 | 31 | ||
31 | #define inode_to_bdi(inode) ((inode)->i_mapping->backing_dev_info) | ||
32 | |||
33 | /* | ||
34 | * We don't actually have pdflush, but this one is exported though /proc... | ||
35 | */ | ||
36 | int nr_pdflush_threads; | ||
37 | |||
38 | /* | 32 | /* |
39 | * Passed into wb_writeback(), essentially a subset of writeback_control | 33 | * Passed into wb_writeback(), essentially a subset of writeback_control |
40 | */ | 34 | */ |
@@ -50,6 +44,21 @@ struct wb_writeback_work { | |||
50 | struct completion *done; /* set if the caller waits */ | 44 | struct completion *done; /* set if the caller waits */ |
51 | }; | 45 | }; |
52 | 46 | ||
47 | /* | ||
48 | * Include the creation of the trace points after defining the | ||
49 | * wb_writeback_work structure so that the definition remains local to this | ||
50 | * file. | ||
51 | */ | ||
52 | #define CREATE_TRACE_POINTS | ||
53 | #include <trace/events/writeback.h> | ||
54 | |||
55 | #define inode_to_bdi(inode) ((inode)->i_mapping->backing_dev_info) | ||
56 | |||
57 | /* | ||
58 | * We don't actually have pdflush, but this one is exported though /proc... | ||
59 | */ | ||
60 | int nr_pdflush_threads; | ||
61 | |||
53 | /** | 62 | /** |
54 | * writeback_in_progress - determine whether there is writeback in progress | 63 | * writeback_in_progress - determine whether there is writeback in progress |
55 | * @bdi: the device's backing_dev_info structure. | 64 | * @bdi: the device's backing_dev_info structure. |
@@ -65,6 +74,8 @@ int writeback_in_progress(struct backing_dev_info *bdi) | |||
65 | static void bdi_queue_work(struct backing_dev_info *bdi, | 74 | static void bdi_queue_work(struct backing_dev_info *bdi, |
66 | struct wb_writeback_work *work) | 75 | struct wb_writeback_work *work) |
67 | { | 76 | { |
77 | trace_writeback_queue(bdi, work); | ||
78 | |||
68 | spin_lock(&bdi->wb_lock); | 79 | spin_lock(&bdi->wb_lock); |
69 | list_add_tail(&work->list, &bdi->work_list); | 80 | list_add_tail(&work->list, &bdi->work_list); |
70 | spin_unlock(&bdi->wb_lock); | 81 | spin_unlock(&bdi->wb_lock); |
@@ -74,6 +85,7 @@ static void bdi_queue_work(struct backing_dev_info *bdi, | |||
74 | * it gets created and wakes up, we'll run this work. | 85 | * it gets created and wakes up, we'll run this work. |
75 | */ | 86 | */ |
76 | if (unlikely(!bdi->wb.task)) { | 87 | if (unlikely(!bdi->wb.task)) { |
88 | trace_writeback_nothread(bdi, work); | ||
77 | wake_up_process(default_backing_dev_info.wb.task); | 89 | wake_up_process(default_backing_dev_info.wb.task); |
78 | } else { | 90 | } else { |
79 | struct bdi_writeback *wb = &bdi->wb; | 91 | struct bdi_writeback *wb = &bdi->wb; |
@@ -95,8 +107,10 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | |||
95 | */ | 107 | */ |
96 | work = kzalloc(sizeof(*work), GFP_ATOMIC); | 108 | work = kzalloc(sizeof(*work), GFP_ATOMIC); |
97 | if (!work) { | 109 | if (!work) { |
98 | if (bdi->wb.task) | 110 | if (bdi->wb.task) { |
111 | trace_writeback_nowork(bdi); | ||
99 | wake_up_process(bdi->wb.task); | 112 | wake_up_process(bdi->wb.task); |
113 | } | ||
100 | return; | 114 | return; |
101 | } | 115 | } |
102 | 116 | ||
@@ -751,6 +765,8 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait) | |||
751 | if (force_wait) | 765 | if (force_wait) |
752 | work->sync_mode = WB_SYNC_ALL; | 766 | work->sync_mode = WB_SYNC_ALL; |
753 | 767 | ||
768 | trace_writeback_exec(bdi, work); | ||
769 | |||
754 | wrote += wb_writeback(wb, work); | 770 | wrote += wb_writeback(wb, work); |
755 | 771 | ||
756 | /* | 772 | /* |
@@ -805,9 +821,13 @@ int bdi_writeback_thread(void *data) | |||
805 | smp_mb__after_clear_bit(); | 821 | smp_mb__after_clear_bit(); |
806 | wake_up_bit(&bdi->state, BDI_pending); | 822 | wake_up_bit(&bdi->state, BDI_pending); |
807 | 823 | ||
824 | trace_writeback_thread_start(bdi); | ||
825 | |||
808 | while (!kthread_should_stop()) { | 826 | while (!kthread_should_stop()) { |
809 | pages_written = wb_do_writeback(wb, 0); | 827 | pages_written = wb_do_writeback(wb, 0); |
810 | 828 | ||
829 | trace_writeback_pages_written(pages_written); | ||
830 | |||
811 | if (pages_written) | 831 | if (pages_written) |
812 | last_active = jiffies; | 832 | last_active = jiffies; |
813 | else if (wait_jiffies != -1UL) { | 833 | else if (wait_jiffies != -1UL) { |
@@ -845,6 +865,8 @@ int bdi_writeback_thread(void *data) | |||
845 | */ | 865 | */ |
846 | if (!list_empty(&bdi->work_list)) | 866 | if (!list_empty(&bdi->work_list)) |
847 | wb_do_writeback(wb, 1); | 867 | wb_do_writeback(wb, 1); |
868 | |||
869 | trace_writeback_thread_stop(bdi); | ||
848 | return 0; | 870 | return 0; |
849 | } | 871 | } |
850 | 872 | ||