/** * lookup_mp_height - helper function for lookup_metapath * @ip: the inode * @mp: the metapath * @h: the height which needs looking up */ static int lookup_mp_height(struct gfs2_inode *ip, struct metapath *mp, int h) { __be64 *ptr = metapointer(h, mp); u64 dblock = be64_to_cpu(*ptr); if (!dblock) return h + 1; return gfs2_meta_indirect_buffer(ip, h + 1, dblock, &mp->mp_bh[h + 1]); }
static int lookup_metapath(struct gfs2_inode *ip, struct metapath *mp) { unsigned int end_of_metadata = ip->i_height - 1; unsigned int x; __be64 *ptr; u64 dblock; int ret; for (x = 0; x < end_of_metadata; x++) { ptr = metapointer(x, mp); dblock = be64_to_cpu(*ptr); if (!dblock) return x + 1; ret = gfs2_meta_indirect_buffer(ip, x+1, dblock, 0, &mp->mp_bh[x+1]); if (ret) return ret; } return ip->i_height; }