Lines Matching +full:ip +full:- +full:blocks
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
43 static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length);
46 * gfs2_unstuffer_page - unstuff a stuffed inode into a block cached by a page
47 * @ip: the inode
55 static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh, in gfs2_unstuffer_page() argument
58 struct inode *inode = &ip->i_inode; in gfs2_unstuffer_page()
64 if (dsize > gfs2_max_stuffed_size(ip)) in gfs2_unstuffer_page()
65 dsize = gfs2_max_stuffed_size(ip); in gfs2_unstuffer_page()
67 memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); in gfs2_unstuffer_page()
68 memset(kaddr + dsize, 0, PAGE_SIZE - dsize); in gfs2_unstuffer_page()
74 if (gfs2_is_jdata(ip)) { in gfs2_unstuffer_page()
78 create_empty_buffers(page, BIT(inode->i_blkbits), in gfs2_unstuffer_page()
83 map_bh(bh, inode->i_sb, block); in gfs2_unstuffer_page()
86 gfs2_trans_add_data(ip->i_gl, bh); in gfs2_unstuffer_page()
89 gfs2_ordered_add_inode(ip); in gfs2_unstuffer_page()
95 static int __gfs2_unstuff_inode(struct gfs2_inode *ip, struct page *page) in __gfs2_unstuff_inode() argument
100 int isdir = gfs2_is_dir(ip); in __gfs2_unstuff_inode()
103 error = gfs2_meta_inode_buffer(ip, &dibh); in __gfs2_unstuff_inode()
107 if (i_size_read(&ip->i_inode)) { in __gfs2_unstuff_inode()
112 error = gfs2_alloc_blocks(ip, &block, &n, 0, NULL); in __gfs2_unstuff_inode()
116 gfs2_trans_remove_revoke(GFS2_SB(&ip->i_inode), block, 1); in __gfs2_unstuff_inode()
117 error = gfs2_dir_get_new_buffer(ip, block, &bh); in __gfs2_unstuff_inode()
124 error = gfs2_unstuffer_page(ip, dibh, block, page); in __gfs2_unstuff_inode()
132 gfs2_trans_add_meta(ip->i_gl, dibh); in __gfs2_unstuff_inode()
133 di = (struct gfs2_dinode *)dibh->b_data; in __gfs2_unstuff_inode()
136 if (i_size_read(&ip->i_inode)) { in __gfs2_unstuff_inode()
138 gfs2_add_inode_blocks(&ip->i_inode, 1); in __gfs2_unstuff_inode()
139 di->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode)); in __gfs2_unstuff_inode()
142 ip->i_height = 1; in __gfs2_unstuff_inode()
143 di->di_height = cpu_to_be16(1); in __gfs2_unstuff_inode()
151 * gfs2_unstuff_dinode - Unstuff a dinode when the data has grown too big
152 * @ip: The GFS2 inode to unstuff
160 int gfs2_unstuff_dinode(struct gfs2_inode *ip) in gfs2_unstuff_dinode() argument
162 struct inode *inode = &ip->i_inode; in gfs2_unstuff_dinode()
166 down_write(&ip->i_rw_mutex); in gfs2_unstuff_dinode()
167 page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS); in gfs2_unstuff_dinode()
168 error = -ENOMEM; in gfs2_unstuff_dinode()
171 error = __gfs2_unstuff_inode(ip, page); in gfs2_unstuff_dinode()
175 up_write(&ip->i_rw_mutex); in gfs2_unstuff_dinode()
180 * find_metapath - Find path through the metadata tree
184 * @height: The pre-calculated height of the metadata tree
187 * through the metadata of inode "ip" to get to block "block".
190 * Given: "ip" is a height 3 file, "offset" is 101342453, and this is a
202 * ----------------------------------------
207 * ----------------------------------------
211 * ----------------------------------------
216 * ----------------------------------------
220 * ----------------------------------------
225 * ----------------------------------------
229 * ----------------------------------------
234 * ----------------------------------------
243 mp->mp_fheight = height; in find_metapath()
244 for (i = height; i--;) in find_metapath()
245 mp->mp_list[i] = do_div(block, sdp->sd_inptrs); in find_metapath()
250 if (mp->mp_list[0] == 0) in metapath_branch_start()
256 * metaptr1 - Return the first possible metadata pointer in a metapath buffer
262 struct buffer_head *bh = mp->mp_bh[height]; in metaptr1()
264 return ((__be64 *)(bh->b_data + sizeof(struct gfs2_dinode))); in metaptr1()
265 return ((__be64 *)(bh->b_data + sizeof(struct gfs2_meta_header))); in metaptr1()
269 * metapointer - Return pointer to start of metadata in a buffer
281 return p + mp->mp_list[height]; in metapointer()
286 const struct buffer_head *bh = mp->mp_bh[height]; in metaend()
287 return (const __be64 *)(bh->b_data + bh->b_size); in metaend()
295 for (hgt = 0; hgt < mp->mp_aheight; hgt++) in clone_metapath()
296 get_bh(clone->mp_bh[hgt]); in clone_metapath()
312 rabh->b_end_io = end_buffer_read_sync; in gfs2_metapath_ra()
323 static int __fillup_metapath(struct gfs2_inode *ip, struct metapath *mp, in __fillup_metapath() argument
333 ret = gfs2_meta_buffer(ip, GFS2_METATYPE_IN, dblock, &mp->mp_bh[x + 1]); in __fillup_metapath()
337 mp->mp_aheight = x + 1; in __fillup_metapath()
342 * lookup_metapath - Walk the metadata tree to a specific point
343 * @ip: The inode
347 * hooked onto mp->mp_bh[0] and that the metapath has been initialised
352 * at which it found the unallocated block. Blocks which are found are
353 * added to the mp->mp_bh[] list.
358 static int lookup_metapath(struct gfs2_inode *ip, struct metapath *mp) in lookup_metapath() argument
360 return __fillup_metapath(ip, mp, 0, ip->i_height - 1); in lookup_metapath()
364 * fillup_metapath - fill up buffers for the metadata path to a specific height
365 * @ip: The inode
374 static int fillup_metapath(struct gfs2_inode *ip, struct metapath *mp, int h) in fillup_metapath() argument
381 for (x = h - 1; x > 0; x--) { in fillup_metapath()
382 if (mp->mp_bh[x]) in fillup_metapath()
386 ret = __fillup_metapath(ip, mp, x, h); in fillup_metapath()
389 return mp->mp_aheight - x - 1; in fillup_metapath()
397 for (hgt = mp->mp_fheight - 1; hgt >= 0; hgt--) { in metapath_to_block()
398 if (hgt < mp->mp_aheight) in metapath_to_block()
399 block += mp->mp_list[hgt] * factor; in metapath_to_block()
400 factor *= sdp->sd_inptrs; in metapath_to_block()
410 if (mp->mp_bh[i] == NULL) in release_metapath()
412 brelse(mp->mp_bh[i]); in release_metapath()
413 mp->mp_bh[i] = NULL; in release_metapath()
418 * gfs2_extent_length - Returns length of an extent of blocks
429 const __be64 *end = (__be64 *)(bh->b_data + bh->b_size); in gfs2_extent_length()
442 return ptr - first; in gfs2_extent_length()
448 * gfs2_metadata_walker - walk an indirect block
459 * gfs2_walk_metadata - walk a tree of indirect blocks
462 * @max_len: Maximum number of blocks to walk
472 struct gfs2_inode *ip = GFS2_I(inode);
483 for (hgt = mp->mp_fheight - 1; hgt >= mp->mp_aheight; hgt--) {
484 max_len += mp->mp_list[hgt] * factor;
485 mp->mp_list[hgt] = 0;
486 factor *= sdp->sd_inptrs;
490 u16 start = mp->mp_list[hgt];
496 ptrs = (hgt >= 1 ? sdp->sd_inptrs : sdp->sd_diptrs) - start;
505 BUG_ON(mp->mp_aheight == mp->mp_fheight);
506 ptrs = mp->mp_list[hgt] - start;
514 max_len -= len;
520 brelse(mp->mp_bh[hgt]);
521 mp->mp_bh[hgt] = NULL;
522 mp->mp_list[hgt] = 0;
525 hgt--;
526 factor *= sdp->sd_inptrs;
529 (mp->mp_list[hgt])++;
531 if (mp->mp_list[hgt] >= sdp->sd_inptrs)
534 if (mp->mp_list[hgt] >= sdp->sd_diptrs)
540 ret = fillup_metapath(ip, mp, ip->i_height - 1);
544 for (; ret; ret--)
545 do_div(factor, sdp->sd_inptrs);
546 mp->mp_aheight = hgt + 1;
557 hgt = mp->mp_aheight - 1; in gfs2_hole_walker()
563 mp->mp_list[hgt] += ptr - start; in gfs2_hole_walker()
564 if (mp->mp_aheight == mp->mp_fheight) in gfs2_hole_walker()
573 * gfs2_hole_size - figure out the size of a hole
576 * @len: How far to look (in blocks)
597 hole_size = metapath_to_block(GFS2_SB(inode), &clone) - lblock; in gfs2_hole_size()
600 iomap->length = hole_size << inode->i_blkbits; in gfs2_hole_size()
612 __be64 *ptr = (__be64 *)(mp->mp_bh[i - 1]->b_data + in gfs2_indirect_init()
616 BUG_ON(mp->mp_bh[i] != NULL); in gfs2_indirect_init()
617 mp->mp_bh[i] = gfs2_meta_new(gl, bn); in gfs2_indirect_init()
618 gfs2_trans_add_meta(gl, mp->mp_bh[i]); in gfs2_indirect_init()
619 gfs2_metatype_set(mp->mp_bh[i], GFS2_METATYPE_IN, GFS2_FORMAT_IN); in gfs2_indirect_init()
620 gfs2_buffer_clear_tail(mp->mp_bh[i], sizeof(struct gfs2_meta_header)); in gfs2_indirect_init()
633 * __gfs2_iomap_alloc - Build a metadata tree of the requested height
639 * i) Indirect blocks to grow the metadata tree height
640 * ii) Indirect blocks to fill in lower part of the metadata tree
641 * iii) Data blocks
644 * total number of blocks which we need via gfs2_alloc_size.
647 * enough contiguous free blocks are available, there will only be one
649 * the blocks in order.
652 * worth of data -- with a default block size of 4K, that's slightly
656 * iomap iteration would then find the blocks already allocated.
664 struct gfs2_inode *ip = GFS2_I(inode); in __gfs2_iomap_alloc() local
666 struct buffer_head *dibh = mp->mp_bh[0]; in __gfs2_iomap_alloc()
669 size_t dblks = iomap->length >> inode->i_blkbits; in __gfs2_iomap_alloc()
670 const unsigned end_of_metadata = mp->mp_fheight - 1; in __gfs2_iomap_alloc()
676 BUG_ON(mp->mp_aheight < 1); in __gfs2_iomap_alloc()
680 gfs2_trans_add_meta(ip->i_gl, dibh); in __gfs2_iomap_alloc()
682 down_write(&ip->i_rw_mutex); in __gfs2_iomap_alloc()
684 if (mp->mp_fheight == mp->mp_aheight) { in __gfs2_iomap_alloc()
688 /* Need to allocate indirect blocks */ in __gfs2_iomap_alloc()
689 if (mp->mp_fheight == ip->i_height) { in __gfs2_iomap_alloc()
691 iblks = mp->mp_fheight - mp->mp_aheight; in __gfs2_iomap_alloc()
696 iblks = mp->mp_fheight - ip->i_height; in __gfs2_iomap_alloc()
698 iblks += (mp->mp_fheight - branch_start); in __gfs2_iomap_alloc()
705 i = mp->mp_aheight; in __gfs2_iomap_alloc()
707 n = blks - alloced; in __gfs2_iomap_alloc()
708 ret = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL); in __gfs2_iomap_alloc()
712 if (state != ALLOC_DATA || gfs2_is_jdata(ip)) in __gfs2_iomap_alloc()
718 ptr = (__be64 *)(dibh->b_data + in __gfs2_iomap_alloc()
722 for (; i - 1 < mp->mp_fheight - ip->i_height && n > 0; in __gfs2_iomap_alloc()
723 i++, n--) in __gfs2_iomap_alloc()
724 gfs2_indirect_init(mp, ip->i_gl, i, 0, bn++); in __gfs2_iomap_alloc()
725 if (i - 1 == mp->mp_fheight - ip->i_height) { in __gfs2_iomap_alloc()
726 i--; in __gfs2_iomap_alloc()
727 gfs2_buffer_copy_tail(mp->mp_bh[i], in __gfs2_iomap_alloc()
733 ptr = (__be64 *)(mp->mp_bh[i]->b_data + in __gfs2_iomap_alloc()
737 for(i = branch_start; i < mp->mp_fheight; i++) { in __gfs2_iomap_alloc()
738 if (mp->mp_bh[i] == NULL) in __gfs2_iomap_alloc()
740 brelse(mp->mp_bh[i]); in __gfs2_iomap_alloc()
741 mp->mp_bh[i] = NULL; in __gfs2_iomap_alloc()
749 if (i > 1 && i < mp->mp_fheight) in __gfs2_iomap_alloc()
750 gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[i-1]); in __gfs2_iomap_alloc()
751 for (; i < mp->mp_fheight && n > 0; i++, n--) in __gfs2_iomap_alloc()
752 gfs2_indirect_init(mp, ip->i_gl, i, in __gfs2_iomap_alloc()
753 mp->mp_list[i-1], bn++); in __gfs2_iomap_alloc()
754 if (i == mp->mp_fheight) in __gfs2_iomap_alloc()
758 fallthrough; /* To tree complete, adding data blocks */ in __gfs2_iomap_alloc()
761 BUG_ON(mp->mp_bh[end_of_metadata] == NULL); in __gfs2_iomap_alloc()
762 gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[end_of_metadata]); in __gfs2_iomap_alloc()
765 iomap->addr = bn << inode->i_blkbits; in __gfs2_iomap_alloc()
766 iomap->flags |= IOMAP_F_MERGED | IOMAP_F_NEW; in __gfs2_iomap_alloc()
767 while (n-- > 0) in __gfs2_iomap_alloc()
771 } while (iomap->addr == IOMAP_NULL_ADDR); in __gfs2_iomap_alloc()
773 iomap->type = IOMAP_MAPPED; in __gfs2_iomap_alloc()
774 iomap->length = (u64)dblks << inode->i_blkbits; in __gfs2_iomap_alloc()
775 ip->i_height = mp->mp_fheight; in __gfs2_iomap_alloc()
776 gfs2_add_inode_blocks(&ip->i_inode, alloced); in __gfs2_iomap_alloc()
777 gfs2_dinode_out(ip, dibh->b_data); in __gfs2_iomap_alloc()
779 up_write(&ip->i_rw_mutex); in __gfs2_iomap_alloc()
786 * gfs2_alloc_size - Compute the maximum allocation size
789 * @size: Requested size in blocks
793 * Returns: size in blocks
797 struct gfs2_inode *ip = GFS2_I(inode); in gfs2_alloc_size() local
809 if (gfs2_is_stuffed(ip) || mp->mp_fheight != mp->mp_aheight) { in gfs2_alloc_size()
810 unsigned int maxsize = mp->mp_fheight > 1 ? in gfs2_alloc_size()
811 sdp->sd_inptrs : sdp->sd_diptrs; in gfs2_alloc_size()
812 maxsize -= mp->mp_list[mp->mp_fheight - 1]; in gfs2_alloc_size()
818 first = metapointer(ip->i_height - 1, mp); in gfs2_alloc_size()
819 end = metaend(ip->i_height - 1, mp); in gfs2_alloc_size()
820 if (end - first > size) in gfs2_alloc_size()
826 return ptr - first; in gfs2_alloc_size()
830 * __gfs2_iomap_get - Map blocks from an inode to disk blocks
844 struct gfs2_inode *ip = GFS2_I(inode); in __gfs2_iomap_get() local
857 return -EINVAL; in __gfs2_iomap_get()
859 down_read(&ip->i_rw_mutex); in __gfs2_iomap_get()
861 ret = gfs2_meta_inode_buffer(ip, &dibh); in __gfs2_iomap_get()
864 mp->mp_bh[0] = dibh; in __gfs2_iomap_get()
866 if (gfs2_is_stuffed(ip)) { in __gfs2_iomap_get()
868 loff_t max_size = gfs2_max_stuffed_size(ip); in __gfs2_iomap_get()
872 iomap->length = max_size; in __gfs2_iomap_get()
876 ret = -ENOENT; in __gfs2_iomap_get()
879 iomap->offset = pos; in __gfs2_iomap_get()
880 iomap->length = length; in __gfs2_iomap_get()
884 iomap->length = size; in __gfs2_iomap_get()
886 iomap->addr = (ip->i_no_addr << inode->i_blkbits) + in __gfs2_iomap_get()
888 iomap->type = IOMAP_INLINE; in __gfs2_iomap_get()
889 iomap->inline_data = dibh->b_data + sizeof(struct gfs2_dinode); in __gfs2_iomap_get()
894 lblock = pos >> inode->i_blkbits; in __gfs2_iomap_get()
895 iomap->offset = lblock << inode->i_blkbits; in __gfs2_iomap_get()
896 lblock_stop = (pos + length - 1) >> inode->i_blkbits; in __gfs2_iomap_get()
897 len = lblock_stop - lblock + 1; in __gfs2_iomap_get()
898 iomap->length = len << inode->i_blkbits; in __gfs2_iomap_get()
900 height = ip->i_height; in __gfs2_iomap_get()
901 while ((lblock + 1) * sdp->sd_sb.sb_bsize > sdp->sd_heightsize[height]) in __gfs2_iomap_get()
904 if (height > ip->i_height || gfs2_is_stuffed(ip)) in __gfs2_iomap_get()
907 ret = lookup_metapath(ip, mp); in __gfs2_iomap_get()
911 if (mp->mp_aheight != ip->i_height) in __gfs2_iomap_get()
914 ptr = metapointer(ip->i_height - 1, mp); in __gfs2_iomap_get()
918 bh = mp->mp_bh[ip->i_height - 1]; in __gfs2_iomap_get()
921 iomap->addr = be64_to_cpu(*ptr) << inode->i_blkbits; in __gfs2_iomap_get()
922 iomap->length = len << inode->i_blkbits; in __gfs2_iomap_get()
923 iomap->type = IOMAP_MAPPED; in __gfs2_iomap_get()
924 iomap->flags |= IOMAP_F_MERGED; in __gfs2_iomap_get()
926 iomap->flags |= IOMAP_F_GFS2_BOUNDARY; in __gfs2_iomap_get()
929 iomap->bdev = inode->i_sb->s_bdev; in __gfs2_iomap_get()
931 up_read(&ip->i_rw_mutex); in __gfs2_iomap_get()
937 ret = -ENOENT; in __gfs2_iomap_get()
938 else if (height == ip->i_height) in __gfs2_iomap_get()
941 iomap->length = size - iomap->offset; in __gfs2_iomap_get()
949 alloc_size = len << inode->i_blkbits; in __gfs2_iomap_get()
950 if (alloc_size < iomap->length) in __gfs2_iomap_get()
951 iomap->length = alloc_size; in __gfs2_iomap_get()
953 if (pos < size && height == ip->i_height) in __gfs2_iomap_get()
957 iomap->addr = IOMAP_NULL_ADDR; in __gfs2_iomap_get()
958 iomap->type = IOMAP_HOLE; in __gfs2_iomap_get()
965 unsigned int blockmask = i_blocksize(inode) - 1; in gfs2_iomap_page_prepare()
967 unsigned int blocks; in gfs2_iomap_page_prepare() local
969 blocks = ((pos & blockmask) + len + blockmask) >> inode->i_blkbits; in gfs2_iomap_page_prepare()
970 return gfs2_trans_begin(sdp, RES_DINODE + blocks, 0); in gfs2_iomap_page_prepare()
976 struct gfs2_trans *tr = current->journal_info; in gfs2_iomap_page_done()
977 struct gfs2_inode *ip = GFS2_I(inode); in gfs2_iomap_page_done() local
980 if (page && !gfs2_is_stuffed(ip)) in gfs2_iomap_page_done()
981 gfs2_page_add_databufs(ip, page, offset_in_page(pos), copied); in gfs2_iomap_page_done()
983 if (tr->tr_num_buf_new) in gfs2_iomap_page_done()
999 struct gfs2_inode *ip = GFS2_I(inode); in gfs2_iomap_begin_write() local
1004 unstuff = gfs2_is_stuffed(ip) && in gfs2_iomap_begin_write()
1005 pos + length > gfs2_max_stuffed_size(ip); in gfs2_iomap_begin_write()
1007 if (unstuff || iomap->type == IOMAP_HOLE) { in gfs2_iomap_begin_write()
1013 gfs2_write_calc_reserv(ip, iomap->length, &data_blocks, in gfs2_iomap_begin_write()
1016 ret = gfs2_quota_lock_check(ip, &ap); in gfs2_iomap_begin_write()
1020 ret = gfs2_inplace_reserve(ip, &ap); in gfs2_iomap_begin_write()
1025 if (gfs2_is_jdata(ip)) in gfs2_iomap_begin_write()
1029 if (inode == sdp->sd_rindex) in gfs2_iomap_begin_write()
1031 rblocks += gfs2_rg_blocks(ip, data_blocks + ind_blocks); in gfs2_iomap_begin_write()
1034 iomap->length >> inode->i_blkbits); in gfs2_iomap_begin_write()
1039 ret = gfs2_unstuff_dinode(ip); in gfs2_iomap_begin_write()
1043 ret = __gfs2_iomap_get(inode, iomap->offset, in gfs2_iomap_begin_write()
1044 iomap->length, flags, iomap, mp); in gfs2_iomap_begin_write()
1049 if (iomap->type == IOMAP_HOLE) { in gfs2_iomap_begin_write()
1053 gfs2_inplace_release(ip); in gfs2_iomap_begin_write()
1054 punch_hole(ip, iomap->offset, iomap->length); in gfs2_iomap_begin_write()
1059 tr = current->journal_info; in gfs2_iomap_begin_write()
1060 if (tr->tr_num_buf_new) in gfs2_iomap_begin_write()
1066 if (gfs2_is_stuffed(ip) || gfs2_is_jdata(ip)) in gfs2_iomap_begin_write()
1067 iomap->page_ops = &gfs2_iomap_page_ops; in gfs2_iomap_begin_write()
1073 gfs2_inplace_release(ip); in gfs2_iomap_begin_write()
1075 gfs2_quota_unlock(ip); in gfs2_iomap_begin_write()
1083 struct gfs2_inode *ip = GFS2_I(inode); in gfs2_iomap_begin() local
1087 if (gfs2_is_jdata(ip)) in gfs2_iomap_begin()
1088 iomap->flags |= IOMAP_F_BUFFER_HEAD; in gfs2_iomap_begin()
1090 trace_gfs2_iomap_start(ip, pos, length, flags); in gfs2_iomap_begin()
1102 if (iomap->type != IOMAP_MAPPED) in gfs2_iomap_begin()
1103 ret = -ENOTBLK; in gfs2_iomap_begin()
1108 if (iomap->type == IOMAP_HOLE) in gfs2_iomap_begin()
1119 trace_gfs2_iomap_end(ip, iomap, ret); in gfs2_iomap_begin()
1126 struct gfs2_inode *ip = GFS2_I(inode); in gfs2_iomap_end() local
1135 if (iomap->type == IOMAP_HOLE) in gfs2_iomap_end()
1142 if (!gfs2_is_stuffed(ip)) in gfs2_iomap_end()
1143 gfs2_ordered_add_inode(ip); in gfs2_iomap_end()
1145 if (inode == sdp->sd_rindex) in gfs2_iomap_end()
1148 gfs2_inplace_release(ip); in gfs2_iomap_end()
1150 if (ip->i_qadata && ip->i_qadata->qa_qd_num) in gfs2_iomap_end()
1151 gfs2_quota_unlock(ip); in gfs2_iomap_end()
1153 if (length != written && (iomap->flags & IOMAP_F_NEW)) { in gfs2_iomap_end()
1154 /* Deallocate blocks that were just allocated. */ in gfs2_iomap_end()
1156 loff_t hend = iomap->offset + iomap->length; in gfs2_iomap_end()
1159 truncate_pagecache_range(inode, hstart, hend - 1); in gfs2_iomap_end()
1160 punch_hole(ip, hstart, hend - hstart); in gfs2_iomap_end()
1167 if (iomap->flags & IOMAP_F_SIZE_CHANGED) in gfs2_iomap_end()
1169 set_bit(GLF_DIRTY, &ip->i_gl->gl_flags); in gfs2_iomap_end()
1179 * gfs2_block_map - Map one or more blocks of an inode to a disk block
1183 * @create: True if its ok to alloc blocks to satify the request
1185 * The size of the requested mapping is defined in bh_map->b_size.
1187 * Clears buffer_mapped(bh_map) and leaves bh_map->b_size unchanged
1189 * bh_map->b_size to indicate the size of the mapping when @lblock and
1190 * successive blocks are mapped, up to the requested size.
1194 * blocks were allocated.
1202 struct gfs2_inode *ip = GFS2_I(inode); in gfs2_block_map() local
1203 loff_t pos = (loff_t)lblock << inode->i_blkbits; in gfs2_block_map()
1204 loff_t length = bh_map->b_size; in gfs2_block_map()
1211 trace_gfs2_bmap(ip, bh_map, lblock, create, 1); in gfs2_block_map()
1220 if (iomap.length > bh_map->b_size) { in gfs2_block_map()
1221 iomap.length = bh_map->b_size; in gfs2_block_map()
1225 map_bh(bh_map, inode->i_sb, iomap.addr >> inode->i_blkbits); in gfs2_block_map()
1226 bh_map->b_size = iomap.length; in gfs2_block_map()
1233 trace_gfs2_bmap(ip, bh_map, lblock, create, ret); in gfs2_block_map()
1240 unsigned int blkbits = inode->i_blkbits; in gfs2_get_extent()
1250 return -EIO; in gfs2_get_extent()
1261 unsigned int blkbits = inode->i_blkbits; in gfs2_alloc_extent()
1271 return -EIO; in gfs2_alloc_extent()
1288 BUG_ON(current->journal_info); in gfs2_block_zero_range()
1295 * gfs2_journaled_truncate - Wrapper for truncate_pagecache for jdata files
1308 u64 max_chunk = GFS2_JTRUNC_REVOKES * sdp->sd_vfs->s_blocksize; in gfs2_journaled_truncate()
1316 chunk = oldsize - newsize; in gfs2_journaled_truncate()
1322 chunk = offs + ((chunk - offs) & PAGE_MASK); in gfs2_journaled_truncate()
1324 truncate_pagecache(inode, oldsize - chunk); in gfs2_journaled_truncate()
1325 oldsize -= chunk; in gfs2_journaled_truncate()
1327 tr = current->journal_info; in gfs2_journaled_truncate()
1328 if (!test_bit(TR_TOUCHED, &tr->tr_flags)) in gfs2_journaled_truncate()
1342 struct gfs2_inode *ip = GFS2_I(inode); in trunc_start() local
1345 int journaled = gfs2_is_jdata(ip); in trunc_start()
1346 u64 oldsize = inode->i_size; in trunc_start()
1349 if (!gfs2_is_stuffed(ip)) { in trunc_start()
1351 unsigned int offs = newsize & (blocksize - 1); in trunc_start()
1354 blocksize - offs); in trunc_start()
1366 error = gfs2_meta_inode_buffer(ip, &dibh); in trunc_start()
1370 gfs2_trans_add_meta(ip->i_gl, dibh); in trunc_start()
1372 if (gfs2_is_stuffed(ip)) in trunc_start()
1375 ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG; in trunc_start()
1378 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); in trunc_start()
1379 gfs2_dinode_out(ip, dibh->b_data); in trunc_start()
1388 if (current->journal_info) in trunc_start()
1411 if (!ret && iomap->type == IOMAP_HOLE) in gfs2_iomap_alloc()
1418 * sweep_bh_for_rgrps - find an rgrp in a meta buffer and free blocks therein
1419 * @ip: inode
1425 * @btotal: place to keep count of total blocks freed
1427 * We sweep a metadata buffer (provided by the metapath) for blocks we need to
1434 * if we're interrupted by power-outages.
1437 * *btotal has the total number of blocks freed
1439 static int sweep_bh_for_rgrps(struct gfs2_inode *ip, struct gfs2_holder *rd_gh, in sweep_bh_for_rgrps() argument
1443 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); in sweep_bh_for_rgrps()
1456 rgd = gfs2_glock2rgrp(rd_gh->gh_gl); in sweep_bh_for_rgrps()
1458 gfs2_glock_is_locked_by_me(rd_gh->gh_gl)); in sweep_bh_for_rgrps()
1477 ret = -EIO; in sweep_bh_for_rgrps()
1480 ret = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, in sweep_bh_for_rgrps()
1486 if (gfs2_rs_active(&ip->i_res) && in sweep_bh_for_rgrps()
1487 rgd == ip->i_res.rs_rgd) in sweep_bh_for_rgrps()
1488 gfs2_rs_deltree(&ip->i_res); in sweep_bh_for_rgrps()
1492 actually process all the metadata blocks that relate to in sweep_bh_for_rgrps()
1496 if (current->journal_info == NULL) { in sweep_bh_for_rgrps()
1499 jblocks_rqsted = rgd->rd_length + RES_DINODE + in sweep_bh_for_rgrps()
1501 isize_blks = gfs2_get_inode_blocks(&ip->i_inode); in sweep_bh_for_rgrps()
1502 if (isize_blks > atomic_read(&sdp->sd_log_thresh2)) in sweep_bh_for_rgrps()
1504 atomic_read(&sdp->sd_log_thresh2); in sweep_bh_for_rgrps()
1509 revokes += end - start; in sweep_bh_for_rgrps()
1510 else if (ip->i_depth) in sweep_bh_for_rgrps()
1511 revokes += sdp->sd_inptrs; in sweep_bh_for_rgrps()
1515 down_write(&ip->i_rw_mutex); in sweep_bh_for_rgrps()
1517 /* check if we will exceed the transaction blocks requested */ in sweep_bh_for_rgrps()
1518 tr = current->journal_info; in sweep_bh_for_rgrps()
1519 if (tr->tr_num_buf_new + RES_STATFS + in sweep_bh_for_rgrps()
1520 RES_QUOTA >= atomic_read(&sdp->sd_log_thresh2)) { in sweep_bh_for_rgrps()
1542 gfs2_trans_add_meta(ip->i_gl, bh); in sweep_bh_for_rgrps()
1550 __gfs2_free_blocks(ip, rgd, bstart, (u32)blen, meta); in sweep_bh_for_rgrps()
1552 gfs2_add_inode_blocks(&ip->i_inode, -blen); in sweep_bh_for_rgrps()
1558 __gfs2_free_blocks(ip, rgd, bstart, (u32)blen, meta); in sweep_bh_for_rgrps()
1560 gfs2_add_inode_blocks(&ip->i_inode, -blen); in sweep_bh_for_rgrps()
1563 if (!ret && blks_outside_rgrp) { /* If buffer still has non-zero blocks in sweep_bh_for_rgrps()
1566 if (current->journal_info) { in sweep_bh_for_rgrps()
1569 ret = gfs2_meta_inode_buffer(ip, &dibh); in sweep_bh_for_rgrps()
1575 ip->i_inode.i_mtime = ip->i_inode.i_ctime = in sweep_bh_for_rgrps()
1576 current_time(&ip->i_inode); in sweep_bh_for_rgrps()
1577 gfs2_trans_add_meta(ip->i_gl, dibh); in sweep_bh_for_rgrps()
1578 gfs2_dinode_out(ip, dibh->b_data); in sweep_bh_for_rgrps()
1580 up_write(&ip->i_rw_mutex); in sweep_bh_for_rgrps()
1594 if (memcmp(mp->mp_list, list, h * sizeof(mp->mp_list[0]))) in mp_eq_to_hgt()
1600 * find_nonnull_ptr - find a non-null pointer given a metapath and height
1608 * Returns: true if a non-null pointer was found in the metapath buffer
1615 struct buffer_head *bh = mp->mp_bh[h]; in find_nonnull_ptr()
1619 ptr = first + mp->mp_list[h]; in find_nonnull_ptr()
1620 end = (__be64 *)(bh->b_data + bh->b_size); in find_nonnull_ptr()
1627 if (*ptr) { /* if we have a non-null pointer */ in find_nonnull_ptr()
1628 mp->mp_list[h] = ptr - first; in find_nonnull_ptr()
1631 mp->mp_list[h] = 0; in find_nonnull_ptr()
1652 struct buffer_head *bh = mp->mp_bh[height]; in metapointer_range()
1661 *end = (__be64 *)(bh->b_data + bh->b_size); in metapointer_range()
1680 end = (height > 0) ? sdp->sd_inptrs : sdp->sd_diptrs; in walk_done()
1681 return mp->mp_list[height] >= end; in walk_done()
1685 * punch_hole - deallocate blocks in a file
1686 * @ip: inode to truncate
1691 * function operates in whole blocks (@offset and @length are rounded
1692 * accordingly); partially filled blocks must be cleared otherwise.
1700 static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) in punch_hole() argument
1702 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); in punch_hole()
1703 u64 maxsize = sdp->sd_heightsize[ip->i_height]; in punch_hole()
1707 unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift; in punch_hole()
1708 u64 lblock = (offset + (1 << bsize_shift) - 1) >> bsize_shift; in punch_hole()
1712 unsigned int strip_h = ip->i_height - 1; in punch_hole()
1721 * The starting point lies beyond the allocated meta-data; in punch_hole()
1722 * there are no blocks do deallocate. in punch_hole()
1755 find_metapath(sdp, lend, &mp, ip->i_height); in punch_hole()
1759 for (mp_h = ip->i_height - 1; mp_h > 0; mp_h--) { in punch_hole()
1766 find_metapath(sdp, lblock, &mp, ip->i_height); in punch_hole()
1769 for (mp_h = ip->i_height - 1; mp_h > 0; mp_h--) { in punch_hole()
1775 ret = gfs2_meta_inode_buffer(ip, &dibh); in punch_hole()
1780 ret = lookup_metapath(ip, &mp); in punch_hole()
1784 /* issue read-ahead on metadata */ in punch_hole()
1785 for (mp_h = 0; mp_h < mp.mp_aheight - 1; mp_h++) { in punch_hole()
1788 gfs2_metapath_ra(ip->i_gl, start, end); in punch_hole()
1791 if (mp.mp_aheight == ip->i_height) in punch_hole()
1800 ret = gfs2_quota_hold(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE); in punch_hole()
1815 prev_bnr != bh->b_blocknr)) { in punch_hole()
1818 (unsigned long long)ip->i_no_addr, in punch_hole()
1819 prev_bnr, ip->i_height, strip_h, mp_h); in punch_hole()
1821 prev_bnr = bh->b_blocknr; in punch_hole()
1826 ret = -EIO; in punch_hole()
1839 ret = sweep_bh_for_rgrps(ip, &rd_gh, mp.mp_bh[mp_h], in punch_hole()
1841 mp_h != ip->i_height - 1, in punch_hole()
1866 strip_h--; in punch_hole()
1873 mp_h--; /* search one metadata height down */ in punch_hole()
1879 * next non-null pointer. */ in punch_hole()
1884 /* No more non-null pointers at this height. Back up in punch_hole()
1891 ret = fillup_metapath(ip, &mp, mp_h); in punch_hole()
1895 /* On the first pass, issue read-ahead on metadata. */ in punch_hole()
1896 if (mp.mp_aheight > 1 && strip_h == ip->i_height - 1) { in punch_hole()
1897 unsigned int height = mp.mp_aheight - 1; in punch_hole()
1899 /* No read-ahead for data blocks. */ in punch_hole()
1900 if (mp.mp_aheight - 1 == strip_h) in punch_hole()
1901 height--; in punch_hole()
1903 for (; height >= mp.mp_aheight - ret; height--) { in punch_hole()
1908 gfs2_metapath_ra(ip->i_gl, start, end); in punch_hole()
1913 if (mp.mp_aheight - 1 == strip_h) { in punch_hole()
1917 if (mp.mp_aheight < ip->i_height) /* We have a partial height */ in punch_hole()
1918 mp_h = mp.mp_aheight - 1; in punch_hole()
1920 /* If we find a non-null block pointer, crawl a bit in punch_hole()
1932 if (current->journal_info == NULL) { in punch_hole()
1937 down_write(&ip->i_rw_mutex); in punch_hole()
1940 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid, in punch_hole()
1941 ip->i_inode.i_gid); in punch_hole()
1942 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); in punch_hole()
1943 gfs2_trans_add_meta(ip->i_gl, dibh); in punch_hole()
1944 gfs2_dinode_out(ip, dibh->b_data); in punch_hole()
1945 up_write(&ip->i_rw_mutex); in punch_hole()
1952 if (current->journal_info) { in punch_hole()
1953 up_write(&ip->i_rw_mutex); in punch_hole()
1957 gfs2_quota_unhold(ip); in punch_hole()
1963 static int trunc_end(struct gfs2_inode *ip) in trunc_end() argument
1965 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); in trunc_end()
1973 down_write(&ip->i_rw_mutex); in trunc_end()
1975 error = gfs2_meta_inode_buffer(ip, &dibh); in trunc_end()
1979 if (!i_size_read(&ip->i_inode)) { in trunc_end()
1980 ip->i_height = 0; in trunc_end()
1981 ip->i_goal = ip->i_no_addr; in trunc_end()
1983 gfs2_ordered_del_inode(ip); in trunc_end()
1985 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); in trunc_end()
1986 ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG; in trunc_end()
1988 gfs2_trans_add_meta(ip->i_gl, dibh); in trunc_end()
1989 gfs2_dinode_out(ip, dibh->b_data); in trunc_end()
1993 up_write(&ip->i_rw_mutex); in trunc_end()
1999 * do_shrink - make a file smaller
2011 struct gfs2_inode *ip = GFS2_I(inode); in do_shrink() local
2017 if (gfs2_is_stuffed(ip)) in do_shrink()
2020 error = punch_hole(ip, newsize, 0); in do_shrink()
2022 error = trunc_end(ip); in do_shrink()
2031 ret = do_shrink(inode, inode->i_size); in gfs2_trim_blocks()
2036 * do_grow - Touch and update inode size
2052 * Returns: 0 on success, or -ve on error
2057 struct gfs2_inode *ip = GFS2_I(inode); in do_grow() local
2064 if (gfs2_is_stuffed(ip) && size > gfs2_max_stuffed_size(ip)) { in do_grow()
2065 error = gfs2_quota_lock_check(ip, &ap); in do_grow()
2069 error = gfs2_inplace_reserve(ip, &ap); in do_grow()
2077 gfs2_is_jdata(ip) ? RES_JDATA : 0) + in do_grow()
2078 (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF ? in do_grow()
2084 error = gfs2_unstuff_dinode(ip); in do_grow()
2089 error = gfs2_meta_inode_buffer(ip, &dibh); in do_grow()
2094 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); in do_grow()
2095 gfs2_trans_add_meta(ip->i_gl, dibh); in do_grow()
2096 gfs2_dinode_out(ip, dibh->b_data); in do_grow()
2103 gfs2_inplace_release(ip); in do_grow()
2105 gfs2_quota_unlock(ip); in do_grow()
2111 * gfs2_setattr_size - make a file a given size
2124 struct gfs2_inode *ip = GFS2_I(inode); in gfs2_setattr_size() local
2127 BUG_ON(!S_ISREG(inode->i_mode)); in gfs2_setattr_size()
2135 ret = gfs2_qa_get(ip); in gfs2_setattr_size()
2139 if (newsize >= inode->i_size) { in gfs2_setattr_size()
2146 gfs2_rs_delete(ip); in gfs2_setattr_size()
2147 gfs2_qa_put(ip); in gfs2_setattr_size()
2151 int gfs2_truncatei_resume(struct gfs2_inode *ip) in gfs2_truncatei_resume() argument
2154 error = punch_hole(ip, i_size_read(&ip->i_inode), 0); in gfs2_truncatei_resume()
2156 error = trunc_end(ip); in gfs2_truncatei_resume()
2160 int gfs2_file_dealloc(struct gfs2_inode *ip) in gfs2_file_dealloc() argument
2162 return punch_hole(ip, 0, 0); in gfs2_file_dealloc()
2166 * gfs2_free_journal_extents - Free cached journal bmap info
2175 while(!list_empty(&jd->extent_list)) { in gfs2_free_journal_extents()
2176 jext = list_first_entry(&jd->extent_list, struct gfs2_journal_extent, list); in gfs2_free_journal_extents()
2177 list_del(&jext->list); in gfs2_free_journal_extents()
2183 * gfs2_add_jextent - Add or merge a new extent to extent cache
2187 * @blocks: Size of extent in fs blocks
2189 * Returns: 0 on success or -ENOMEM
2192 static int gfs2_add_jextent(struct gfs2_jdesc *jd, u64 lblock, u64 dblock, u64 blocks) in gfs2_add_jextent() argument
2196 if (!list_empty(&jd->extent_list)) { in gfs2_add_jextent()
2197 jext = list_last_entry(&jd->extent_list, struct gfs2_journal_extent, list); in gfs2_add_jextent()
2198 if ((jext->dblock + jext->blocks) == dblock) { in gfs2_add_jextent()
2199 jext->blocks += blocks; in gfs2_add_jextent()
2206 return -ENOMEM; in gfs2_add_jextent()
2207 jext->dblock = dblock; in gfs2_add_jextent()
2208 jext->lblock = lblock; in gfs2_add_jextent()
2209 jext->blocks = blocks; in gfs2_add_jextent()
2210 list_add_tail(&jext->list, &jd->extent_list); in gfs2_add_jextent()
2211 jd->nr_extents++; in gfs2_add_jextent()
2216 * gfs2_map_journal_extents - Cache journal bmap info
2221 * blocks to all physical blocks for the given journal. This will save
2222 * us time when writing journal blocks. Most journals will have only one
2223 * extent that maps all their logical blocks. That's because gfs2.mkfs
2224 * arranges the journal blocks sequentially to maximize performance.
2239 struct gfs2_inode *ip = GFS2_I(jd->jd_inode); in gfs2_map_journal_extents() local
2241 unsigned int shift = sdp->sd_sb.sb_bsize_shift; in gfs2_map_journal_extents()
2247 lblock_stop = i_size_read(jd->jd_inode) >> shift; in gfs2_map_journal_extents()
2248 size = (lblock_stop - lblock) << shift; in gfs2_map_journal_extents()
2249 jd->nr_extents = 0; in gfs2_map_journal_extents()
2250 WARN_ON(!list_empty(&jd->extent_list)); in gfs2_map_journal_extents()
2256 rc = gfs2_block_map(jd->jd_inode, lblock, &bh, 0); in gfs2_map_journal_extents()
2262 size -= bh.b_size; in gfs2_map_journal_extents()
2263 lblock += (bh.b_size >> ip->i_inode.i_blkbits); in gfs2_map_journal_extents()
2267 fs_info(sdp, "journal %d mapped with %u extents in %lldms\n", jd->jd_jid, in gfs2_map_journal_extents()
2268 jd->nr_extents, ktime_ms_delta(end, start)); in gfs2_map_journal_extents()
2273 rc, jd->jd_jid, in gfs2_map_journal_extents()
2274 (unsigned long long)(i_size_read(jd->jd_inode) - size), in gfs2_map_journal_extents()
2275 jd->nr_extents); in gfs2_map_journal_extents()
2284 * gfs2_write_alloc_required - figure out if a write will require an allocation
2285 * @ip: the file being written to
2292 int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset, in gfs2_write_alloc_required() argument
2295 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); in gfs2_write_alloc_required()
2304 if (gfs2_is_stuffed(ip)) { in gfs2_write_alloc_required()
2305 if (offset + len > gfs2_max_stuffed_size(ip)) in gfs2_write_alloc_required()
2310 shift = sdp->sd_sb.sb_bsize_shift; in gfs2_write_alloc_required()
2311 BUG_ON(gfs2_is_dir(ip)); in gfs2_write_alloc_required()
2312 end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift; in gfs2_write_alloc_required()
2314 lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift; in gfs2_write_alloc_required()
2315 if (lblock_stop > end_of_file && ip != GFS2_I(sdp->sd_rindex)) in gfs2_write_alloc_required()
2318 size = (lblock_stop - lblock) << shift; in gfs2_write_alloc_required()
2322 gfs2_block_map(&ip->i_inode, lblock, &bh, 0); in gfs2_write_alloc_required()
2325 size -= bh.b_size; in gfs2_write_alloc_required()
2326 lblock += (bh.b_size >> ip->i_inode.i_blkbits); in gfs2_write_alloc_required()
2334 struct gfs2_inode *ip = GFS2_I(inode); in stuffed_zero_range() local
2338 if (offset >= inode->i_size) in stuffed_zero_range()
2340 if (offset + length > inode->i_size) in stuffed_zero_range()
2341 length = inode->i_size - offset; in stuffed_zero_range()
2343 error = gfs2_meta_inode_buffer(ip, &dibh); in stuffed_zero_range()
2346 gfs2_trans_add_meta(ip->i_gl, dibh); in stuffed_zero_range()
2347 memset(dibh->b_data + sizeof(struct gfs2_dinode) + offset, 0, in stuffed_zero_range()
2357 loff_t max_chunk = GFS2_JTRUNC_REVOKES * sdp->sd_vfs->s_blocksize; in gfs2_journaled_truncate_range()
2371 chunk = offs + ((chunk - offs) & PAGE_MASK); in gfs2_journaled_truncate_range()
2375 length -= chunk; in gfs2_journaled_truncate_range()
2377 tr = current->journal_info; in gfs2_journaled_truncate_range()
2378 if (!test_bit(TR_TOUCHED, &tr->tr_flags)) in gfs2_journaled_truncate_range()
2392 struct gfs2_inode *ip = GFS2_I(inode); in __gfs2_punch_hole() local
2398 if (!gfs2_is_stuffed(ip)) { in __gfs2_punch_hole()
2401 start_off = offset & (blocksize - 1); in __gfs2_punch_hole()
2402 end_len = (offset + length) & (blocksize - 1); in __gfs2_punch_hole()
2405 if (length > blocksize - start_off) in __gfs2_punch_hole()
2406 len = blocksize - start_off; in __gfs2_punch_hole()
2415 offset + length - end_len, end_len); in __gfs2_punch_hole()
2422 end = round_up(offset + length, blocksize) - 1; in __gfs2_punch_hole()
2423 error = filemap_write_and_wait_range(inode->i_mapping, start, end); in __gfs2_punch_hole()
2427 if (gfs2_is_jdata(ip)) in __gfs2_punch_hole()
2435 if (gfs2_is_stuffed(ip)) { in __gfs2_punch_hole()
2441 if (gfs2_is_jdata(ip)) { in __gfs2_punch_hole()
2442 BUG_ON(!current->journal_info); in __gfs2_punch_hole()
2445 truncate_pagecache_range(inode, offset, offset + length - 1); in __gfs2_punch_hole()
2450 if (current->journal_info) in __gfs2_punch_hole()
2453 if (!gfs2_is_stuffed(ip)) in __gfs2_punch_hole()
2454 error = punch_hole(ip, offset, length); in __gfs2_punch_hole()
2457 if (current->journal_info) in __gfs2_punch_hole()
2468 return -EIO; in gfs2_map_blocks()
2470 if (offset >= wpc->iomap.offset && in gfs2_map_blocks()
2471 offset < wpc->iomap.offset + wpc->iomap.length) in gfs2_map_blocks()
2474 memset(&wpc->iomap, 0, sizeof(wpc->iomap)); in gfs2_map_blocks()
2475 ret = gfs2_iomap_get(inode, offset, INT_MAX, &wpc->iomap); in gfs2_map_blocks()