Lines Matching refs:bvec
55 static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
145 static inline bool is_partial_io(struct bio_vec *bvec) in is_partial_io() argument
147 return bvec->bv_len != PAGE_SIZE; in is_partial_io()
150 static inline bool is_partial_io(struct bio_vec *bvec) in is_partial_io() argument
180 static void update_position(u32 *index, int *offset, struct bio_vec *bvec) in update_position() argument
182 *index += (*offset + bvec->bv_len) / PAGE_SIZE; in update_position()
183 *offset = (*offset + bvec->bv_len) % PAGE_SIZE; in update_position()
589 static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, in read_from_bdev_async() argument
600 if (!bio_add_page(bio, bvec->bv_page, bvec->bv_len, bvec->bv_offset)) { in read_from_bdev_async()
658 struct bio_vec bvec; in writeback_store() local
660 bvec.bv_page = page; in writeback_store()
661 bvec.bv_len = PAGE_SIZE; in writeback_store()
662 bvec.bv_offset = 0; in writeback_store()
703 if (zram_bvec_read(zram, &bvec, index, 0, NULL)) { in writeback_store()
716 bio_add_page(&bio, bvec.bv_page, bvec.bv_len, in writeback_store()
717 bvec.bv_offset); in writeback_store()
778 struct bio_vec bvec; member
789 read_from_bdev_async(zram, &zw->bvec, entry, bio); in zram_sync_read()
797 static int read_from_bdev_sync(struct zram *zram, struct bio_vec *bvec, in read_from_bdev_sync() argument
802 work.bvec = *bvec; in read_from_bdev_sync()
815 static int read_from_bdev_sync(struct zram *zram, struct bio_vec *bvec, in read_from_bdev_sync() argument
823 static int read_from_bdev(struct zram *zram, struct bio_vec *bvec, in read_from_bdev() argument
828 return read_from_bdev_sync(zram, bvec, entry, parent); in read_from_bdev()
830 return read_from_bdev_async(zram, bvec, entry, parent); in read_from_bdev()
834 static int read_from_bdev(struct zram *zram, struct bio_vec *bvec, in read_from_bdev() argument
1223 struct bio_vec bvec; in __zram_bvec_read() local
1227 bvec.bv_page = page; in __zram_bvec_read()
1228 bvec.bv_len = PAGE_SIZE; in __zram_bvec_read()
1229 bvec.bv_offset = 0; in __zram_bvec_read()
1230 return read_from_bdev(zram, &bvec, in __zram_bvec_read()
1274 static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, in zram_bvec_read() argument
1280 page = bvec->bv_page; in zram_bvec_read()
1281 if (is_partial_io(bvec)) { in zram_bvec_read()
1288 ret = __zram_bvec_read(zram, page, index, bio, is_partial_io(bvec)); in zram_bvec_read()
1292 if (is_partial_io(bvec)) { in zram_bvec_read()
1293 void *dst = kmap_atomic(bvec->bv_page); in zram_bvec_read()
1296 memcpy(dst + bvec->bv_offset, src + offset, bvec->bv_len); in zram_bvec_read()
1301 if (is_partial_io(bvec)) in zram_bvec_read()
1307 static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, in __zram_bvec_write() argument
1316 struct page *page = bvec->bv_page; in __zram_bvec_write()
1423 static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, in zram_bvec_write() argument
1431 vec = *bvec; in zram_bvec_write()
1432 if (is_partial_io(bvec)) { in zram_bvec_write()
1446 src = kmap_atomic(bvec->bv_page); in zram_bvec_write()
1448 memcpy(dst + offset, src + bvec->bv_offset, bvec->bv_len); in zram_bvec_write()
1459 if (is_partial_io(bvec)) in zram_bvec_write()
1507 static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, in zram_bvec_rw() argument
1514 generic_start_io_acct(q, op, bvec->bv_len >> SECTOR_SHIFT, in zram_bvec_rw()
1519 ret = zram_bvec_read(zram, bvec, index, offset, bio); in zram_bvec_rw()
1520 flush_dcache_page(bvec->bv_page); in zram_bvec_rw()
1523 ret = zram_bvec_write(zram, bvec, index, offset, bio); in zram_bvec_rw()
1546 struct bio_vec bvec; in __zram_make_request() local
1563 bio_for_each_segment(bvec, bio, iter) { in __zram_make_request()
1564 struct bio_vec bv = bvec; in __zram_make_request()
1565 unsigned int unwritten = bvec.bv_len; in __zram_make_request()