Skip to content

Commit 152f58c

Browse files
author
Andreas Gruenbacher
committed
gfs2: Replace gfs2_lblk_to_dblk with gfs2_get_extent
We don't need two very similar functions for mapping logical blocks to physical blocks. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 9153dac commit 152f58c

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

fs/gfs2/bmap.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -961,30 +961,6 @@ static int __gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
961961
goto out;
962962
}
963963

964-
/**
965-
* gfs2_lblk_to_dblk - convert logical block to disk block
966-
* @inode: the inode of the file we're mapping
967-
* @lblock: the block relative to the start of the file
968-
* @dblock: the returned dblock, if no error
969-
*
970-
* This function maps a single block from a file logical block (relative to
971-
* the start of the file) to a file system absolute block using iomap.
972-
*
973-
* Returns: the absolute file system block, or an error
974-
*/
975-
int gfs2_lblk_to_dblk(struct inode *inode, u32 lblock, u64 *dblock)
976-
{
977-
struct iomap iomap = { };
978-
loff_t pos = (loff_t)lblock << inode->i_blkbits;
979-
int ret;
980-
981-
ret = gfs2_iomap_get(inode, pos, i_blocksize(inode), &iomap);
982-
if (ret == 0)
983-
*dblock = iomap.addr >> inode->i_blkbits;
984-
985-
return ret;
986-
}
987-
988964
static int gfs2_write_lock(struct inode *inode)
989965
{
990966
struct gfs2_inode *ip = GFS2_I(inode);

fs/gfs2/bmap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,5 @@ extern int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
6666
extern int gfs2_map_journal_extents(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd);
6767
extern void gfs2_free_journal_extents(struct gfs2_jdesc *jd);
6868
extern int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length);
69-
extern int gfs2_lblk_to_dblk(struct inode *inode, u32 lblock, u64 *dblock);
7069

7170
#endif /* __BMAP_DOT_H__ */

fs/gfs2/log.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,11 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
859859
if (!list_empty(&jd->extent_list))
860860
dblock = gfs2_log_bmap(jd, lblock);
861861
else {
862-
int ret = gfs2_lblk_to_dblk(jd->jd_inode, lblock, &dblock);
862+
unsigned int extlen;
863+
int ret;
864+
865+
extlen = 1;
866+
ret = gfs2_get_extent(jd->jd_inode, lblock, &dblock, &extlen);
863867
if (gfs2_assert_withdraw(sdp, ret == 0))
864868
return;
865869
}

0 commit comments

Comments
 (0)