[PATCH 6/9] blk: Add request atomic flag for abort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add atomic flag for a request to indicate that it has marked as aborted.
Provide functions to mark and test the aborted flag.

Signed-off-by: Mike Anderson <andmike@xxxxxxxxxxxxxxxxxx>
Cc: Jens Axobe <jens.axboe@xxxxxxxxxx>
---
 block/blk-timeout.c    |    6 ++++++
 block/blk.h            |   14 ++++++++++++++
 include/linux/blkdev.h |    1 +
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 89fbe0a..ad45b44 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -155,6 +155,12 @@ void blk_abort_request(struct request *req)
 }
 EXPORT_SYMBOL_GPL(blk_abort_request);
 
+int blk_request_aborted(struct request *req)
+{
+	return blk_test_rq_aborted(req);
+}
+EXPORT_SYMBOL_GPL(blk_request_aborted);
+
 /**
  * blk_add_timer - Start timeout timer for a single request
  * @req:	request that is about to start running.
diff --git a/block/blk.h b/block/blk.h
index 5ee3d7e..165262a 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -30,6 +30,7 @@ void __generic_unplug_device(struct request_queue *);
  */
 enum rq_atomic_flags {
 	REQ_ATOM_COMPLETE = 0,
+	REQ_ATOM_ABORT = 1,
 };
 
 /*
@@ -47,6 +48,19 @@ static inline void blk_clear_rq_complete(struct request *rq)
 }
 
 /*
+ * Mark and test a request for aborted.
+ */
+static inline int blk_mark_rq_aborted(struct request *rq)
+{
+	return test_and_set_bit(REQ_ATOM_ABORT, &rq->atomic_flags);
+}
+
+static inline int blk_test_rq_aborted(struct request *rq)
+{
+	return test_bit(REQ_ATOM_ABORT, &rq->atomic_flags);
+}
+
+/*
  * Internal elevator interface
  */
 #define ELV_ON_HASH(rq)		(!hlist_unhashed(&(rq)->hash))
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2818e80..7636e58 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -912,6 +912,7 @@ extern void blk_complete_request(struct request *);
 extern void __blk_complete_request(struct request *);
 extern void blk_abort_request(struct request *);
 extern void blk_abort_queue(struct request_queue *);
+extern int blk_request_aborted(struct request *);
 
 /*
  * Access functions for manipulating queue properties
-- 
1.6.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux