Commit ff34dbb0 authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Philipp Reisner

cosmetic: use container_of() instead of explicit type casts from (struct drbd_work*)

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent eb9a85f8
......@@ -291,7 +291,7 @@ void drbd_al_complete_io(struct drbd_conf *mdev, sector_t sector)
int
w_al_write_transaction(struct drbd_conf *mdev, struct drbd_work *w, int unused)
{
struct update_al_work *aw = (struct update_al_work *)w;
struct update_al_work *aw = container_of(w, struct update_al_work, w);
struct lc_element *updated = aw->al_ext;
const unsigned int new_enr = aw->enr;
const unsigned int evicted = aw->old_enr;
......@@ -812,7 +812,7 @@ void drbd_al_shrink(struct drbd_conf *mdev)
static int w_update_odbm(struct drbd_conf *mdev, struct drbd_work *w, int unused)
{
struct update_odbm_work *udw = (struct update_odbm_work *)w;
struct update_odbm_work *udw = container_of(w, struct update_odbm_work, w);
if (!get_ldev(mdev)) {
if (__ratelimit(&drbd_ratelimit_state))
......
......@@ -1184,9 +1184,8 @@ int __drbd_set_state(struct drbd_conf *mdev,
static int w_after_state_ch(struct drbd_conf *mdev, struct drbd_work *w, int unused)
{
struct after_state_chg_work *ascw;
ascw = (struct after_state_chg_work *) w;
struct after_state_chg_work *ascw =
container_of(w, struct after_state_chg_work, w);
after_state_ch(mdev, ascw->os, ascw->ns, ascw->flags);
if (ascw->flags & CS_WAIT_COMPLETE) {
D_ASSERT(ascw->done != NULL);
......@@ -3539,7 +3538,7 @@ int drbd_bmio_clear_n_write(struct drbd_conf *mdev)
static int w_bitmap_io(struct drbd_conf *mdev, struct drbd_work *w, int unused)
{
struct bm_io_work *work = (struct bm_io_work *)w;
struct bm_io_work *work = container_of(w, struct bm_io_work, w);
int rv;
D_ASSERT(atomic_read(&mdev->ap_bio_cnt) == 0);
......
......@@ -256,7 +256,7 @@ void drbd_endio_pri(struct bio *bio, int error)
int w_io_error(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_request *req = (struct drbd_request *)w;
struct drbd_request *req = container_of(w, struct drbd_request, w);
int ok;
/* NOTE: mdev->ldev can be NULL by the time we get here! */
......@@ -274,7 +274,7 @@ int w_io_error(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
int w_read_retry_remote(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_request *req = (struct drbd_request *)w;
struct drbd_request *req = container_of(w, struct drbd_request, w);
/* We should not detach for read io-error,
* but try to WRITE the P_DATA_REPLY to the failed location,
......@@ -324,7 +324,7 @@ void drbd_csum(struct drbd_conf *mdev, struct crypto_hash *tfm, struct bio *bio,
static int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w;
struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w);
int digest_size;
void *digest;
int ok;
......@@ -832,7 +832,7 @@ static void move_to_net_ee_or_free(struct drbd_conf *mdev, struct drbd_epoch_ent
*/
int w_e_end_data_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w;
struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w);
int ok;
if (unlikely(cancel)) {
......@@ -870,7 +870,7 @@ int w_e_end_data_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
*/
int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w;
struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w);
int ok;
if (unlikely(cancel)) {
......@@ -918,7 +918,7 @@ int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w;
struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w);
struct digest_info *di;
int digest_size;
void *digest = NULL;
......@@ -978,7 +978,7 @@ int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w;
struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w);
int digest_size;
void *digest;
int ok = 1;
......@@ -1024,7 +1024,7 @@ void drbd_ov_oos_found(struct drbd_conf *mdev, sector_t sector, int size)
int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w;
struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w);
struct digest_info *di;
int digest_size;
void *digest;
......@@ -1090,7 +1090,7 @@ int w_prev_work_done(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
int w_send_barrier(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_tl_epoch *b = (struct drbd_tl_epoch *)w;
struct drbd_tl_epoch *b = container_of(w, struct drbd_tl_epoch, w);
struct p_barrier *p = &mdev->data.sbuf.barrier;
int ok = 1;
......@@ -1134,7 +1134,7 @@ int w_send_write_hint(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
*/
int w_send_dblock(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_request *req = (struct drbd_request *)w;
struct drbd_request *req = container_of(w, struct drbd_request, w);
int ok;
if (unlikely(cancel)) {
......@@ -1156,7 +1156,7 @@ int w_send_dblock(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
*/
int w_send_read_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{
struct drbd_request *req = (struct drbd_request *)w;
struct drbd_request *req = container_of(w, struct drbd_request, w);
int ok;
if (unlikely(cancel)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment