Commit 579b57ed authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: Magic reserved block_id value cleanup

The ID_VACANT definition has become entirely irrelevant by now.

The is_syncer_block_id() macro does not improve the code, so eliminated
it.
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent e7fad8af
...@@ -87,17 +87,10 @@ extern char usermode_helper[]; ...@@ -87,17 +87,10 @@ extern char usermode_helper[];
*/ */
#define DRBD_SIGKILL SIGHUP #define DRBD_SIGKILL SIGHUP
/* All EEs on the free list should have ID_VACANT (== 0)
* freshly allocated EEs get !ID_VACANT (== 1)
* so if it says "cannot dereference null pointer at address 0x00000001",
* it is most likely one of these :( */
#define ID_IN_SYNC (4711ULL) #define ID_IN_SYNC (4711ULL)
#define ID_OUT_OF_SYNC (4712ULL) #define ID_OUT_OF_SYNC (4712ULL)
#define ID_SYNCER (-1ULL) #define ID_SYNCER (-1ULL)
#define ID_VACANT 0
#define is_syncer_block_id(id) ((id) == ID_SYNCER)
#define UUID_NEW_BM_OFFSET ((u64)0x0001000000000000ULL) #define UUID_NEW_BM_OFFSET ((u64)0x0001000000000000ULL)
struct drbd_conf; struct drbd_conf;
......
...@@ -4308,7 +4308,7 @@ static int got_BlockAck(struct drbd_conf *mdev, struct p_header80 *h) ...@@ -4308,7 +4308,7 @@ static int got_BlockAck(struct drbd_conf *mdev, struct p_header80 *h)
update_peer_seq(mdev, be32_to_cpu(p->seq_num)); update_peer_seq(mdev, be32_to_cpu(p->seq_num));
if (is_syncer_block_id(p->block_id)) { if (p->block_id == ID_SYNCER) {
drbd_set_in_sync(mdev, sector, blksize); drbd_set_in_sync(mdev, sector, blksize);
dec_rs_pending(mdev); dec_rs_pending(mdev);
return true; return true;
...@@ -4349,7 +4349,7 @@ static int got_NegAck(struct drbd_conf *mdev, struct p_header80 *h) ...@@ -4349,7 +4349,7 @@ static int got_NegAck(struct drbd_conf *mdev, struct p_header80 *h)
update_peer_seq(mdev, be32_to_cpu(p->seq_num)); update_peer_seq(mdev, be32_to_cpu(p->seq_num));
if (is_syncer_block_id(p->block_id)) { if (p->block_id == ID_SYNCER) {
dec_rs_pending(mdev); dec_rs_pending(mdev);
drbd_rs_failed_io(mdev, sector, size); drbd_rs_failed_io(mdev, sector, size);
return true; return true;
......
...@@ -85,8 +85,6 @@ void drbd_endio_read_sec_final(struct drbd_epoch_entry *e) __releases(local) ...@@ -85,8 +85,6 @@ void drbd_endio_read_sec_final(struct drbd_epoch_entry *e) __releases(local)
unsigned long flags = 0; unsigned long flags = 0;
struct drbd_conf *mdev = e->mdev; struct drbd_conf *mdev = e->mdev;
D_ASSERT(e->block_id != ID_VACANT);
spin_lock_irqsave(&mdev->req_lock, flags); spin_lock_irqsave(&mdev->req_lock, flags);
mdev->read_cnt += e->size >> 9; mdev->read_cnt += e->size >> 9;
list_del(&e->w.list); list_del(&e->w.list);
...@@ -108,18 +106,16 @@ static void drbd_endio_write_sec_final(struct drbd_epoch_entry *e) __releases(lo ...@@ -108,18 +106,16 @@ static void drbd_endio_write_sec_final(struct drbd_epoch_entry *e) __releases(lo
struct drbd_conf *mdev = e->mdev; struct drbd_conf *mdev = e->mdev;
sector_t e_sector; sector_t e_sector;
int do_wake; int do_wake;
int is_syncer_req; u64 block_id;
int do_al_complete_io; int do_al_complete_io;
D_ASSERT(e->block_id != ID_VACANT);
/* after we moved e to done_ee, /* after we moved e to done_ee,
* we may no longer access it, * we may no longer access it,
* it may be freed/reused already! * it may be freed/reused already!
* (as soon as we release the req_lock) */ * (as soon as we release the req_lock) */
e_sector = e->sector; e_sector = e->sector;
do_al_complete_io = e->flags & EE_CALL_AL_COMPLETE_IO; do_al_complete_io = e->flags & EE_CALL_AL_COMPLETE_IO;
is_syncer_req = is_syncer_block_id(e->block_id); block_id = e->block_id;
spin_lock_irqsave(&mdev->req_lock, flags); spin_lock_irqsave(&mdev->req_lock, flags);
mdev->writ_cnt += e->size >> 9; mdev->writ_cnt += e->size >> 9;
...@@ -131,15 +127,13 @@ static void drbd_endio_write_sec_final(struct drbd_epoch_entry *e) __releases(lo ...@@ -131,15 +127,13 @@ static void drbd_endio_write_sec_final(struct drbd_epoch_entry *e) __releases(lo
* done from "drbd_process_done_ee" within the appropriate w.cb * done from "drbd_process_done_ee" within the appropriate w.cb
* (e_end_block/e_end_resync_block) or from _drbd_clear_done_ee */ * (e_end_block/e_end_resync_block) or from _drbd_clear_done_ee */
do_wake = is_syncer_req do_wake = list_empty(block_id == ID_SYNCER ? &mdev->sync_ee : &mdev->active_ee);
? list_empty(&mdev->sync_ee)
: list_empty(&mdev->active_ee);
if (test_bit(__EE_WAS_ERROR, &e->flags)) if (test_bit(__EE_WAS_ERROR, &e->flags))
__drbd_chk_io_error(mdev, false); __drbd_chk_io_error(mdev, false);
spin_unlock_irqrestore(&mdev->req_lock, flags); spin_unlock_irqrestore(&mdev->req_lock, flags);
if (is_syncer_req) if (block_id == ID_SYNCER)
drbd_rs_complete_io(mdev, e_sector); drbd_rs_complete_io(mdev, e_sector);
if (do_wake) if (do_wake)
......
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