Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1719590
| From | Philipp Reisner <philipp.reisner@linbit.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 02/17] drbd: change list_for_each_safe to while(list_first_entry_or_null) |
| Date | 2017-08-24 23:30 +0200 |
| Message-ID | <ui7Ro-3tg-23@gated-at.bofh.it> (permalink) |
| References | <ui7Rn-3tg-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Lars Ellenberg <lars.ellenberg@linbit.com>
Two instances of list_for_each_safe can drop their tmp element, they
really just peel off each element in turn from the start of the list.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 5955ab8..85e05ee 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -1485,12 +1485,12 @@ static bool prepare_al_transaction_nonblock(struct drbd_device *device,
struct list_head *pending,
struct list_head *later)
{
- struct drbd_request *req, *tmp;
+ struct drbd_request *req;
int wake = 0;
int err;
spin_lock_irq(&device->al_lock);
- list_for_each_entry_safe(req, tmp, incoming, tl_requests) {
+ while ((req = list_first_entry_or_null(incoming, struct drbd_request, tl_requests))) {
err = drbd_al_begin_io_nonblock(device, &req->i);
if (err == -ENOBUFS)
break;
@@ -1509,9 +1509,9 @@ static bool prepare_al_transaction_nonblock(struct drbd_device *device,
void send_and_submit_pending(struct drbd_device *device, struct list_head *pending)
{
- struct drbd_request *req, *tmp;
+ struct drbd_request *req;
- list_for_each_entry_safe(req, tmp, pending, tl_requests) {
+ while ((req = list_first_entry_or_null(pending, struct drbd_request, tl_requests))) {
req->rq_state |= RQ_IN_ACT_LOG;
req->in_actlog_jif = jiffies;
atomic_dec(&device->ap_actlog_cnt);
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/17] DRBD updates Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 12/17] drbd: fix potential deadlock when trying to detach during handshake Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 04/17] drbd: Send P_NEG_ACK upon write error in protocol != C Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 03/17] drbd: add explicit plugging when submitting batches Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 05/17] drbd: mark symbols static where possible Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 02/17] drbd: change list_for_each_safe to while(list_first_entry_or_null) Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
Re: [PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Jens Axboe <axboe@kernel.dk> - 2017-08-25 19:30 +0200
Re: [PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-28 15:40 +0200
[PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-28 16:00 +0200
[PATCH 08/17] drbd: fix potential get_ldev/put_ldev refcount imbalance during attach Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 17/17] drbd: switch from kmalloc() to kmalloc_array() Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 07/17] drbd: new disk-option disable-write-same Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 15/17] drbd: move global variables to drbd namespace and make some static Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 16/17] drbd: abort drbd_start_resync if there is no connection Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 13/17] drbd: fix race between handshake and admin disconnect/down Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 10/17] drbd: fix rmmod cleanup, remove _all_ debugfs entries Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
csiph-web