Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39309
b: refs/heads/master
c: 72b64b5
h: refs/heads/master
i:
  39307: 4d4d7e4
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Oct 11, 2006
1 parent 1bc7e0a commit aa8fc9f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8fadc14323684c547f74cf2f4d13517c6c264731
refs/heads/master: 72b64b594081ef0a0717f6aad77e891c72ed4afa
18 changes: 18 additions & 0 deletions trunk/fs/ext4/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@
* balloc.c contains the blocks allocation and deallocation routines
*/

/*
* Calculate the block group number and offset, given a block number
*/
void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
unsigned long *blockgrpp, ext4_grpblk_t *offsetp)
{
struct ext4_super_block *es = EXT4_SB(sb)->s_es;
ext4_grpblk_t offset;

blocknr = blocknr - le32_to_cpu(es->s_first_data_block);
offset = sector_div(blocknr, EXT4_BLOCKS_PER_GROUP(sb));
if (offsetp)
*offsetp = offset;
if (blockgrpp)
*blockgrpp = blocknr;

}

/*
* The free blocks are managed by bitmaps. A file system contains several
* blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
Expand Down
22 changes: 2 additions & 20 deletions trunk/include/linux/ext4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -769,26 +769,8 @@ ext4_group_first_block_no(struct super_block *sb, unsigned long group_no)
*/
#define ERR_BAD_DX_DIR -75000

/*
* This function calculate the block group number and offset,
* given a block number
*/

static inline void ext4_get_group_no_and_offset(struct super_block * sb,
ext4_fsblk_t blocknr, unsigned long* blockgrpp,
ext4_grpblk_t *offsetp)
{
struct ext4_super_block *es = EXT4_SB(sb)->s_es;
ext4_grpblk_t offset;

blocknr = blocknr - le32_to_cpu(es->s_first_data_block);
offset = sector_div(blocknr, EXT4_BLOCKS_PER_GROUP(sb));
if (offsetp)
*offsetp = offset;
if (blockgrpp)
*blockgrpp = blocknr;

}
void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
unsigned long *blockgrpp, ext4_grpblk_t *offsetp);

/*
* Function prototypes
Expand Down

0 comments on commit aa8fc9f

Please sign in to comment.