diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2010-08-11 14:42:55 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-10-14 12:38:16 -0400 |
commit | c36c3ced692b38d0cf90a5e6f875be2f9ebbc037 (patch) | |
tree | e8384ed0c80e2ce057006d83944a299445811380 /drivers/block/drbd | |
parent | 85719573dd716bc2ac3e098b44adfed884250bab (diff) |
drbd: let drbd_free_ee implicitly free any digest
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 4 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 7 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index b0cbfa143775..3a941744f069 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -796,12 +796,16 @@ enum { | |||
796 | * if any of those fail, we set this flag atomically | 796 | * if any of those fail, we set this flag atomically |
797 | * from the endio callback */ | 797 | * from the endio callback */ |
798 | __EE_WAS_ERROR, | 798 | __EE_WAS_ERROR, |
799 | |||
800 | /* This ee has a pointer to a digest instead of a block id */ | ||
801 | __EE_HAS_DIGEST, | ||
799 | }; | 802 | }; |
800 | #define EE_CALL_AL_COMPLETE_IO (1<<__EE_CALL_AL_COMPLETE_IO) | 803 | #define EE_CALL_AL_COMPLETE_IO (1<<__EE_CALL_AL_COMPLETE_IO) |
801 | #define EE_MAY_SET_IN_SYNC (1<<__EE_MAY_SET_IN_SYNC) | 804 | #define EE_MAY_SET_IN_SYNC (1<<__EE_MAY_SET_IN_SYNC) |
802 | #define EE_IS_BARRIER (1<<__EE_IS_BARRIER) | 805 | #define EE_IS_BARRIER (1<<__EE_IS_BARRIER) |
803 | #define EE_RESUBMITTED (1<<__EE_RESUBMITTED) | 806 | #define EE_RESUBMITTED (1<<__EE_RESUBMITTED) |
804 | #define EE_WAS_ERROR (1<<__EE_WAS_ERROR) | 807 | #define EE_WAS_ERROR (1<<__EE_WAS_ERROR) |
808 | #define EE_HAS_DIGEST (1<<__EE_HAS_DIGEST) | ||
805 | 809 | ||
806 | /* global flag bits */ | 810 | /* global flag bits */ |
807 | enum { | 811 | enum { |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 0b03e3174f76..2f9320be4906 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -377,6 +377,8 @@ struct drbd_epoch_entry *drbd_alloc_ee(struct drbd_conf *mdev, | |||
377 | 377 | ||
378 | void drbd_free_ee(struct drbd_conf *mdev, struct drbd_epoch_entry *e) | 378 | void drbd_free_ee(struct drbd_conf *mdev, struct drbd_epoch_entry *e) |
379 | { | 379 | { |
380 | if (e->flags & EE_HAS_DIGEST) | ||
381 | kfree(e->digest); | ||
380 | drbd_pp_free(mdev, e->pages); | 382 | drbd_pp_free(mdev, e->pages); |
381 | D_ASSERT(atomic_read(&e->pending_bios) == 0); | 383 | D_ASSERT(atomic_read(&e->pending_bios) == 0); |
382 | D_ASSERT(hlist_unhashed(&e->colision)); | 384 | D_ASSERT(hlist_unhashed(&e->colision)); |
@@ -2094,10 +2096,12 @@ static int receive_DataRequest(struct drbd_conf *mdev, struct p_header *h) | |||
2094 | di->digest_size = digest_size; | 2096 | di->digest_size = digest_size; |
2095 | di->digest = (((char *)di)+sizeof(struct digest_info)); | 2097 | di->digest = (((char *)di)+sizeof(struct digest_info)); |
2096 | 2098 | ||
2099 | e->digest = di; | ||
2100 | e->flags |= EE_HAS_DIGEST; | ||
2101 | |||
2097 | if (drbd_recv(mdev, di->digest, digest_size) != digest_size) | 2102 | if (drbd_recv(mdev, di->digest, digest_size) != digest_size) |
2098 | goto out_free_e; | 2103 | goto out_free_e; |
2099 | 2104 | ||
2100 | e->digest = di; | ||
2101 | if (h->command == P_CSUM_RS_REQUEST) { | 2105 | if (h->command == P_CSUM_RS_REQUEST) { |
2102 | D_ASSERT(mdev->agreed_pro_version >= 89); | 2106 | D_ASSERT(mdev->agreed_pro_version >= 89); |
2103 | e->w.cb = w_e_end_csum_rs_req; | 2107 | e->w.cb = w_e_end_csum_rs_req; |
@@ -2159,7 +2163,6 @@ static int receive_DataRequest(struct drbd_conf *mdev, struct p_header *h) | |||
2159 | return TRUE; | 2163 | return TRUE; |
2160 | 2164 | ||
2161 | out_free_e: | 2165 | out_free_e: |
2162 | kfree(di); | ||
2163 | put_ldev(mdev); | 2166 | put_ldev(mdev); |
2164 | drbd_free_ee(mdev, e); | 2167 | drbd_free_ee(mdev, e); |
2165 | return FALSE; | 2168 | return FALSE; |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index f979e22cc6fb..48452fe83603 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -1052,9 +1052,6 @@ int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | dec_unacked(mdev); | 1054 | dec_unacked(mdev); |
1055 | |||
1056 | kfree(di); | ||
1057 | |||
1058 | move_to_net_ee_or_free(mdev, e); | 1055 | move_to_net_ee_or_free(mdev, e); |
1059 | 1056 | ||
1060 | if (unlikely(!ok)) | 1057 | if (unlikely(!ok)) |
@@ -1145,9 +1142,6 @@ int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1145 | } | 1142 | } |
1146 | 1143 | ||
1147 | dec_unacked(mdev); | 1144 | dec_unacked(mdev); |
1148 | |||
1149 | kfree(di); | ||
1150 | |||
1151 | if (!eq) | 1145 | if (!eq) |
1152 | drbd_ov_oos_found(mdev, e->sector, e->size); | 1146 | drbd_ov_oos_found(mdev, e->sector, e->size); |
1153 | else | 1147 | else |