[syslinux:elflink] xfs: Use bmbt_irec_get() to get extent information instead
syslinux-bot for Paulo Alcantara
pcacjr at zytor.com
Tue Nov 27 12:57:16 PST 2012
Commit-ID: bc6d4583f7c2236bc5256e0d11d1b523fd1eddd0
Gitweb: http://www.syslinux.org/commit/bc6d4583f7c2236bc5256e0d11d1b523fd1eddd0
Author: Paulo Alcantara <pcacjr at zytor.com>
AuthorDate: Sun, 22 Jul 2012 23:35:23 -0300
Committer: Paulo Alcantara <pcacjr at zytor.com>
CommitDate: Mon, 23 Jul 2012 11:43:38 -0300
xfs: Use bmbt_irec_get() to get extent information instead
There is no need to parse the whole 128-byte data (extent descriptor) in
xfs_next_extent(), since there is a function (bmbt_irec_get()) that
already does this.
Signed-off-by: Paulo Alcantara <pcacjr at zytor.com>
---
core/fs/xfs/xfs.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c
index 825ee16..9107024 100644
--- a/core/fs/xfs/xfs.c
+++ b/core/fs/xfs/xfs.c
@@ -530,10 +530,7 @@ static int xfs_next_extent(struct inode *inode, uint32_t lstart)
{
struct fs_info *fs = inode->fs;
xfs_dinode_t *core = NULL;
- xfs_bmbt_rec_t *rec;
- uint64_t startoff;
- uint64_t startblock;
- uint64_t blockcount;
+ xfs_bmbt_irec_t rec;
block_t blk;
(void)lstart;
@@ -551,30 +548,15 @@ static int xfs_next_extent(struct inode *inode, uint32_t lstart)
if (XFS_PVT(inode)->i_cur_extent == be32_to_cpu(core->di_nextents))
goto out;
- rec = (xfs_bmbt_rec_t *)&core->di_literal_area[0] +
- XFS_PVT(inode)->i_cur_extent++;
+ bmbt_irec_get(&rec, (xfs_bmbt_rec_t *)&core->di_literal_area[0] +
+ XFS_PVT(inode)->i_cur_extent++);
- xfs_debug("l0 0x%llx l1 0x%llx", rec->l0, rec->l1);
+ blk = fsblock_to_bytes(fs, rec.br_startblock) >> BLOCK_SHIFT(fs);
- /* l0:9-62 are startoff */
- startoff = (be64_to_cpu(rec->l0) & ((1ULL << 63) -1)) >> 9;
- /* l0:0-8 and l1:21-63 are startblock */
- startblock = (be64_to_cpu(rec->l0) & ((1ULL << 9) - 1)) |
- (be64_to_cpu(rec->l1) >> 21);
- /* l1:0-20 are blockcount */
- blockcount = be64_to_cpu(rec->l1) & ((1ULL << 21) - 1);
-
- xfs_debug("startoff 0x%llx startblock 0x%llx blockcount 0x%llx",
- startoff, startblock, blockcount);
-
- blk = fsblock_to_bytes(fs, startblock) >> BLOCK_SHIFT(fs);
-
- xfs_debug("blk %llu", blk);
-
- XFS_PVT(inode)->i_offset = startoff;
+ XFS_PVT(inode)->i_offset = rec.br_startoff;
inode->next_extent.pstart = blk << BLOCK_SHIFT(fs) >> SECTOR_SHIFT(fs);
- inode->next_extent.len = ((blockcount << BLOCK_SHIFT(fs)) +
+ inode->next_extent.len = ((rec.br_blockcount << BLOCK_SHIFT(fs)) +
SECTOR_SIZE(fs) - 1) >> SECTOR_SHIFT(fs);
}
More information about the Syslinux-commits
mailing list