Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
block: fix mis-synchronisation in blkdev_issue_zeroout()

+7 -12
+7 -12
block/blk-lib.c
··· 109 109 atomic_t done; 110 110 unsigned long flags; 111 111 struct completion *wait; 112 - bio_end_io_t *end_io; 113 112 }; 114 113 115 114 static void bio_batch_end_io(struct bio *bio, int err) ··· 121 122 else 122 123 clear_bit(BIO_UPTODATE, &bb->flags); 123 124 } 124 - if (bb) { 125 - if (bb->end_io) 126 - bb->end_io(bio, err); 127 - atomic_inc(&bb->done); 128 - complete(bb->wait); 129 - } 125 + if (bb) 126 + if (atomic_dec_and_test(&bb->done)) 127 + complete(bb->wait); 130 128 bio_put(bio); 131 129 } 132 130 ··· 146 150 int ret; 147 151 struct bio *bio; 148 152 struct bio_batch bb; 149 - unsigned int sz, issued = 0; 153 + unsigned int sz; 150 154 DECLARE_COMPLETION_ONSTACK(wait); 151 155 152 - atomic_set(&bb.done, 0); 156 + atomic_set(&bb.done, 1); 153 157 bb.flags = 1 << BIO_UPTODATE; 154 158 bb.wait = &wait; 155 - bb.end_io = NULL; 156 159 157 160 submit: 158 161 ret = 0; ··· 180 185 break; 181 186 } 182 187 ret = 0; 183 - issued++; 188 + atomic_inc(&bb.done); 184 189 submit_bio(WRITE, bio); 185 190 } 186 191 187 192 /* Wait for bios in-flight */ 188 - while (issued != atomic_read(&bb.done)) 193 + if (!atomic_dec_and_test(&bb.done)) 189 194 wait_for_completion(&wait); 190 195 191 196 if (!test_bit(BIO_UPTODATE, &bb.flags))