diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-07-28 15:27:51 +0200 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-02-17 16:50:39 +0100 |
commit | 84b8c06b6591e73250e6ab4834a02a86c8994b91 (patch) | |
tree | ef2be94ac7b57c1042560a9a39d8c84550803b85 /drivers/block/drbd/drbd_actlog.c | |
parent | 8682eae9b4b26d54b9eeac8e17c534197e6d8744 (diff) | |
download | blackbird-op-linux-84b8c06b6591e73250e6ab4834a02a86c8994b91.tar.gz blackbird-op-linux-84b8c06b6591e73250e6ab4834a02a86c8994b91.zip |
drbd: Create a dedicated struct drbd_device_work
drbd_device_work is a work item that has a reference to a device,
while drbd_work is a more generic work item that does not carry
a reference to a device.
All callbacks get a pointer to a drbd_work instance, those callbacks
that expect a drbd_device_work use the container_of macro to get it.
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_actlog.c')
-rw-r--r-- | drivers/block/drbd/drbd_actlog.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index 081ff42602d0..90ae4ba8f9ee 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c @@ -95,11 +95,13 @@ struct __packed al_transaction_on_disk { struct update_odbm_work { struct drbd_work w; + struct drbd_device *device; unsigned int enr; }; struct update_al_work { struct drbd_work w; + struct drbd_device *device; struct completion event; int err; }; @@ -594,7 +596,7 @@ _al_write_transaction(struct drbd_device *device) static int w_al_write_transaction(struct drbd_work *w, int unused) { struct update_al_work *aw = container_of(w, struct update_al_work, w); - struct drbd_device *device = w->device; + struct drbd_device *device = aw->device; int err; err = _al_write_transaction(device); @@ -613,8 +615,9 @@ static int al_write_transaction(struct drbd_device *device, bool delegate) struct update_al_work al_work; init_completion(&al_work.event); al_work.w.cb = w_al_write_transaction; - al_work.w.device = device; - drbd_queue_work_front(&first_peer_device(device)->connection->sender_work, &al_work.w); + al_work.device = device; + drbd_queue_work_front(&first_peer_device(device)->connection->sender_work, + &al_work.w); wait_for_completion(&al_work.event); return al_work.err; } else @@ -684,7 +687,7 @@ int drbd_initialize_al(struct drbd_device *device, void *buffer) static int w_update_odbm(struct drbd_work *w, int unused) { struct update_odbm_work *udw = container_of(w, struct update_odbm_work, w); - struct drbd_device *device = w->device; + struct drbd_device *device = udw->device; struct sib_info sib = { .sib_reason = SIB_SYNC_PROGRESS, }; if (!get_ldev(device)) { @@ -795,8 +798,9 @@ static void drbd_try_clear_on_disk_bm(struct drbd_device *device, sector_t secto if (udw) { udw->enr = ext->lce.lc_number; udw->w.cb = w_update_odbm; - udw->w.device = device; - drbd_queue_work_front(&first_peer_device(device)->connection->sender_work, &udw->w); + udw->device = device; + drbd_queue_work_front(&first_peer_device(device)->connection->sender_work, + &udw->w); } else { drbd_warn(device, "Could not kmalloc an udw\n"); } |