mirror of https://gitee.com/openkylin/linux.git
drbd: kill dead code
This code became obsolete and unused last December with drbd: bitmap keep track of changes vs on-disk bitmap Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
parent
10f6d9926c
commit
e99dc367b3
|
@ -569,99 +569,6 @@ static void atodb_endio(struct bio *bio, int error)
|
|||
put_ldev(mdev);
|
||||
}
|
||||
|
||||
/* sector to word */
|
||||
#define S2W(s) ((s)<<(BM_EXT_SHIFT-BM_BLOCK_SHIFT-LN2_BPL))
|
||||
|
||||
/* activity log to on disk bitmap -- prepare bio unless that sector
|
||||
* is already covered by previously prepared bios */
|
||||
static int atodb_prepare_unless_covered(struct drbd_conf *mdev,
|
||||
struct bio **bios,
|
||||
unsigned int enr,
|
||||
struct drbd_atodb_wait *wc) __must_hold(local)
|
||||
{
|
||||
struct bio *bio;
|
||||
struct page *page;
|
||||
sector_t on_disk_sector;
|
||||
unsigned int page_offset = PAGE_SIZE;
|
||||
int offset;
|
||||
int i = 0;
|
||||
int err = -ENOMEM;
|
||||
|
||||
/* We always write aligned, full 4k blocks,
|
||||
* so we can ignore the logical_block_size (for now) */
|
||||
enr &= ~7U;
|
||||
on_disk_sector = enr + mdev->ldev->md.md_offset
|
||||
+ mdev->ldev->md.bm_offset;
|
||||
|
||||
D_ASSERT(!(on_disk_sector & 7U));
|
||||
|
||||
/* Check if that enr is already covered by an already created bio.
|
||||
* Caution, bios[] is not NULL terminated,
|
||||
* but only initialized to all NULL.
|
||||
* For completely scattered activity log,
|
||||
* the last invocation iterates over all bios,
|
||||
* and finds the last NULL entry.
|
||||
*/
|
||||
while ((bio = bios[i])) {
|
||||
if (bio->bi_sector == on_disk_sector)
|
||||
return 0;
|
||||
i++;
|
||||
}
|
||||
/* bios[i] == NULL, the next not yet used slot */
|
||||
|
||||
/* GFP_KERNEL, we are not in the write-out path */
|
||||
bio = bio_alloc(GFP_KERNEL, 1);
|
||||
if (bio == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
if (i > 0) {
|
||||
const struct bio_vec *prev_bv = bios[i-1]->bi_io_vec;
|
||||
page_offset = prev_bv->bv_offset + prev_bv->bv_len;
|
||||
page = prev_bv->bv_page;
|
||||
}
|
||||
if (page_offset == PAGE_SIZE) {
|
||||
page = alloc_page(__GFP_HIGHMEM);
|
||||
if (page == NULL)
|
||||
goto out_bio_put;
|
||||
page_offset = 0;
|
||||
} else {
|
||||
get_page(page);
|
||||
}
|
||||
|
||||
offset = S2W(enr);
|
||||
drbd_bm_get_lel(mdev, offset,
|
||||
min_t(size_t, S2W(8), drbd_bm_words(mdev) - offset),
|
||||
kmap(page) + page_offset);
|
||||
kunmap(page);
|
||||
|
||||
bio->bi_private = wc;
|
||||
bio->bi_end_io = atodb_endio;
|
||||
bio->bi_bdev = mdev->ldev->md_bdev;
|
||||
bio->bi_sector = on_disk_sector;
|
||||
|
||||
if (bio_add_page(bio, page, 4096, page_offset) != 4096)
|
||||
goto out_put_page;
|
||||
|
||||
atomic_inc(&wc->count);
|
||||
/* we already know that we may do this...
|
||||
* get_ldev_if_state(mdev,D_ATTACHING);
|
||||
* just get the extra reference, so that the local_cnt reflects
|
||||
* the number of pending IO requests DRBD at its backing device.
|
||||
*/
|
||||
atomic_inc(&mdev->local_cnt);
|
||||
|
||||
bios[i] = bio;
|
||||
|
||||
return 0;
|
||||
|
||||
out_put_page:
|
||||
err = -EINVAL;
|
||||
put_page(page);
|
||||
out_bio_put:
|
||||
bio_put(bio);
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* drbd_al_apply_to_bm() - Sets the bitmap to diry(1) where covered ba active AL extents
|
||||
* @mdev: DRBD device.
|
||||
|
|
Loading…
Reference in New Issue