Lines Matching full:factory

6 #include "io-factory.h"
18 * The I/O factory object manages access to index storage, which is a contiguous range of blocks on
21 * The factory holds the open device and is responsible for closing it. The factory has methods to
31 struct io_factory *factory; member
47 struct io_factory *factory; member
57 static void uds_get_io_factory(struct io_factory *factory) in uds_get_io_factory() argument
59 atomic_inc(&factory->ref_count); in uds_get_io_factory()
65 struct io_factory *factory; in uds_make_io_factory() local
67 result = vdo_allocate(1, struct io_factory, __func__, &factory); in uds_make_io_factory()
71 factory->bdev = bdev; in uds_make_io_factory()
72 atomic_set_release(&factory->ref_count, 1); in uds_make_io_factory()
74 *factory_ptr = factory; in uds_make_io_factory()
78 int uds_replace_storage(struct io_factory *factory, struct block_device *bdev) in uds_replace_storage() argument
80 factory->bdev = bdev; in uds_replace_storage()
84 /* Free an I/O factory once all references have been released. */
85 void uds_put_io_factory(struct io_factory *factory) in uds_put_io_factory() argument
87 if (atomic_add_return(-1, &factory->ref_count) <= 0) in uds_put_io_factory()
88 vdo_free(factory); in uds_put_io_factory()
91 size_t uds_get_writable_size(struct io_factory *factory) in uds_get_writable_size() argument
93 return bdev_nr_bytes(factory->bdev); in uds_get_writable_size()
97 int uds_make_bufio(struct io_factory *factory, off_t block_offset, size_t block_size, in uds_make_bufio() argument
102 client = dm_bufio_client_create(factory->bdev, block_size, reserved_buffers, 0, in uds_make_bufio()
131 uds_put_io_factory(reader->factory); in uds_free_buffered_reader()
136 int uds_make_buffered_reader(struct io_factory *factory, off_t offset, u64 block_count, in uds_make_buffered_reader() argument
143 result = uds_make_bufio(factory, offset, UDS_BLOCK_SIZE, 1, &client); in uds_make_buffered_reader()
154 .factory = factory, in uds_make_buffered_reader()
164 uds_get_io_factory(factory); in uds_make_buffered_reader()
274 int uds_make_buffered_writer(struct io_factory *factory, off_t offset, u64 block_count, in uds_make_buffered_writer() argument
281 result = uds_make_bufio(factory, offset, UDS_BLOCK_SIZE, 1, &client); in uds_make_buffered_writer()
292 .factory = factory, in uds_make_buffered_writer()
302 uds_get_io_factory(factory); in uds_make_buffered_writer()
371 uds_put_io_factory(writer->factory); in uds_free_buffered_writer()