diff options
Diffstat (limited to 'fs/fs-writeback.c')
| -rw-r--r-- | fs/fs-writeback.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 06557679ca41..ae45f77765c0 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -25,6 +25,45 @@ | |||
| 25 | #include <linux/buffer_head.h> | 25 | #include <linux/buffer_head.h> |
| 26 | #include "internal.h" | 26 | #include "internal.h" |
| 27 | 27 | ||
| 28 | |||
| 29 | /** | ||
| 30 | * writeback_acquire - attempt to get exclusive writeback access to a device | ||
| 31 | * @bdi: the device's backing_dev_info structure | ||
| 32 | * | ||
| 33 | * It is a waste of resources to have more than one pdflush thread blocked on | ||
| 34 | * a single request queue. Exclusion at the request_queue level is obtained | ||
| 35 | * via a flag in the request_queue's backing_dev_info.state. | ||
| 36 | * | ||
| 37 | * Non-request_queue-backed address_spaces will share default_backing_dev_info, | ||
| 38 | * unless they implement their own. Which is somewhat inefficient, as this | ||
| 39 | * may prevent concurrent writeback against multiple devices. | ||
| 40 | */ | ||
| 41 | static int writeback_acquire(struct backing_dev_info *bdi) | ||
| 42 | { | ||
| 43 | return !test_and_set_bit(BDI_pdflush, &bdi->state); | ||
| 44 | } | ||
| 45 | |||
| 46 | /** | ||
| 47 | * writeback_in_progress - determine whether there is writeback in progress | ||
| 48 | * @bdi: the device's backing_dev_info structure. | ||
| 49 | * | ||
| 50 | * Determine whether there is writeback in progress against a backing device. | ||
| 51 | */ | ||
| 52 | int writeback_in_progress(struct backing_dev_info *bdi) | ||
| 53 | { | ||
| 54 | return test_bit(BDI_pdflush, &bdi->state); | ||
| 55 | } | ||
| 56 | |||
| 57 | /** | ||
| 58 | * writeback_release - relinquish exclusive writeback access against a device. | ||
| 59 | * @bdi: the device's backing_dev_info structure | ||
| 60 | */ | ||
| 61 | static void writeback_release(struct backing_dev_info *bdi) | ||
| 62 | { | ||
| 63 | BUG_ON(!writeback_in_progress(bdi)); | ||
| 64 | clear_bit(BDI_pdflush, &bdi->state); | ||
| 65 | } | ||
| 66 | |||
| 28 | /** | 67 | /** |
| 29 | * __mark_inode_dirty - internal function | 68 | * __mark_inode_dirty - internal function |
| 30 | * @inode: inode to mark | 69 | * @inode: inode to mark |
| @@ -747,43 +786,4 @@ int generic_osync_inode(struct inode *inode, struct address_space *mapping, int | |||
| 747 | 786 | ||
| 748 | return err; | 787 | return err; |
| 749 | } | 788 | } |
| 750 | |||
| 751 | EXPORT_SYMBOL(generic_osync_inode); | 789 | EXPORT_SYMBOL(generic_osync_inode); |
| 752 | |||
| 753 | /** | ||
| 754 | * writeback_acquire - attempt to get exclusive writeback access to a device | ||
| 755 | * @bdi: the device's backing_dev_info structure | ||
| 756 | * | ||
| 757 | * It is a waste of resources to have more than one pdflush thread blocked on | ||
| 758 | * a single request queue. Exclusion at the request_queue level is obtained | ||
| 759 | * via a flag in the request_queue's backing_dev_info.state. | ||
| 760 | * | ||
| 761 | * Non-request_queue-backed address_spaces will share default_backing_dev_info, | ||
| 762 | * unless they implement their own. Which is somewhat inefficient, as this | ||
| 763 | * may prevent concurrent writeback against multiple devices. | ||
| 764 | */ | ||
| 765 | int writeback_acquire(struct backing_dev_info *bdi) | ||
| 766 | { | ||
| 767 | return !test_and_set_bit(BDI_pdflush, &bdi->state); | ||
| 768 | } | ||
| 769 | |||
| 770 | /** | ||
| 771 | * writeback_in_progress - determine whether there is writeback in progress | ||
| 772 | * @bdi: the device's backing_dev_info structure. | ||
| 773 | * | ||
| 774 | * Determine whether there is writeback in progress against a backing device. | ||
| 775 | */ | ||
| 776 | int writeback_in_progress(struct backing_dev_info *bdi) | ||
| 777 | { | ||
| 778 | return test_bit(BDI_pdflush, &bdi->state); | ||
| 779 | } | ||
| 780 | |||
| 781 | /** | ||
| 782 | * writeback_release - relinquish exclusive writeback access against a device. | ||
| 783 | * @bdi: the device's backing_dev_info structure | ||
| 784 | */ | ||
| 785 | void writeback_release(struct backing_dev_info *bdi) | ||
| 786 | { | ||
| 787 | BUG_ON(!writeback_in_progress(bdi)); | ||
| 788 | clear_bit(BDI_pdflush, &bdi->state); | ||
| 789 | } | ||
