summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/Kconfig8
-rw-r--r--fs/ext4/ext4_journal.h2
-rw-r--r--fs/ext4/ext4_write.c4
-rw-r--r--fs/ubifs/lprops.c6
-rw-r--r--fs/ubifs/super.c2
-rw-r--r--fs/ubifs/ubifs.c16
6 files changed, 25 insertions, 13 deletions
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index 8ddaebebd48..a2faa9f878a 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -12,3 +12,11 @@ config EXT4_WRITE
help
This provides support for creating and writing new files to an
existing ext4 filesystem partition.
+
+config EXT4_MAX_JOURNAL_ENTRIES
+ int "Maximum numbers of journal entries for ext4 filesystem"
+ default 100
+ depends on EXT4_WRITE
+ help
+ This provides support for allocating the maximum number of
+ journal entries in disks formatted with ext4 filesysyem.
diff --git a/fs/ext4/ext4_journal.h b/fs/ext4/ext4_journal.h
index 43fb8e76641..a492df49fbe 100644
--- a/fs/ext4/ext4_journal.h
+++ b/fs/ext4/ext4_journal.h
@@ -38,7 +38,7 @@
#define EXT3_JOURNAL_FLAG_LAST_TAG 8
/* Maximum entries in 1 journal transaction */
-#define MAX_JOURNAL_ENTRIES 100
+#define MAX_JOURNAL_ENTRIES CONFIG_EXT4_MAX_JOURNAL_ENTRIES
struct journal_log {
char *buf;
int blknr;
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index dd8ed40f888..5b290f0d80d 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -877,7 +877,8 @@ int ext4fs_write(const char *fname, const char *buffer,
if (ext4fs_init() != 0) {
printf("error in File System init\n");
- goto fail;
+ /* Skip ext4fs_deinit since ext4fs_init() already done that */
+ goto fail_init;
}
missing_feat = le32_to_cpu(fs->sb->feature_incompat) & ~EXT4_FEATURE_INCOMPAT_SUPP;
@@ -1050,6 +1051,7 @@ int ext4fs_write(const char *fname, const char *buffer,
return 0;
fail:
ext4fs_deinit();
+fail_init:
free(inode_buffer);
free(g_parent_inode);
free(temp_ptr);
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index a9e22abe6b4..74beb853b6e 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -1096,14 +1096,16 @@ static int scan_check_cb(struct ubifs_info *c,
lst->empty_lebs += 1;
lst->total_free += c->leb_size;
lst->total_dark += ubifs_calc_dark(c, c->leb_size);
- return LPT_SCAN_CONTINUE;
+ ret = LPT_SCAN_CONTINUE;
+ goto out;
}
if (lp->free + lp->dirty == c->leb_size &&
!(lp->flags & LPROPS_INDEX)) {
lst->total_free += lp->free;
lst->total_dirty += lp->dirty;
lst->total_dark += ubifs_calc_dark(c, c->leb_size);
- return LPT_SCAN_CONTINUE;
+ ret = LPT_SCAN_CONTINUE;
+ goto out;
}
sleb = ubifs_scan(c, lnum, 0, buf, 0);
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 7718081f093..b6004b88f4e 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2425,7 +2425,7 @@ retry:
if (!s) {
spin_unlock(&sb_lock);
s = alloc_super(type, flags);
- if (!s)
+ if (IS_ERR_OR_NULL(s))
return ERR_PTR(-ENOMEM);
#ifndef __UBOOT__
goto retry;
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 398b076d783..40bad0e7da7 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -420,7 +420,6 @@ out:
static int ubifs_finddir(struct super_block *sb, char *dirname,
unsigned long root_inum, unsigned long *inum)
{
- int err;
struct qstr nm;
union ubifs_key key;
struct ubifs_dent_node *dent;
@@ -435,8 +434,8 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
dir = kzalloc(sizeof(struct inode), 0);
if (!file || !dentry || !dir) {
printf("%s: Error, no memory for malloc!\n", __func__);
- err = -ENOMEM;
- goto out;
+ ret = -ENOMEM;
+ goto out_free;
}
dir->i_sb = sb;
@@ -453,7 +452,7 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
nm.name = NULL;
dent = ubifs_tnc_next_ent(c, &key, &nm);
if (IS_ERR(dent)) {
- err = PTR_ERR(dent);
+ ret = PTR_ERR(dent);
goto out;
}
@@ -481,7 +480,7 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
nm.name = (char *)dent->name;
dent = ubifs_tnc_next_ent(c, &key, &nm);
if (IS_ERR(dent)) {
- err = PTR_ERR(dent);
+ ret = PTR_ERR(dent);
goto out;
}
@@ -492,11 +491,12 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
}
out:
- if (err != -ENOENT)
- dbg_gen("cannot find next direntry, error %d", err);
+ if (ret < 0 && ret != -ENOENT)
+ dbg_gen("cannot find next direntry, error %d", ret);
out_free:
- kfree(file->private_data);
+ if (file)
+ kfree(file->private_data);
free(file);
free(dentry);
free(dir);