summaryrefslogtreecommitdiff
path: root/fs/ext4/ext4_write.c
diff options
context:
space:
mode:
authorƁukasz Majewski <l.majewski@samsung.com>2014-05-06 09:36:04 +0200
committerTom Rini <trini@ti.com>2014-05-12 16:31:50 -0400
commit35dd055b94eb3ed8c21595eedd740431866b2f26 (patch)
tree10aa3517a501ce0ade07e83d76ce782cac154ced /fs/ext4/ext4_write.c
parentae95fad5af3793ae804b4390727e0f431e5514d7 (diff)
downloadu-boot-35dd055b94eb3ed8c21595eedd740431866b2f26.tar.gz
u-boot-35dd055b94eb3ed8c21595eedd740431866b2f26.tar.bz2
u-boot-35dd055b94eb3ed8c21595eedd740431866b2f26.zip
fs:ext4:cleanup: Remove superfluous code
Code responsible for handling situation when ext4 has block size of 1024B can be ordered to take less space. This patch does that for ext4 common and write files. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'fs/ext4/ext4_write.c')
-rw-r--r--fs/ext4/ext4_write.c56
1 files changed, 19 insertions, 37 deletions
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index b674b6faeb..3db22f8f93 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -116,10 +116,8 @@ static void delete_single_indirect_block(struct ext2_inode *inode)
if (inode->b.blocks.indir_block != 0) {
debug("SIPB releasing %u\n", inode->b.blocks.indir_block);
blknr = inode->b.blocks.indir_block;
- if (fs->blksz != 1024) {
- bg_idx = blknr / blk_per_grp;
- } else {
- bg_idx = blknr / blk_per_grp;
+ bg_idx = blknr / blk_per_grp;
+ if (fs->blksz == 1024) {
remainder = blknr % blk_per_grp;
if (!remainder)
bg_idx--;
@@ -181,11 +179,9 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
break;
debug("DICB releasing %u\n", *di_buffer);
- if (fs->blksz != 1024) {
- bg_idx = (*di_buffer) / blk_per_grp;
- } else {
- bg_idx = (*di_buffer) / blk_per_grp;
- remainder = (*di_buffer) % blk_per_grp;
+ bg_idx = *di_buffer / blk_per_grp;
+ if (fs->blksz == 1024) {
+ remainder = *di_buffer % blk_per_grp;
if (!remainder)
bg_idx--;
}
@@ -213,10 +209,8 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
/* removing the parent double indirect block */
blknr = inode->b.blocks.double_indir_block;
- if (fs->blksz != 1024) {
- bg_idx = blknr / blk_per_grp;
- } else {
- bg_idx = blknr / blk_per_grp;
+ bg_idx = blknr / blk_per_grp;
+ if (fs->blksz == 1024) {
remainder = blknr % blk_per_grp;
if (!remainder)
bg_idx--;
@@ -293,12 +287,9 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
for (j = 0; j < fs->blksz / sizeof(int); j++) {
if (*tip_buffer == 0)
break;
- if (fs->blksz != 1024) {
- bg_idx = (*tip_buffer) / blk_per_grp;
- } else {
- bg_idx = (*tip_buffer) / blk_per_grp;
-
- remainder = (*tip_buffer) % blk_per_grp;
+ bg_idx = *tip_buffer / blk_per_grp;
+ if (fs->blksz == 1024) {
+ remainder = *tip_buffer % blk_per_grp;
if (!remainder)
bg_idx--;
}
@@ -336,12 +327,9 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
* removing the grand parent blocks
* which is connected to inode
*/
- if (fs->blksz != 1024) {
- bg_idx = (*tigp_buffer) / blk_per_grp;
- } else {
- bg_idx = (*tigp_buffer) / blk_per_grp;
-
- remainder = (*tigp_buffer) % blk_per_grp;
+ bg_idx = *tigp_buffer / blk_per_grp;
+ if (fs->blksz == 1024) {
+ remainder = *tigp_buffer % blk_per_grp;
if (!remainder)
bg_idx--;
}
@@ -371,10 +359,8 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
/* removing the grand parent triple indirect block */
blknr = inode->b.blocks.triple_indir_block;
- if (fs->blksz != 1024) {
- bg_idx = blknr / blk_per_grp;
- } else {
- bg_idx = blknr / blk_per_grp;
+ bg_idx = blknr / blk_per_grp;
+ if (fs->blksz == 1024) {
remainder = blknr % blk_per_grp;
if (!remainder)
bg_idx--;
@@ -452,10 +438,8 @@ static int ext4fs_delete_file(int inodeno)
for (i = 0; i < no_blocks; i++) {
blknr = read_allocated_block(&(node_inode->inode), i);
- if (fs->blksz != 1024) {
- bg_idx = blknr / blk_per_grp;
- } else {
- bg_idx = blknr / blk_per_grp;
+ bg_idx = blknr / blk_per_grp;
+ if (fs->blksz == 1024) {
remainder = blknr % blk_per_grp;
if (!remainder)
bg_idx--;
@@ -499,10 +483,8 @@ static int ext4fs_delete_file(int inodeno)
no_blocks++;
for (i = 0; i < no_blocks; i++) {
blknr = read_allocated_block(&inode, i);
- if (fs->blksz != 1024) {
- bg_idx = blknr / blk_per_grp;
- } else {
- bg_idx = blknr / blk_per_grp;
+ bg_idx = blknr / blk_per_grp;
+ if (fs->blksz == 1024) {
remainder = blknr % blk_per_grp;
if (!remainder)
bg_idx--;