code/cow_brd.c
static int brd_do_bvec(struct brd_device *brd, struct page *page,
      unsigned int len, unsigned int off, bool is_write,
      sector_t sector)
{
  void *mem;
  int err = 0;

  if (is_write) {
    err = copy_to_brd_setup(brd, sector, len);
    if (err)
      goto out;
  }

  mem = kmap_atomic(page);
  if (!is_write) {
    copy_from_brd(mem + off, brd, sector, len);
    flush_dcache_page(page);
  } else {
    flush_dcache_page(page);
    copy_to_brd(brd, mem + off, sector, len);
  }
  kunmap_atomic(mem);

out:
  return err;
}
/*
 * Process a single bvec of a bio.
 */
Process a single bvec of a bio.
Process a single bvec of a bio .
static int brd_do_bvec(struct brd_device *brd, struct page *page,
      unsigned int len, unsigned int off, bool is_write,
      sector_t sector)
{
  void *mem;
  int err = 0;
  if (is_write) {
    err = copy_to_brd_setup(brd, sector, len);
    if (err)
      goto out;
  }
  mem = kmap_atomic(page);
  if (!is_write) {
    copy_from_brd(mem + off, brd, sector, len);
    flush_dcache_page(page);
  } else {
    flush_dcache_page(page);
    copy_to_brd(brd, mem + off, sector, len);
  }
  kunmap_atomic(mem);
out:
  return err;
}
static int brd_do_bvec ( struct brd_device * brd , struct page * page , unsigned int len , unsigned int off , bool is_write , sector_t sector ) { void * mem ; int err = 0 ; if ( is_write ) { err = copy_to_brd_setup ( brd , sector , len ) ; if ( err ) goto out ; } mem = kmap_atomic ( page ) ; if ( ! is_write ) { copy_from_brd ( mem + off , brd , sector , len ) ; flush_dcache_page ( page ) ; } else { flush_dcache_page ( page ) ; copy_to_brd ( brd , mem + off , sector , len ) ; } kunmap_atomic ( mem ) ; out : return err ; }
Process a single bvec of a bio.
Process a single bvec of a bio .