diff options
author | Bob Peterson <rpeterso@redhat.com> | 2022-02-11 10:50:36 -0500 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2022-05-24 21:29:14 +0200 |
commit | c360abbb9db298d0548b31e1a86a48ebb157d7cd (patch) | |
tree | 53c83fbd3c14c13a673154bebe9beb63f47e1243 /fs/gfs2 | |
parent | 5fcff61eea9efd1f4b60e89d2d686b5feaea100f (diff) | |
download | linux-stable-c360abbb9db298d0548b31e1a86a48ebb157d7cd.tar.gz linux-stable-c360abbb9db298d0548b31e1a86a48ebb157d7cd.tar.bz2 linux-stable-c360abbb9db298d0548b31e1a86a48ebb157d7cd.zip |
gfs2: Convert function bh_get to use iomap
Before this patch, function bh_get used block_map to figure out the
block it needed to read in from the quota_change file. This patch
changes it to use iomap directly to make it more efficient.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/quota.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 390f34ca3bc8..59d727a4ae2c 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -365,11 +365,12 @@ static void slot_put(struct gfs2_quota_data *qd) static int bh_get(struct gfs2_quota_data *qd) { struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; - struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); + struct inode *inode = sdp->sd_qc_inode; + struct gfs2_inode *ip = GFS2_I(inode); unsigned int block, offset; struct buffer_head *bh; + struct iomap iomap = { }; int error; - struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; mutex_lock(&sdp->sd_quota_mutex); @@ -381,11 +382,17 @@ static int bh_get(struct gfs2_quota_data *qd) block = qd->qd_slot / sdp->sd_qc_per_block; offset = qd->qd_slot % sdp->sd_qc_per_block; - bh_map.b_size = BIT(ip->i_inode.i_blkbits); - error = gfs2_block_map(&ip->i_inode, block, &bh_map, 0); + error = gfs2_iomap_get(inode, + (loff_t)block << inode->i_blkbits, + i_blocksize(inode), &iomap); if (error) goto fail; - error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, 0, &bh); + error = -ENOENT; + if (iomap.type != IOMAP_MAPPED) + goto fail; + + error = gfs2_meta_read(ip->i_gl, iomap.addr >> inode->i_blkbits, + DIO_WAIT, 0, &bh); if (error) goto fail; error = -EIO; |