diff options
author | Paulo Alcantara <pcacjr@zytor.com> | 2012-07-22 23:35:23 -0300 |
---|---|---|
committer | Paulo Alcantara <pcacjr@zytor.com> | 2012-07-23 11:43:38 -0300 |
commit | bc6d4583f7c2236bc5256e0d11d1b523fd1eddd0 (patch) | |
tree | b47f19b3ff019c3420f864f79411c8da4b4dec09 | |
parent | d28895b6e03f392b2e4be87eede101dc3710d4f4 (diff) | |
download | syslinux-bc6d4583f7c2236bc5256e0d11d1b523fd1eddd0.tar.gz syslinux-bc6d4583f7c2236bc5256e0d11d1b523fd1eddd0.tar.xz syslinux-bc6d4583f7c2236bc5256e0d11d1b523fd1eddd0.zip |
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@zytor.com>
-rw-r--r-- | core/fs/xfs/xfs.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c index 825ee161..9107024a 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); } |