提交 d00689af 编写于 作者: Z Zach Brown 提交者: Linus Torvalds

[PATCH] aio: replace locking comments with assert_spin_locked()

aio: replace locking comments with assert_spin_locked()
Signed-off-by: NZach Brown <zach.brown@oracle.com>
Acked-by: NBenjamin LaHaise <bcrl@kvack.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 20dcae32
...@@ -457,6 +457,8 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx) ...@@ -457,6 +457,8 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx)
static inline void really_put_req(struct kioctx *ctx, struct kiocb *req) static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
{ {
assert_spin_locked(&ctx->ctx_lock);
if (req->ki_dtor) if (req->ki_dtor)
req->ki_dtor(req); req->ki_dtor(req);
kmem_cache_free(kiocb_cachep, req); kmem_cache_free(kiocb_cachep, req);
...@@ -498,6 +500,8 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req) ...@@ -498,6 +500,8 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n", dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n",
req, atomic_read(&req->ki_filp->f_count)); req, atomic_read(&req->ki_filp->f_count));
assert_spin_locked(&ctx->ctx_lock);
req->ki_users --; req->ki_users --;
if (unlikely(req->ki_users < 0)) if (unlikely(req->ki_users < 0))
BUG(); BUG();
...@@ -619,14 +623,13 @@ static void unuse_mm(struct mm_struct *mm) ...@@ -619,14 +623,13 @@ static void unuse_mm(struct mm_struct *mm)
* the kiocb (to tell the caller to activate the work * the kiocb (to tell the caller to activate the work
* queue to process it), or 0, if it found that it was * queue to process it), or 0, if it found that it was
* already queued. * already queued.
*
* Should be called with the spin lock iocb->ki_ctx->ctx_lock
* held
*/ */
static inline int __queue_kicked_iocb(struct kiocb *iocb) static inline int __queue_kicked_iocb(struct kiocb *iocb)
{ {
struct kioctx *ctx = iocb->ki_ctx; struct kioctx *ctx = iocb->ki_ctx;
assert_spin_locked(&ctx->ctx_lock);
if (list_empty(&iocb->ki_run_list)) { if (list_empty(&iocb->ki_run_list)) {
list_add_tail(&iocb->ki_run_list, list_add_tail(&iocb->ki_run_list,
&ctx->run_list); &ctx->run_list);
...@@ -771,13 +774,15 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) ...@@ -771,13 +774,15 @@ static ssize_t aio_run_iocb(struct kiocb *iocb)
* Process all pending retries queued on the ioctx * Process all pending retries queued on the ioctx
* run list. * run list.
* Assumes it is operating within the aio issuer's mm * Assumes it is operating within the aio issuer's mm
* context. Expects to be called with ctx->ctx_lock held * context.
*/ */
static int __aio_run_iocbs(struct kioctx *ctx) static int __aio_run_iocbs(struct kioctx *ctx)
{ {
struct kiocb *iocb; struct kiocb *iocb;
LIST_HEAD(run_list); LIST_HEAD(run_list);
assert_spin_locked(&ctx->ctx_lock);
list_splice_init(&ctx->run_list, &run_list); list_splice_init(&ctx->run_list, &run_list);
while (!list_empty(&run_list)) { while (!list_empty(&run_list)) {
iocb = list_entry(run_list.next, struct kiocb, iocb = list_entry(run_list.next, struct kiocb,
...@@ -1604,12 +1609,14 @@ asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr, ...@@ -1604,12 +1609,14 @@ asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,
/* lookup_kiocb /* lookup_kiocb
* Finds a given iocb for cancellation. * Finds a given iocb for cancellation.
* MUST be called with ctx->ctx_lock held.
*/ */
static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
u32 key) u32 key)
{ {
struct list_head *pos; struct list_head *pos;
assert_spin_locked(&ctx->ctx_lock);
/* TODO: use a hash or array, this sucks. */ /* TODO: use a hash or array, this sucks. */
list_for_each(pos, &ctx->active_reqs) { list_for_each(pos, &ctx->active_reqs) {
struct kiocb *kiocb = list_kiocb(pos); struct kiocb *kiocb = list_kiocb(pos);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册