diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-06 16:38:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-06 16:38:33 -0500 |
commit | 2110cf029a67237db572299bb51e0de9e3e3d4dd (patch) | |
tree | 6837ff139a807037f06952c3eb72c3e350bc05c8 /include | |
parent | 1589a3e7777631ff56dd58cd7dcdf275185e62b5 (diff) | |
parent | 1383923d1985cef2bceb8128094fbe5e05de7435 (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block layer updates from Jens Axboe:
"I've got a few bits pending for 3.8 final, that I better get sent out.
It's all been sitting for a while, I consider it safe.
It contains:
- Two bug fixes for mtip32xx, fixing a driver hang and a crash.
- A few-liner protocol error fix for drbd.
- A few fixes for the xen block front/back driver, fixing a potential
data corruption issue.
- A race fix for disk_clear_events(), causing spurious warnings. Out
of the Chrome OS base.
- A deadlock fix for disk_clear_events(), moving it to the a
unfreezable workqueue. Also from the Chrome OS base."
* 'for-linus' of git://git.kernel.dk/linux-block:
drbd: fix potential protocol error and resulting disconnect/reconnect
mtip32xx: fix for crash when the device surprise removed during rebuild
mtip32xx: fix for driver hang after a command timeout
block: prevent race/cleanup
block: remove deadlock in disk_clear_events
xen-blkfront: handle bvecs with partial data
llist/xen-blkfront: implement safe version of llist_for_each_entry
xen-blkback: implement safe iterator for the list of persistent grants
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/llist.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/llist.h b/include/linux/llist.h index a5199f6d0e82..d0ab98f73d38 100644 --- a/include/linux/llist.h +++ b/include/linux/llist.h | |||
@@ -125,6 +125,31 @@ static inline void init_llist_head(struct llist_head *list) | |||
125 | (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) | 125 | (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * llist_for_each_entry_safe - iterate safely against remove over some entries | ||
129 | * of lock-less list of given type. | ||
130 | * @pos: the type * to use as a loop cursor. | ||
131 | * @n: another type * to use as a temporary storage. | ||
132 | * @node: the fist entry of deleted list entries. | ||
133 | * @member: the name of the llist_node with the struct. | ||
134 | * | ||
135 | * In general, some entries of the lock-less list can be traversed | ||
136 | * safely only after being removed from list, so start with an entry | ||
137 | * instead of list head. This variant allows removal of entries | ||
138 | * as we iterate. | ||
139 | * | ||
140 | * If being used on entries deleted from lock-less list directly, the | ||
141 | * traverse order is from the newest to the oldest added entry. If | ||
142 | * you want to traverse from the oldest to the newest, you must | ||
143 | * reverse the order by yourself before traversing. | ||
144 | */ | ||
145 | #define llist_for_each_entry_safe(pos, n, node, member) \ | ||
146 | for ((pos) = llist_entry((node), typeof(*(pos)), member), \ | ||
147 | (n) = (pos)->member.next; \ | ||
148 | &(pos)->member != NULL; \ | ||
149 | (pos) = llist_entry(n, typeof(*(pos)), member), \ | ||
150 | (n) = (&(pos)->member != NULL) ? (pos)->member.next : NULL) | ||
151 | |||
152 | /** | ||
128 | * llist_empty - tests whether a lock-less list is empty | 153 | * llist_empty - tests whether a lock-less list is empty |
129 | * @head: the list to test | 154 | * @head: the list to test |
130 | * | 155 | * |