Commit f3876930952390a31c3a7fd68dd621464a36eb80

Authored by shaohua.li@intel.com
Committed by Jens Axboe
1 parent 490b94be02

block: add a non-queueable flush flag

flush request isn't queueable in some drives. Add a flag to let driver
notify block layer about this. We can optimize flush performance with the
knowledge.

Stable: 2.6.39 only

Cc: stable@kernel.org
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>

Showing 2 changed files with 13 additions and 0 deletions Side-by-side Diff

block/blk-settings.c
... ... @@ -790,6 +790,12 @@
790 790 }
791 791 EXPORT_SYMBOL_GPL(blk_queue_flush);
792 792  
  793 +void blk_queue_flush_queueable(struct request_queue *q, bool queueable)
  794 +{
  795 + q->flush_not_queueable = !queueable;
  796 +}
  797 +EXPORT_SYMBOL_GPL(blk_queue_flush_queueable);
  798 +
793 799 static int __init blk_settings_init(void)
794 800 {
795 801 blk_max_low_pfn = max_low_pfn - 1;
include/linux/blkdev.h
... ... @@ -364,6 +364,7 @@
364 364 * for flush operations
365 365 */
366 366 unsigned int flush_flags;
  367 + unsigned int flush_not_queueable:1;
367 368 unsigned int flush_pending_idx:1;
368 369 unsigned int flush_running_idx:1;
369 370 unsigned long flush_pending_since;
... ... @@ -843,6 +844,7 @@
843 844 extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
844 845 extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
845 846 extern void blk_queue_flush(struct request_queue *q, unsigned int flush);
  847 +extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable);
846 848 extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
847 849  
848 850 extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
... ... @@ -1109,6 +1111,11 @@
1109 1111 static inline unsigned int block_size(struct block_device *bdev)
1110 1112 {
1111 1113 return bdev->bd_block_size;
  1114 +}
  1115 +
  1116 +static inline bool queue_flush_queueable(struct request_queue *q)
  1117 +{
  1118 + return !q->flush_not_queueable;
1112 1119 }
1113 1120  
1114 1121 typedef struct {struct page *v;} Sector;