diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-04-09 19:16:18 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-06-03 17:07:34 -0400 |
commit | 88ba2aa586c874681c072101287e15d40de7e6e2 (patch) | |
tree | 69a124fcd0a8a75ef9aae0cc4081bad83c770374 | |
parent | 099f53cb50e45ef617a9f1d63ceec799e489418b (diff) |
async_tx: kill ASYNC_TX_DEP_ACK flag
In support of inter-channel chaining async_tx utilizes an ack flag to
gate whether a dependent operation can be chained to another. While the
flag is not set the chain can be considered open for appending. Setting
the ack flag closes the chain and flags the descriptor for garbage
collection. The ASYNC_TX_DEP_ACK flag essentially means "close the
chain after adding this dependency". Since each operation can only have
one child the api now implicitly sets the ack flag at dependency
submission time. This removes an unnecessary management burden from
clients of the api.
[ Impact: clean up and enforce one dependency per operation ]
Reviewed-by: Andre Noll <maan@systemlinux.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | Documentation/crypto/async-tx-api.txt | 9 | ||||
-rw-r--r-- | crypto/async_tx/async_memcpy.c | 2 | ||||
-rw-r--r-- | crypto/async_tx/async_memset.c | 2 | ||||
-rw-r--r-- | crypto/async_tx/async_tx.c | 4 | ||||
-rw-r--r-- | crypto/async_tx/async_xor.c | 6 | ||||
-rw-r--r-- | drivers/md/raid5.c | 25 | ||||
-rw-r--r-- | include/linux/async_tx.h | 4 |
7 files changed, 22 insertions, 30 deletions
diff --git a/Documentation/crypto/async-tx-api.txt b/Documentation/crypto/async-tx-api.txt index 4af12180d191..76feda8541dc 100644 --- a/Documentation/crypto/async-tx-api.txt +++ b/Documentation/crypto/async-tx-api.txt | |||
@@ -80,8 +80,8 @@ acknowledged by the application before the offload engine driver is allowed to | |||
80 | recycle (or free) the descriptor. A descriptor can be acked by one of the | 80 | recycle (or free) the descriptor. A descriptor can be acked by one of the |
81 | following methods: | 81 | following methods: |
82 | 1/ setting the ASYNC_TX_ACK flag if no child operations are to be submitted | 82 | 1/ setting the ASYNC_TX_ACK flag if no child operations are to be submitted |
83 | 2/ setting the ASYNC_TX_DEP_ACK flag to acknowledge the parent | 83 | 2/ submitting an unacknowledged descriptor as a dependency to another |
84 | descriptor of a new operation. | 84 | async_tx call will implicitly set the acknowledged state. |
85 | 3/ calling async_tx_ack() on the descriptor. | 85 | 3/ calling async_tx_ack() on the descriptor. |
86 | 86 | ||
87 | 3.4 When does the operation execute? | 87 | 3.4 When does the operation execute? |
@@ -136,10 +136,9 @@ int run_xor_copy_xor(struct page **xor_srcs, | |||
136 | 136 | ||
137 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 137 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, |
138 | ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL); | 138 | ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL); |
139 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, | 139 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, tx, NULL, NULL); |
140 | ASYNC_TX_DEP_ACK, tx, NULL, NULL); | ||
141 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 140 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, |
142 | ASYNC_TX_XOR_DROP_DST | ASYNC_TX_DEP_ACK | ASYNC_TX_ACK, | 141 | ASYNC_TX_XOR_DROP_DST | ASYNC_TX_ACK, |
143 | tx, complete_xor_copy_xor, NULL); | 142 | tx, complete_xor_copy_xor, NULL); |
144 | 143 | ||
145 | async_tx_issue_pending_all(); | 144 | async_tx_issue_pending_all(); |
diff --git a/crypto/async_tx/async_memcpy.c b/crypto/async_tx/async_memcpy.c index ddccfb01c416..7117ec6f1b74 100644 --- a/crypto/async_tx/async_memcpy.c +++ b/crypto/async_tx/async_memcpy.c | |||
@@ -35,7 +35,7 @@ | |||
35 | * @src: src page | 35 | * @src: src page |
36 | * @offset: offset in pages to start transaction | 36 | * @offset: offset in pages to start transaction |
37 | * @len: length in bytes | 37 | * @len: length in bytes |
38 | * @flags: ASYNC_TX_ACK, ASYNC_TX_DEP_ACK, | 38 | * @flags: ASYNC_TX_ACK |
39 | * @depend_tx: memcpy depends on the result of this transaction | 39 | * @depend_tx: memcpy depends on the result of this transaction |
40 | * @cb_fn: function to call when the memcpy completes | 40 | * @cb_fn: function to call when the memcpy completes |
41 | * @cb_param: parameter to pass to the callback routine | 41 | * @cb_param: parameter to pass to the callback routine |
diff --git a/crypto/async_tx/async_memset.c b/crypto/async_tx/async_memset.c index 5b5eb99bb244..b2f133885b7f 100644 --- a/crypto/async_tx/async_memset.c +++ b/crypto/async_tx/async_memset.c | |||
@@ -35,7 +35,7 @@ | |||
35 | * @val: fill value | 35 | * @val: fill value |
36 | * @offset: offset in pages to start transaction | 36 | * @offset: offset in pages to start transaction |
37 | * @len: length in bytes | 37 | * @len: length in bytes |
38 | * @flags: ASYNC_TX_ACK, ASYNC_TX_DEP_ACK | 38 | * @flags: ASYNC_TX_ACK |
39 | * @depend_tx: memset depends on the result of this transaction | 39 | * @depend_tx: memset depends on the result of this transaction |
40 | * @cb_fn: function to call when the memcpy completes | 40 | * @cb_fn: function to call when the memcpy completes |
41 | * @cb_param: parameter to pass to the callback routine | 41 | * @cb_param: parameter to pass to the callback routine |
diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c index 06eb6cc09fef..3766bc3d7d89 100644 --- a/crypto/async_tx/async_tx.c +++ b/crypto/async_tx/async_tx.c | |||
@@ -223,7 +223,7 @@ async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, | |||
223 | if (flags & ASYNC_TX_ACK) | 223 | if (flags & ASYNC_TX_ACK) |
224 | async_tx_ack(tx); | 224 | async_tx_ack(tx); |
225 | 225 | ||
226 | if (depend_tx && (flags & ASYNC_TX_DEP_ACK)) | 226 | if (depend_tx) |
227 | async_tx_ack(depend_tx); | 227 | async_tx_ack(depend_tx); |
228 | } | 228 | } |
229 | EXPORT_SYMBOL_GPL(async_tx_submit); | 229 | EXPORT_SYMBOL_GPL(async_tx_submit); |
@@ -231,7 +231,7 @@ EXPORT_SYMBOL_GPL(async_tx_submit); | |||
231 | /** | 231 | /** |
232 | * async_trigger_callback - schedules the callback function to be run after | 232 | * async_trigger_callback - schedules the callback function to be run after |
233 | * any dependent operations have been completed. | 233 | * any dependent operations have been completed. |
234 | * @flags: ASYNC_TX_ACK, ASYNC_TX_DEP_ACK | 234 | * @flags: ASYNC_TX_ACK |
235 | * @depend_tx: 'callback' requires the completion of this transaction | 235 | * @depend_tx: 'callback' requires the completion of this transaction |
236 | * @cb_fn: function to call after depend_tx completes | 236 | * @cb_fn: function to call after depend_tx completes |
237 | * @cb_param: parameter to pass to the callback routine | 237 | * @cb_param: parameter to pass to the callback routine |
diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c index e0580b0ea533..3cc5dc763b54 100644 --- a/crypto/async_tx/async_xor.c +++ b/crypto/async_tx/async_xor.c | |||
@@ -105,7 +105,6 @@ do_async_xor(struct dma_chan *chan, struct page *dest, struct page **src_list, | |||
105 | _cb_param); | 105 | _cb_param); |
106 | 106 | ||
107 | depend_tx = tx; | 107 | depend_tx = tx; |
108 | flags |= ASYNC_TX_DEP_ACK; | ||
109 | 108 | ||
110 | if (src_cnt > xor_src_cnt) { | 109 | if (src_cnt > xor_src_cnt) { |
111 | /* drop completed sources */ | 110 | /* drop completed sources */ |
@@ -168,8 +167,7 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset, | |||
168 | * @offset: offset in pages to start transaction | 167 | * @offset: offset in pages to start transaction |
169 | * @src_cnt: number of source pages | 168 | * @src_cnt: number of source pages |
170 | * @len: length in bytes | 169 | * @len: length in bytes |
171 | * @flags: ASYNC_TX_XOR_ZERO_DST, ASYNC_TX_XOR_DROP_DEST, | 170 | * @flags: ASYNC_TX_XOR_ZERO_DST, ASYNC_TX_XOR_DROP_DEST, ASYNC_TX_ACK |
172 | * ASYNC_TX_ACK, ASYNC_TX_DEP_ACK | ||
173 | * @depend_tx: xor depends on the result of this transaction. | 171 | * @depend_tx: xor depends on the result of this transaction. |
174 | * @cb_fn: function to call when the xor completes | 172 | * @cb_fn: function to call when the xor completes |
175 | * @cb_param: parameter to pass to the callback routine | 173 | * @cb_param: parameter to pass to the callback routine |
@@ -230,7 +228,7 @@ static int page_is_zero(struct page *p, unsigned int offset, size_t len) | |||
230 | * @src_cnt: number of source pages | 228 | * @src_cnt: number of source pages |
231 | * @len: length in bytes | 229 | * @len: length in bytes |
232 | * @result: 0 if sum == 0 else non-zero | 230 | * @result: 0 if sum == 0 else non-zero |
233 | * @flags: ASYNC_TX_ACK, ASYNC_TX_DEP_ACK | 231 | * @flags: ASYNC_TX_ACK |
234 | * @depend_tx: xor depends on the result of this transaction. | 232 | * @depend_tx: xor depends on the result of this transaction. |
235 | * @cb_fn: function to call when the xor completes | 233 | * @cb_fn: function to call when the xor completes |
236 | * @cb_param: parameter to pass to the callback routine | 234 | * @cb_param: parameter to pass to the callback routine |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index f8d2d35ed298..0ef5362c8d02 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -525,14 +525,12 @@ async_copy_data(int frombio, struct bio *bio, struct page *page, | |||
525 | bio_page = bio_iovec_idx(bio, i)->bv_page; | 525 | bio_page = bio_iovec_idx(bio, i)->bv_page; |
526 | if (frombio) | 526 | if (frombio) |
527 | tx = async_memcpy(page, bio_page, page_offset, | 527 | tx = async_memcpy(page, bio_page, page_offset, |
528 | b_offset, clen, | 528 | b_offset, clen, 0, |
529 | ASYNC_TX_DEP_ACK, | 529 | tx, NULL, NULL); |
530 | tx, NULL, NULL); | ||
531 | else | 530 | else |
532 | tx = async_memcpy(bio_page, page, b_offset, | 531 | tx = async_memcpy(bio_page, page, b_offset, |
533 | page_offset, clen, | 532 | page_offset, clen, 0, |
534 | ASYNC_TX_DEP_ACK, | 533 | tx, NULL, NULL); |
535 | tx, NULL, NULL); | ||
536 | } | 534 | } |
537 | if (clen < len) /* hit end of page */ | 535 | if (clen < len) /* hit end of page */ |
538 | break; | 536 | break; |
@@ -615,8 +613,7 @@ static void ops_run_biofill(struct stripe_head *sh) | |||
615 | } | 613 | } |
616 | 614 | ||
617 | atomic_inc(&sh->count); | 615 | atomic_inc(&sh->count); |
618 | async_trigger_callback(ASYNC_TX_DEP_ACK | ASYNC_TX_ACK, tx, | 616 | async_trigger_callback(ASYNC_TX_ACK, tx, ops_complete_biofill, sh); |
619 | ops_complete_biofill, sh); | ||
620 | } | 617 | } |
621 | 618 | ||
622 | static void ops_complete_compute5(void *stripe_head_ref) | 619 | static void ops_complete_compute5(void *stripe_head_ref) |
@@ -701,8 +698,8 @@ ops_run_prexor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
701 | } | 698 | } |
702 | 699 | ||
703 | tx = async_xor(xor_dest, xor_srcs, 0, count, STRIPE_SIZE, | 700 | tx = async_xor(xor_dest, xor_srcs, 0, count, STRIPE_SIZE, |
704 | ASYNC_TX_DEP_ACK | ASYNC_TX_XOR_DROP_DST, tx, | 701 | ASYNC_TX_XOR_DROP_DST, tx, |
705 | ops_complete_prexor, sh); | 702 | ops_complete_prexor, sh); |
706 | 703 | ||
707 | return tx; | 704 | return tx; |
708 | } | 705 | } |
@@ -809,7 +806,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
809 | * set ASYNC_TX_XOR_DROP_DST and ASYNC_TX_XOR_ZERO_DST | 806 | * set ASYNC_TX_XOR_DROP_DST and ASYNC_TX_XOR_ZERO_DST |
810 | * for the synchronous xor case | 807 | * for the synchronous xor case |
811 | */ | 808 | */ |
812 | flags = ASYNC_TX_DEP_ACK | ASYNC_TX_ACK | | 809 | flags = ASYNC_TX_ACK | |
813 | (prexor ? ASYNC_TX_XOR_DROP_DST : ASYNC_TX_XOR_ZERO_DST); | 810 | (prexor ? ASYNC_TX_XOR_DROP_DST : ASYNC_TX_XOR_ZERO_DST); |
814 | 811 | ||
815 | atomic_inc(&sh->count); | 812 | atomic_inc(&sh->count); |
@@ -858,7 +855,7 @@ static void ops_run_check(struct stripe_head *sh) | |||
858 | &sh->ops.zero_sum_result, 0, NULL, NULL, NULL); | 855 | &sh->ops.zero_sum_result, 0, NULL, NULL, NULL); |
859 | 856 | ||
860 | atomic_inc(&sh->count); | 857 | atomic_inc(&sh->count); |
861 | tx = async_trigger_callback(ASYNC_TX_DEP_ACK | ASYNC_TX_ACK, tx, | 858 | tx = async_trigger_callback(ASYNC_TX_ACK, tx, |
862 | ops_complete_check, sh); | 859 | ops_complete_check, sh); |
863 | } | 860 | } |
864 | 861 | ||
@@ -2687,8 +2684,8 @@ static void handle_stripe_expansion(raid5_conf_t *conf, struct stripe_head *sh, | |||
2687 | 2684 | ||
2688 | /* place all the copies on one channel */ | 2685 | /* place all the copies on one channel */ |
2689 | tx = async_memcpy(sh2->dev[dd_idx].page, | 2686 | tx = async_memcpy(sh2->dev[dd_idx].page, |
2690 | sh->dev[i].page, 0, 0, STRIPE_SIZE, | 2687 | sh->dev[i].page, 0, 0, STRIPE_SIZE, |
2691 | ASYNC_TX_DEP_ACK, tx, NULL, NULL); | 2688 | 0, tx, NULL, NULL); |
2692 | 2689 | ||
2693 | set_bit(R5_Expanded, &sh2->dev[dd_idx].flags); | 2690 | set_bit(R5_Expanded, &sh2->dev[dd_idx].flags); |
2694 | set_bit(R5_UPTODATE, &sh2->dev[dd_idx].flags); | 2691 | set_bit(R5_UPTODATE, &sh2->dev[dd_idx].flags); |
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h index 513150d8c25b..9f14cd540cd2 100644 --- a/include/linux/async_tx.h +++ b/include/linux/async_tx.h | |||
@@ -58,13 +58,11 @@ struct dma_chan_ref { | |||
58 | * array. | 58 | * array. |
59 | * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a | 59 | * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a |
60 | * dependency chain | 60 | * dependency chain |
61 | * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. | ||
62 | */ | 61 | */ |
63 | enum async_tx_flags { | 62 | enum async_tx_flags { |
64 | ASYNC_TX_XOR_ZERO_DST = (1 << 0), | 63 | ASYNC_TX_XOR_ZERO_DST = (1 << 0), |
65 | ASYNC_TX_XOR_DROP_DST = (1 << 1), | 64 | ASYNC_TX_XOR_DROP_DST = (1 << 1), |
66 | ASYNC_TX_ACK = (1 << 3), | 65 | ASYNC_TX_ACK = (1 << 2), |
67 | ASYNC_TX_DEP_ACK = (1 << 4), | ||
68 | }; | 66 | }; |
69 | 67 | ||
70 | #ifdef CONFIG_DMA_ENGINE | 68 | #ifdef CONFIG_DMA_ENGINE |