Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242909
b: refs/heads/master
c: e99dc36
h: refs/heads/master
i:
  242907: fb20953
v: v3
  • Loading branch information
Lars Ellenberg authored and Philipp Reisner committed Mar 10, 2011
1 parent 1b2a036 commit 7b64ee5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 94 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 10f6d9926cd17afff9dc03c967706419798b4929
refs/heads/master: e99dc367b3aafb1ce2d5d92e94834d07b299e1d7
93 changes: 0 additions & 93 deletions trunk/drivers/block/drbd/drbd_actlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7b64ee5

Please sign in to comment.