diff options
Diffstat (limited to 'fs/fs-writeback.c')
| -rw-r--r-- | fs/fs-writeback.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 7d9d06ba184b..5581122bd2c0 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -52,8 +52,6 @@ struct wb_writeback_work { | |||
| 52 | #define CREATE_TRACE_POINTS | 52 | #define CREATE_TRACE_POINTS |
| 53 | #include <trace/events/writeback.h> | 53 | #include <trace/events/writeback.h> |
| 54 | 54 | ||
| 55 | #define inode_to_bdi(inode) ((inode)->i_mapping->backing_dev_info) | ||
| 56 | |||
| 57 | /* | 55 | /* |
| 58 | * We don't actually have pdflush, but this one is exported though /proc... | 56 | * We don't actually have pdflush, but this one is exported though /proc... |
| 59 | */ | 57 | */ |
| @@ -71,6 +69,27 @@ int writeback_in_progress(struct backing_dev_info *bdi) | |||
| 71 | return test_bit(BDI_writeback_running, &bdi->state); | 69 | return test_bit(BDI_writeback_running, &bdi->state); |
| 72 | } | 70 | } |
| 73 | 71 | ||
| 72 | static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) | ||
| 73 | { | ||
| 74 | struct super_block *sb = inode->i_sb; | ||
| 75 | struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info; | ||
| 76 | |||
| 77 | /* | ||
| 78 | * For inodes on standard filesystems, we use superblock's bdi. For | ||
| 79 | * inodes on virtual filesystems, we want to use inode mapping's bdi | ||
| 80 | * because they can possibly point to something useful (think about | ||
| 81 | * block_dev filesystem). | ||
| 82 | */ | ||
| 83 | if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) { | ||
| 84 | /* Some device inodes could play dirty tricks. Catch them... */ | ||
| 85 | WARN(bdi != sb->s_bdi && bdi_cap_writeback_dirty(bdi), | ||
| 86 | "Dirtiable inode bdi %s != sb bdi %s\n", | ||
| 87 | bdi->name, sb->s_bdi->name); | ||
| 88 | return sb->s_bdi; | ||
| 89 | } | ||
| 90 | return bdi; | ||
| 91 | } | ||
| 92 | |||
| 74 | static void bdi_queue_work(struct backing_dev_info *bdi, | 93 | static void bdi_queue_work(struct backing_dev_info *bdi, |
| 75 | struct wb_writeback_work *work) | 94 | struct wb_writeback_work *work) |
| 76 | { | 95 | { |
| @@ -808,7 +827,7 @@ int bdi_writeback_thread(void *data) | |||
| 808 | wb->last_active = jiffies; | 827 | wb->last_active = jiffies; |
| 809 | 828 | ||
| 810 | set_current_state(TASK_INTERRUPTIBLE); | 829 | set_current_state(TASK_INTERRUPTIBLE); |
| 811 | if (!list_empty(&bdi->work_list)) { | 830 | if (!list_empty(&bdi->work_list) || kthread_should_stop()) { |
| 812 | __set_current_state(TASK_RUNNING); | 831 | __set_current_state(TASK_RUNNING); |
| 813 | continue; | 832 | continue; |
| 814 | } | 833 | } |
