diff options
author | Fedor Uporov <fsu@FreeBSD.org> | 2017-10-17 20:45:44 +0000 |
---|---|---|
committer | Fedor Uporov <fsu@FreeBSD.org> | 2017-10-17 20:45:44 +0000 |
commit | b394cd1e28f1a094742434474ebe4f5004bf0ce3 (patch) | |
tree | 4a903d2c90a5b6b6660009ceba227c563b50628b /sys/fs/ext2fs/ext2_subr.c | |
parent | b541ba195ccc4806d94348fa328d620e3261c05a (diff) | |
download | src-b394cd1e28f1a094742434474ebe4f5004bf0ce3.tar.gz src-b394cd1e28f1a094742434474ebe4f5004bf0ce3.zip |
Add inital extents read-write support.
Approved by: pfg (mentor)
MFC after: 6 months
RelNotes: Yes
Differential Revision: https://reviews.freebsd.org/D12087
Notes
Notes:
svn path=/head/; revision=324706
Diffstat (limited to 'sys/fs/ext2fs/ext2_subr.c')
-rw-r--r-- | sys/fs/ext2fs/ext2_subr.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/sys/fs/ext2fs/ext2_subr.c b/sys/fs/ext2fs/ext2_subr.c index a481b9985b8f..f058a3d4f1a0 100644 --- a/sys/fs/ext2fs/ext2_subr.c +++ b/sys/fs/ext2fs/ext2_subr.c @@ -66,63 +66,22 @@ ext2_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) struct m_ext2fs *fs; struct buf *bp; e2fs_lbn_t lbn; - int bsize, error; - daddr_t newblk; - struct ext4_extent *ep; - struct ext4_extent_path path; + int error, bsize; ip = VTOI(vp); fs = ip->i_e2fs; lbn = lblkno(fs, offset); bsize = blksize(fs, ip, lbn); - *bpp = NULL; - /* - * IN_E4EXTENTS requires special treatment as we can otherwise fall - * back to the normal path. - */ - if (!(ip->i_flag & IN_E4EXTENTS)) - goto normal; - - memset(&path, 0, sizeof(path)); - if (ext4_ext_find_extent(fs, ip, lbn, &path) == NULL) - goto normal; - ep = path.ep_ext; - if (ep == NULL) - goto normal; - - newblk = lbn - ep->e_blk + - (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32); - - if (path.ep_bp != NULL) { - brelse(path.ep_bp); - path.ep_bp = NULL; - } - error = bread(ip->i_devvp, fsbtodb(fs, newblk), bsize, NOCRED, &bp); - if (error != 0) { + if ((error = bread(vp, lbn, bsize, NOCRED, &bp)) != 0) { brelse(bp); return (error); } if (res) *res = (char *)bp->b_data + blkoff(fs, offset); - /* - * If IN_E4EXTENTS is enabled we would get a wrong offset so - * reset b_offset here. - */ - bp->b_offset = lbn * bsize; + *bpp = bp; - return (0); -normal: - if (*bpp == NULL) { - if ((error = bread(vp, lbn, bsize, NOCRED, &bp)) != 0) { - brelse(bp); - return (error); - } - if (res) - *res = (char *)bp->b_data + blkoff(fs, offset); - *bpp = bp; - } return (0); } |