diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2021-04-01 00:17:38 +0300 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2021-04-03 22:38:11 +0300 |
commit | 9153dac13a6966b63183bac450d5cd39b07cc85c (patch) | |
tree | 1ec293a4bb6fc6656e457d855027a10d7ec953c0 /fs/gfs2/dir.c | |
parent | 54992257fe4bb9f76f66b3863492aa8cc5567790 (diff) | |
download | linux-9153dac13a6966b63183bac450d5cd39b07cc85c.tar.xz |
gfs2: Turn gfs2_extent_map into gfs2_{get,alloc}_extent
Convert gfs2_extent_map to iomap and split it into gfs2_get_extent and
gfs2_alloc_extent. Instead of hardcoding the extent size, pass it in
via the extlen parameter.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r-- | fs/gfs2/dir.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index aa467b22183f..18f67b37d6f8 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -159,7 +159,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf, unsigned int o; int copied = 0; int error = 0; - int new = 0; + bool new = false; if (!size) return 0; @@ -189,9 +189,9 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf, amount = sdp->sd_sb.sb_bsize - o; if (!extlen) { - new = 1; - error = gfs2_extent_map(&ip->i_inode, lblock, &new, - &dblock, &extlen); + extlen = 1; + error = gfs2_alloc_extent(&ip->i_inode, lblock, &dblock, + &extlen, &new); if (error) goto fail; error = -EIO; @@ -286,15 +286,14 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, __be64 *buf, while (copied < size) { unsigned int amount; struct buffer_head *bh; - int new; amount = size - copied; if (amount > sdp->sd_sb.sb_bsize - o) amount = sdp->sd_sb.sb_bsize - o; if (!extlen) { - new = 0; - error = gfs2_extent_map(&ip->i_inode, lblock, &new, + extlen = 32; + error = gfs2_get_extent(&ip->i_inode, lblock, &dblock, &extlen); if (error || !dblock) goto fail; |