From: Mike Anderson <andmike@linux.vnet.ibm.com>
To: linux-scsi@vger.kernel.org
Cc: Jens Axobe <jens.axboe@oracle.com>,
James Bottomley <James.Bottomley@suse.de>,
dm-devel@redhat.com
Subject: [PATCH 6/9] blk: Add request atomic flag for abort
Date: Mon, 3 May 2010 20:37:05 -0700 [thread overview]
Message-ID: <1272944228-30511-7-git-send-email-andmike@linux.vnet.ibm.com> (raw)
In-Reply-To: <1272944228-30511-1-git-send-email-andmike@linux.vnet.ibm.com>
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@linux.vnet.ibm.com>
Cc: Jens Axobe <jens.axboe@oracle.com>
---
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
next prev parent reply other threads:[~2010-05-04 3:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 3:36 [PATCH 0/9] blk: scsi: blk abort queue updates Mike Anderson
2010-05-04 3:37 ` [PATCH 1/9] blk: Do not abort requests if queue is stopped Mike Anderson
2010-05-04 10:40 ` Hannes Reinecke
2010-05-04 10:45 ` Jens Axboe
2010-05-05 4:52 ` Mike Anderson
2010-05-05 18:13 ` Mike Christie
2010-05-05 18:18 ` Mike Anderson
2010-05-04 3:37 ` [PATCH 2/9] blk: In elv_abort_queue skip requests with REQ_DONTPREP set Mike Anderson
2010-05-04 10:40 ` Hannes Reinecke
2010-05-04 10:47 ` Jens Axboe
2010-05-04 17:58 ` Mike Anderson
2010-05-05 8:21 ` Jens Axboe
2010-05-04 3:37 ` [PATCH 3/9] blk: Add a unprep_rq_fn Mike Anderson
2010-05-04 10:41 ` Hannes Reinecke
2010-05-04 3:37 ` [PATCH 4/9] blk: Call unprep_fn from elv_abort_queue is available Mike Anderson
2010-05-04 10:42 ` Hannes Reinecke
2010-05-04 10:42 ` [dm-devel] " Hannes Reinecke
2010-05-04 3:37 ` [PATCH 5/9] scsi: Add a scsi_unprep_fn Mike Anderson
2010-05-04 10:43 ` [dm-devel] " Hannes Reinecke
2010-05-04 10:48 ` Jens Axboe
2010-05-04 3:37 ` Mike Anderson [this message]
2010-05-04 10:43 ` [dm-devel] [PATCH 6/9] blk: Add request atomic flag for abort Hannes Reinecke
2010-05-04 3:37 ` [PATCH 7/9] blk: Mark requests aborted Mike Anderson
2010-05-04 10:44 ` Hannes Reinecke
2010-05-04 3:37 ` [PATCH 8/9] scsi: Add scsi_requeue_request function Mike Anderson
2010-05-04 3:37 ` [PATCH 9/9] scsi: Add blk_request_aborted check Mike Anderson
2010-05-04 10:45 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1272944228-30511-7-git-send-email-andmike@linux.vnet.ibm.com \
--to=andmike@linux.vnet.ibm.com \
--cc=James.Bottomley@suse.de \
--cc=dm-devel@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).