]> Git Repo - linux.git/commitdiff
block: remove create_io_context
authorChristoph Hellwig <[email protected]>
Sat, 25 Apr 2020 07:55:51 +0000 (09:55 +0200)
committerJens Axboe <[email protected]>
Sat, 25 Apr 2020 15:44:40 +0000 (09:44 -0600)
create_io_context just has a single caller, which also happens to not
even use the return value.  Just open code it there.

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/blk-core.c
block/blk.h

index 311596d5dbc417fc0cf672669fc1f49ed1ac4b63..38e984d95e84b0bb7cad35fb0eb20faf5702bc6e 100644 (file)
@@ -963,12 +963,13 @@ generic_make_request_checks(struct bio *bio)
        }
 
        /*
-        * Various block parts want %current->io_context and lazy ioc
-        * allocation ends up trading a lot of pain for a small amount of
-        * memory.  Just allocate it upfront.  This may fail and block
-        * layer knows how to live with it.
+        * Various block parts want %current->io_context, so allocate it up
+        * front rather than dealing with lots of pain to allocate it only
+        * where needed. This may fail and the block layer knows how to live
+        * with it.
         */
-       create_io_context(GFP_ATOMIC, q->node);
+       if (unlikely(!current->io_context))
+               create_task_io_context(current, GFP_ATOMIC, q->node);
 
        if (!blkcg_bio_issue_check(q, bio))
                return false;
index 204963bb03e89014ae5fb303f846b0c5d13c5555..73bd3b1c6938492c4410eaf8ce842bea3b2a2670 100644 (file)
@@ -303,26 +303,6 @@ void ioc_clear_queue(struct request_queue *q);
 
 int create_task_io_context(struct task_struct *task, gfp_t gfp_mask, int node);
 
-/**
- * create_io_context - try to create task->io_context
- * @gfp_mask: allocation mask
- * @node: allocation node
- *
- * If %current->io_context is %NULL, allocate a new io_context and install
- * it.  Returns the current %current->io_context which may be %NULL if
- * allocation failed.
- *
- * Note that this function can't be called with IRQ disabled because
- * task_lock which protects %current->io_context is IRQ-unsafe.
- */
-static inline struct io_context *create_io_context(gfp_t gfp_mask, int node)
-{
-       WARN_ON_ONCE(irqs_disabled());
-       if (unlikely(!current->io_context))
-               create_task_io_context(current, gfp_mask, node);
-       return current->io_context;
-}
-
 /*
  * Internal throttling interface
  */
This page took 0.051979 seconds and 4 git commands to generate.