Lines Matching refs:iomap
582 struct metapath *mp, struct iomap *iomap) in gfs2_hole_size() argument
597 iomap->length = hole_size << inode->i_blkbits; in gfs2_hole_size()
658 static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap, in __gfs2_iomap_alloc() argument
666 size_t dblks = iomap->length >> inode->i_blkbits; in __gfs2_iomap_alloc()
762 iomap->addr = bn << inode->i_blkbits; in __gfs2_iomap_alloc()
763 iomap->flags |= IOMAP_F_MERGED | IOMAP_F_NEW; in __gfs2_iomap_alloc()
768 } while (iomap->addr == IOMAP_NULL_ADDR); in __gfs2_iomap_alloc()
770 iomap->type = IOMAP_MAPPED; in __gfs2_iomap_alloc()
771 iomap->length = (u64)dblks << inode->i_blkbits; in __gfs2_iomap_alloc()
838 unsigned flags, struct iomap *iomap, in __gfs2_iomap_get() argument
869 iomap->length = max_size; in __gfs2_iomap_get()
876 iomap->offset = pos; in __gfs2_iomap_get()
877 iomap->length = length; in __gfs2_iomap_get()
881 iomap->length = size; in __gfs2_iomap_get()
883 iomap->addr = (ip->i_no_addr << inode->i_blkbits) + in __gfs2_iomap_get()
885 iomap->type = IOMAP_INLINE; in __gfs2_iomap_get()
886 iomap->inline_data = dibh->b_data + sizeof(struct gfs2_dinode); in __gfs2_iomap_get()
892 iomap->offset = lblock << inode->i_blkbits; in __gfs2_iomap_get()
895 iomap->length = len << inode->i_blkbits; in __gfs2_iomap_get()
918 iomap->addr = be64_to_cpu(*ptr) << inode->i_blkbits; in __gfs2_iomap_get()
919 iomap->length = len << inode->i_blkbits; in __gfs2_iomap_get()
920 iomap->type = IOMAP_MAPPED; in __gfs2_iomap_get()
921 iomap->flags |= IOMAP_F_MERGED; in __gfs2_iomap_get()
923 iomap->flags |= IOMAP_F_GFS2_BOUNDARY; in __gfs2_iomap_get()
926 iomap->bdev = inode->i_sb->s_bdev; in __gfs2_iomap_get()
936 ret = gfs2_hole_size(inode, lblock, len, mp, iomap); in __gfs2_iomap_get()
938 iomap->length = size - iomap->offset; in __gfs2_iomap_get()
947 if (alloc_size < iomap->length) in __gfs2_iomap_get()
948 iomap->length = alloc_size; in __gfs2_iomap_get()
951 ret = gfs2_hole_size(inode, lblock, len, mp, iomap); in __gfs2_iomap_get()
954 iomap->addr = IOMAP_NULL_ADDR; in __gfs2_iomap_get()
955 iomap->type = IOMAP_HOLE; in __gfs2_iomap_get()
993 struct iomap *iomap, in gfs2_iomap_begin_write() argument
1004 if (unstuff || iomap->type == IOMAP_HOLE) { in gfs2_iomap_begin_write()
1010 gfs2_write_calc_reserv(ip, iomap->length, &data_blocks, in gfs2_iomap_begin_write()
1031 iomap->length >> inode->i_blkbits); in gfs2_iomap_begin_write()
1040 ret = __gfs2_iomap_get(inode, iomap->offset, in gfs2_iomap_begin_write()
1041 iomap->length, flags, iomap, mp); in gfs2_iomap_begin_write()
1046 if (iomap->type == IOMAP_HOLE) { in gfs2_iomap_begin_write()
1047 ret = __gfs2_iomap_alloc(inode, iomap, mp); in gfs2_iomap_begin_write()
1051 punch_hole(ip, iomap->offset, iomap->length); in gfs2_iomap_begin_write()
1064 iomap->page_ops = &gfs2_iomap_page_ops; in gfs2_iomap_begin_write()
1077 unsigned flags, struct iomap *iomap, in gfs2_iomap_begin() argument
1078 struct iomap *srcmap) in gfs2_iomap_begin()
1085 iomap->flags |= IOMAP_F_BUFFER_HEAD; in gfs2_iomap_begin()
1088 ret = __gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); in gfs2_iomap_begin()
1099 if (iomap->type != IOMAP_MAPPED) in gfs2_iomap_begin()
1105 if (iomap->type == IOMAP_HOLE) in gfs2_iomap_begin()
1112 ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap, &mp); in gfs2_iomap_begin()
1116 trace_gfs2_iomap_end(ip, iomap, ret); in gfs2_iomap_begin()
1121 ssize_t written, unsigned flags, struct iomap *iomap) in gfs2_iomap_end() argument
1132 if (iomap->type == IOMAP_HOLE) in gfs2_iomap_end()
1150 if (length != written && (iomap->flags & IOMAP_F_NEW)) { in gfs2_iomap_end()
1153 loff_t hend = iomap->offset + iomap->length; in gfs2_iomap_end()
1164 if (iomap->flags & IOMAP_F_SIZE_CHANGED) in gfs2_iomap_end()
1202 struct iomap iomap = { }; in gfs2_block_map() local
1211 ret = gfs2_iomap_get(inode, pos, length, &iomap); in gfs2_block_map()
1213 ret = gfs2_iomap_alloc(inode, pos, length, &iomap); in gfs2_block_map()
1217 if (iomap.length > bh_map->b_size) { in gfs2_block_map()
1218 iomap.length = bh_map->b_size; in gfs2_block_map()
1219 iomap.flags &= ~IOMAP_F_GFS2_BOUNDARY; in gfs2_block_map()
1221 if (iomap.addr != IOMAP_NULL_ADDR) in gfs2_block_map()
1222 map_bh(bh_map, inode->i_sb, iomap.addr >> inode->i_blkbits); in gfs2_block_map()
1223 bh_map->b_size = iomap.length; in gfs2_block_map()
1224 if (iomap.flags & IOMAP_F_GFS2_BOUNDARY) in gfs2_block_map()
1226 if (iomap.flags & IOMAP_F_NEW) in gfs2_block_map()
1238 struct iomap iomap = { }; in gfs2_get_extent() local
1243 &iomap); in gfs2_get_extent()
1246 if (iomap.type != IOMAP_MAPPED) in gfs2_get_extent()
1248 *dblock = iomap.addr >> blkbits; in gfs2_get_extent()
1249 len = iomap.length >> blkbits; in gfs2_get_extent()
1259 struct iomap iomap = { }; in gfs2_alloc_extent() local
1264 &iomap); in gfs2_alloc_extent()
1267 if (iomap.type != IOMAP_MAPPED) in gfs2_alloc_extent()
1269 *dblock = iomap.addr >> blkbits; in gfs2_alloc_extent()
1270 len = iomap.length >> blkbits; in gfs2_alloc_extent()
1273 *new = iomap.flags & IOMAP_F_NEW; in gfs2_alloc_extent()
1391 struct iomap *iomap) in gfs2_iomap_get() argument
1396 ret = __gfs2_iomap_get(inode, pos, length, 0, iomap, &mp); in gfs2_iomap_get()
1402 struct iomap *iomap) in gfs2_iomap_alloc() argument
1407 ret = __gfs2_iomap_get(inode, pos, length, IOMAP_WRITE, iomap, &mp); in gfs2_iomap_alloc()
1408 if (!ret && iomap->type == IOMAP_HOLE) in gfs2_iomap_alloc()
1409 ret = __gfs2_iomap_alloc(inode, iomap, &mp); in gfs2_iomap_alloc()
2467 if (offset >= wpc->iomap.offset && in gfs2_map_blocks()
2468 offset < wpc->iomap.offset + wpc->iomap.length) in gfs2_map_blocks()
2471 memset(&wpc->iomap, 0, sizeof(wpc->iomap)); in gfs2_map_blocks()
2472 ret = gfs2_iomap_get(inode, offset, INT_MAX, &wpc->iomap); in gfs2_map_blocks()