• Home
  • Raw
  • Download

Lines Matching refs:bm

383 	struct dm_block_manager *bm;  in dm_block_manager_create()  local
385 bm = kmalloc(sizeof(*bm), GFP_KERNEL); in dm_block_manager_create()
386 if (!bm) { in dm_block_manager_create()
391 bm->bufio = dm_bufio_client_create(bdev, block_size, max_held_per_thread, in dm_block_manager_create()
395 if (IS_ERR(bm->bufio)) { in dm_block_manager_create()
396 r = PTR_ERR(bm->bufio); in dm_block_manager_create()
397 kfree(bm); in dm_block_manager_create()
401 bm->read_only = false; in dm_block_manager_create()
403 return bm; in dm_block_manager_create()
410 void dm_block_manager_destroy(struct dm_block_manager *bm) in dm_block_manager_destroy() argument
412 dm_bufio_client_destroy(bm->bufio); in dm_block_manager_destroy()
413 kfree(bm); in dm_block_manager_destroy()
417 unsigned dm_bm_block_size(struct dm_block_manager *bm) in dm_bm_block_size() argument
419 return dm_bufio_get_block_size(bm->bufio); in dm_bm_block_size()
423 dm_block_t dm_bm_nr_blocks(struct dm_block_manager *bm) in dm_bm_nr_blocks() argument
425 return dm_bufio_get_device_size(bm->bufio); in dm_bm_nr_blocks()
428 static int dm_bm_validate_buffer(struct dm_block_manager *bm, in dm_bm_validate_buffer() argument
437 r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio)); in dm_bm_validate_buffer()
455 int dm_bm_read_lock(struct dm_block_manager *bm, dm_block_t b, in dm_bm_read_lock() argument
463 p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result); in dm_bm_read_lock()
477 r = dm_bm_validate_buffer(bm, to_buffer(*result), aux, v); in dm_bm_read_lock()
488 int dm_bm_write_lock(struct dm_block_manager *bm, in dm_bm_write_lock() argument
496 if (dm_bm_is_read_only(bm)) in dm_bm_write_lock()
499 p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result); in dm_bm_write_lock()
513 r = dm_bm_validate_buffer(bm, to_buffer(*result), aux, v); in dm_bm_write_lock()
524 int dm_bm_read_try_lock(struct dm_block_manager *bm, in dm_bm_read_try_lock() argument
532 p = dm_bufio_get(bm->bufio, b, (struct dm_buffer **) result); in dm_bm_read_try_lock()
547 r = dm_bm_validate_buffer(bm, to_buffer(*result), aux, v); in dm_bm_read_try_lock()
557 int dm_bm_write_lock_zero(struct dm_block_manager *bm, in dm_bm_write_lock_zero() argument
565 if (dm_bm_is_read_only(bm)) in dm_bm_write_lock_zero()
568 p = dm_bufio_new(bm->bufio, b, (struct dm_buffer **) result); in dm_bm_write_lock_zero()
572 memset(p, 0, dm_bm_block_size(bm)); in dm_bm_write_lock_zero()
603 int dm_bm_flush(struct dm_block_manager *bm) in dm_bm_flush() argument
605 if (dm_bm_is_read_only(bm)) in dm_bm_flush()
608 return dm_bufio_write_dirty_buffers(bm->bufio); in dm_bm_flush()
612 void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b) in dm_bm_prefetch() argument
614 dm_bufio_prefetch(bm->bufio, b, 1); in dm_bm_prefetch()
617 bool dm_bm_is_read_only(struct dm_block_manager *bm) in dm_bm_is_read_only() argument
619 return (bm ? bm->read_only : true); in dm_bm_is_read_only()
623 void dm_bm_set_read_only(struct dm_block_manager *bm) in dm_bm_set_read_only() argument
625 if (bm) in dm_bm_set_read_only()
626 bm->read_only = true; in dm_bm_set_read_only()
630 void dm_bm_set_read_write(struct dm_block_manager *bm) in dm_bm_set_read_write() argument
632 if (bm) in dm_bm_set_read_write()
633 bm->read_only = false; in dm_bm_set_read_write()