From 30982583e4e57c4648fee4a4d6511e23b6e5db2b Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sat, 23 Jul 2016 22:36:41 +1000 Subject: fs/befs/linuxvfs.c: move useless assignment Control is transfered to unacquire_none when sb->s_fs_info is equal to NULL, so the assignment to NULL is useless and it is moved above unacquire_none. Link: http://lkml.kernel.org/r/ed41da113fc693c7daa4e8813ca04cc766ddfc05.1464226521.git.salah.triki@acm.org Signed-off-by: Salah Triki Signed-off-by: Andrew Morton --- fs/befs/linuxvfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 7da05b159ade..75ec9a74d8ff 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -870,9 +870,9 @@ befs_fill_super(struct super_block *sb, void *data, int silent) unacquire_priv_sbp: kfree(befs_sb->mount_opts.iocharset); kfree(sb->s_fs_info); + sb->s_fs_info = NULL; unacquire_none: - sb->s_fs_info = NULL; return ret; } -- cgit v1.2.3 From dceee2e230e07d25e50478dde3f0621a1381da53 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sat, 23 Jul 2016 22:36:41 +1000 Subject: fs/befs/linuxvfs.c: check silent flag before logging errors Log errors only when silent flag is not set. Link: http://lkml.kernel.org/r/d400aaf5a7430de79bd956e40ec075fb1cb08474.1464226521.git.salah.triki@acm.org Signed-off-by: Salah Triki Signed-off-by: Andrew Morton --- fs/befs/linuxvfs.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 75ec9a74d8ff..edee857c2b08 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -772,7 +772,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) befs_sb = BEFS_SB(sb); if (!parse_options((char *) data, &befs_sb->mount_opts)) { - befs_error(sb, "cannot parse mount options"); + if (!silent) + befs_error(sb, "cannot parse mount options"); goto unacquire_priv_sbp; } @@ -796,7 +797,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) sb_min_blocksize(sb, 1024); if (!(bh = sb_bread(sb, sb_block))) { - befs_error(sb, "unable to read superblock"); + if (!silent) + befs_error(sb, "unable to read superblock"); goto unacquire_priv_sbp; } @@ -820,9 +822,9 @@ befs_fill_super(struct super_block *sb, void *data, int silent) brelse(bh); if( befs_sb->num_blocks > ~((sector_t)0) ) { - befs_error(sb, "blocks count: %llu " - "is larger than the host can use", - befs_sb->num_blocks); + if (!silent) + befs_error(sb, "blocks count: %llu is larger than the host can use", + befs_sb->num_blocks); goto unacquire_priv_sbp; } @@ -841,7 +843,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) } sb->s_root = d_make_root(root); if (!sb->s_root) { - befs_error(sb, "get root inode failed"); + if (!silent) + befs_error(sb, "get root inode failed"); goto unacquire_priv_sbp; } -- cgit v1.2.3 From c625426fb61a64427f4e12b83a6710161fd9489b Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sat, 23 Jul 2016 22:36:41 +1000 Subject: fs/befs/linuxvfs.c: remove useless pr_err in befs_fill_super() Remove pr_err since when kzalloc fails there is a generic out of memory and stack dump. Link: http://lkml.kernel.org/r/c5a7f2d42ec0fc8465c118248e88cd221c483391.1464226521.git.salah.triki@acm.org Signed-off-by: Salah Triki Signed-off-by: Andrew Morton --- fs/befs/linuxvfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index edee857c2b08..5b47b0fbffdd 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -764,11 +764,9 @@ befs_fill_super(struct super_block *sb, void *data, int silent) save_mount_options(sb, data); sb->s_fs_info = kzalloc(sizeof(*befs_sb), GFP_KERNEL); - if (sb->s_fs_info == NULL) { - pr_err("(%s): Unable to allocate memory for private " - "portion of superblock. Bailing.\n", sb->s_id); + if (sb->s_fs_info == NULL) goto unacquire_none; - } + befs_sb = BEFS_SB(sb); if (!parse_options((char *) data, &befs_sb->mount_opts)) { -- cgit v1.2.3 From e808792784e5a4f4532e660697385d3d370f8803 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sat, 23 Jul 2016 22:36:41 +1000 Subject: fs/befs/linuxvfs.c: remove useless befs_error Remove befs_error since when kmalloc fails there is a generic out of memory and stack dump. Link: http://lkml.kernel.org/r/3de4d388d98bbb570462a5eb8e64623e17fb5d74.1464226521.git.salah.triki@acm.org Signed-off-by: Salah Triki Signed-off-by: Andrew Morton --- fs/befs/linuxvfs.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 5b47b0fbffdd..04541f37fe83 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -524,7 +524,6 @@ befs_utf2nls(struct super_block *sb, const char *in, *out = result = kmalloc(maxlen, GFP_NOFS); if (!*out) { - befs_error(sb, "%s cannot allocate memory", __func__); *out_len = 0; return -ENOMEM; } @@ -604,7 +603,6 @@ befs_nls2utf(struct super_block *sb, const char *in, *out = result = kmalloc(maxlen, GFP_NOFS); if (!*out) { - befs_error(sb, "%s cannot allocate memory", __func__); *out_len = 0; return -ENOMEM; } -- cgit v1.2.3 From c08f1cb627c43d7b0a1d04a5a0efaf385f0391ad Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sat, 23 Jul 2016 22:36:41 +1000 Subject: fs: befs: remove useless pr_err in befs_init_inodecache() Remove pr_err since kmem_cache_create log error and dump stack. Link: http://lkml.kernel.org/r/e6d03cbc9542495dc6174b59e32fcd41c1393cfc.1464226521.git.salah.triki@acm.org Signed-off-by: Salah Triki --- fs/befs/linuxvfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 04541f37fe83..c734f21fd581 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -436,10 +436,9 @@ befs_init_inodecache(void) 0, (SLAB_RECLAIM_ACCOUNT| SLAB_MEM_SPREAD|SLAB_ACCOUNT), init_once); - if (befs_inode_cachep == NULL) { - pr_err("%s: Couldn't initialize inode slabcache\n", __func__); + if (befs_inode_cachep == NULL) return -ENOMEM; - } + return 0; } @@ -524,7 +523,6 @@ befs_utf2nls(struct super_block *sb, const char *in, *out = result = kmalloc(maxlen, GFP_NOFS); if (!*out) { - *out_len = 0; return -ENOMEM; } -- cgit v1.2.3 From 173b066f5826e8eca9b67e8091cab67fcda74f2f Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Sat, 23 Jul 2016 22:36:42 +1000 Subject: befs: check return of sb_min_blocksize Confirm sb_min_blocksize() succeeded before continuing. Link: http://lkml.kernel.org/r/1465700235-22881-1-git-send-email-luisbg@osg.samsung.com Signed-off-by: Luis de Bethencourt Signed-off-by: Andrew Morton --- fs/befs/linuxvfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index c734f21fd581..453bb68da219 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -756,6 +756,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) long ret = -EINVAL; const unsigned long sb_block = 0; const off_t x86_sb_off = 512; + int blocksize; save_mount_options(sb, data); @@ -788,7 +789,11 @@ befs_fill_super(struct super_block *sb, void *data, int silent) * least 1k to get the second 512 bytes of the volume. * -WD 10-26-01 */ - sb_min_blocksize(sb, 1024); + blocksize = sb_min_blocksize(sb, 1024); + if (!blocksize) { + befs_error(sb, "unable to set blocksize"); + goto unacquire_priv_sbp; + } if (!(bh = sb_bread(sb, sb_block))) { if (!silent) -- cgit v1.2.3 From f7f675406be6eb3736a8690217d7b41d60f6a1aa Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sat, 23 Jul 2016 22:36:42 +1000 Subject: fs: befs: replace befs_bread by sb_bread Since befs_bread merely calls sb_bread, replace it by sb_bread. Link: http://lkml.kernel.org/r/1466800258-4542-1-git-send-email-salah.triki@gmail.com Signed-off-by: Salah Triki Acked-by: Luis de Bethencourt Signed-off-by: Andrew Morton --- fs/befs/datastream.c | 6 +++--- fs/befs/io.c | 24 ------------------------ fs/befs/io.h | 2 -- fs/befs/linuxvfs.c | 2 +- 4 files changed, 4 insertions(+), 30 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index af1bc19b7c85..26cc417cbdce 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c @@ -326,7 +326,7 @@ befs_find_brun_indirect(struct super_block *sb, /* Examine blocks of the indirect run one at a time */ for (i = 0; i < indirect.len; i++) { - indirblock = befs_bread(sb, indirblockno + i); + indirblock = sb_bread(sb, indirblockno + i); if (indirblock == NULL) { befs_debug(sb, "---> %s failed to read " "disk block %lu from the indirect brun", @@ -471,7 +471,7 @@ befs_find_brun_dblindirect(struct super_block *sb, } dbl_indir_block = - befs_bread(sb, iaddr2blockno(sb, &data->double_indirect) + + sb_bread(sb, iaddr2blockno(sb, &data->double_indirect) + dbl_which_block); if (dbl_indir_block == NULL) { befs_error(sb, "%s couldn't read the " @@ -499,7 +499,7 @@ befs_find_brun_dblindirect(struct super_block *sb, } indir_block = - befs_bread(sb, iaddr2blockno(sb, &indir_run) + which_block); + sb_bread(sb, iaddr2blockno(sb, &indir_run) + which_block); if (indir_block == NULL) { befs_error(sb, "%s couldn't read the indirect block " "at blockno %lu", __func__, (unsigned long) diff --git a/fs/befs/io.c b/fs/befs/io.c index 523c8af2d770..4223b779fcc4 100644 --- a/fs/befs/io.c +++ b/fs/befs/io.c @@ -59,27 +59,3 @@ befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr) befs_debug(sb, "<--- %s ERROR", __func__); return NULL; } - -struct buffer_head * -befs_bread(struct super_block *sb, befs_blocknr_t block) -{ - struct buffer_head *bh; - - befs_debug(sb, "---> Enter %s %lu", __func__, (unsigned long)block); - - bh = sb_bread(sb, block); - - if (bh == NULL) { - befs_error(sb, "Failed to read block %lu", - (unsigned long)block); - goto error; - } - - befs_debug(sb, "<--- %s", __func__); - - return bh; - - error: - befs_debug(sb, "<--- %s ERROR", __func__); - return NULL; -} diff --git a/fs/befs/io.h b/fs/befs/io.h index 9b78266b6aa5..78d7bc6e60de 100644 --- a/fs/befs/io.h +++ b/fs/befs/io.h @@ -5,5 +5,3 @@ struct buffer_head *befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr); -struct buffer_head *befs_bread(struct super_block *sb, befs_blocknr_t block); - diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 453bb68da219..619b998e9a1e 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -318,7 +318,7 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino) befs_ino->i_inode_num.allocation_group, befs_ino->i_inode_num.start, befs_ino->i_inode_num.len); - bh = befs_bread(sb, inode->i_ino); + bh = sb_bread(sb, inode->i_ino); if (!bh) { befs_error(sb, "unable to read inode block - " "inode = %lu", inode->i_ino); -- cgit v1.2.3 From a64998504ebd766f07cf77f41334ccd8a60297ae Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Wed, 29 Jun 2016 21:27:40 +0100 Subject: fs: befs: check silent flag before logging error Log error only when silent flag is not set. Fixes: dbe6460388bc ("fs/befs/linuxvfs.c: check silent flag before logging errors") Signed-off-by: Luis de Bethencourt Acked-by: Salah Triki --- fs/befs/linuxvfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 619b998e9a1e..9272f614d985 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -791,7 +791,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) */ blocksize = sb_min_blocksize(sb, 1024); if (!blocksize) { - befs_error(sb, "unable to set blocksize"); + if (!silent) + befs_error(sb, "unable to set blocksize"); goto unacquire_priv_sbp; } -- cgit v1.2.3 From 39dcfd3b3448e03a77cd918a918cdea5d84d6076 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Wed, 29 Jun 2016 21:27:41 +0100 Subject: fs: befs: remove comment that confuses kernel-doc This comment with a mysterious unfinished line confuses the kernel-doc system since, because it starts with /**, it thinks it is documenting a function. Signed-off-by: Luis de Bethencourt --- fs/befs/linuxvfs.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 9272f614d985..cf8f9206d4eb 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -633,10 +633,6 @@ befs_nls2utf(struct super_block *sb, const char *in, return -EILSEQ; } -/** - * Use the - * - */ enum { Opt_uid, Opt_gid, Opt_charset, Opt_debug, Opt_err, }; -- cgit v1.2.3 From f7769f9cf95fa1a63eea81f13126f8fe7f708dc1 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 1 Jul 2016 01:07:30 +0100 Subject: befs: avoid dereferencing dentry twice No need to dereference dentry twice to get the name when we already have it stored in a local variable. Signed-off-by: Luis de Bethencourt --- fs/befs/linuxvfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index cf8f9206d4eb..62889eb4a97e 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -179,7 +179,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) kfree(utfname); } else { - ret = befs_btree_find(sb, ds, dentry->d_name.name, &offset); + ret = befs_btree_find(sb, ds, name, &offset); } if (ret == BEFS_BT_NOT_FOUND) { -- cgit v1.2.3 From 50858ef96deeeeeb36b2113d49007f41d0410763 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 1 Jul 2016 01:07:31 +0100 Subject: befs: remove constant variable Use macro directly instead of via assigning it to an unchanging variable. Signed-off-by: Luis de Bethencourt Acked-by: Salah Triki --- fs/befs/linuxvfs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 62889eb4a97e..516a958ba50e 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -211,7 +211,6 @@ befs_readdir(struct file *file, struct dir_context *ctx) befs_off_t value; int result; size_t keysize; - unsigned char d_type; char keybuf[BEFS_NAME_LEN + 1]; befs_debug(sb, "---> %s name %pD, inode %ld, ctx->pos %lld", @@ -236,8 +235,6 @@ more: return 0; } - d_type = DT_UNKNOWN; - /* Convert to NLS */ if (BEFS_SB(sb)->nls) { char *nlsname; @@ -249,14 +246,14 @@ more: return result; } if (!dir_emit(ctx, nlsname, nlsnamelen, - (ino_t) value, d_type)) { + (ino_t) value, DT_UNKNOWN)) { kfree(nlsname); return 0; } kfree(nlsname); } else { if (!dir_emit(ctx, keybuf, keysize, - (ino_t) value, d_type)) + (ino_t) value, DT_UNKNOWN)) return 0; } ctx->pos++; -- cgit v1.2.3 From 9ae51a32b1a060d2db4340d853d989ae622d273f Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 1 Jul 2016 01:07:32 +0100 Subject: befs: use simpler while loop Replace goto with simpler while loop to make befs_readdir() more readable. Signed-off-by: Luis de Bethencourt --- fs/befs/linuxvfs.c | 74 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 516a958ba50e..e0979a471e84 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -216,48 +216,50 @@ befs_readdir(struct file *file, struct dir_context *ctx) befs_debug(sb, "---> %s name %pD, inode %ld, ctx->pos %lld", __func__, file, inode->i_ino, ctx->pos); -more: - result = befs_btree_read(sb, ds, ctx->pos, BEFS_NAME_LEN + 1, - keybuf, &keysize, &value); - - if (result == BEFS_ERR) { - befs_debug(sb, "<--- %s ERROR", __func__); - befs_error(sb, "IO error reading %pD (inode %lu)", - file, inode->i_ino); - return -EIO; - - } else if (result == BEFS_BT_END) { - befs_debug(sb, "<--- %s END", __func__); - return 0; - - } else if (result == BEFS_BT_EMPTY) { - befs_debug(sb, "<--- %s Empty directory", __func__); - return 0; - } + while (1) { + result = befs_btree_read(sb, ds, ctx->pos, BEFS_NAME_LEN + 1, + keybuf, &keysize, &value); - /* Convert to NLS */ - if (BEFS_SB(sb)->nls) { - char *nlsname; - int nlsnamelen; - result = - befs_utf2nls(sb, keybuf, keysize, &nlsname, &nlsnamelen); - if (result < 0) { + if (result == BEFS_ERR) { befs_debug(sb, "<--- %s ERROR", __func__); - return result; + befs_error(sb, "IO error reading %pD (inode %lu)", + file, inode->i_ino); + return -EIO; + + } else if (result == BEFS_BT_END) { + befs_debug(sb, "<--- %s END", __func__); + return 0; + + } else if (result == BEFS_BT_EMPTY) { + befs_debug(sb, "<--- %s Empty directory", __func__); + return 0; } - if (!dir_emit(ctx, nlsname, nlsnamelen, - (ino_t) value, DT_UNKNOWN)) { + + /* Convert to NLS */ + if (BEFS_SB(sb)->nls) { + char *nlsname; + int nlsnamelen; + + result = + befs_utf2nls(sb, keybuf, keysize, &nlsname, + &nlsnamelen); + if (result < 0) { + befs_debug(sb, "<--- %s ERROR", __func__); + return result; + } + if (!dir_emit(ctx, nlsname, nlsnamelen, + (ino_t) value, DT_UNKNOWN)) { + kfree(nlsname); + return 0; + } kfree(nlsname); - return 0; + } else { + if (!dir_emit(ctx, keybuf, keysize, + (ino_t) value, DT_UNKNOWN)) + return 0; } - kfree(nlsname); - } else { - if (!dir_emit(ctx, keybuf, keysize, - (ino_t) value, DT_UNKNOWN)) - return 0; + ctx->pos++; } - ctx->pos++; - goto more; } static struct inode * -- cgit v1.2.3 From 4c3897cce0774b6196f59f98a44eed7e011db5aa Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Sun, 3 Jul 2016 16:29:44 +0100 Subject: befs: make consistent use of befs_error() befs_error() is used in potential errors that could happen in befs to provide informational log messages. befs_debug() is silent when CONFIG_BEFS_DEBUG=no, and very verbose when switched on, which is why it is used for general debugging but not for errors. Fix a few cases where the befs debug utility usage isn't following the expected pattern. To make sure we have consistent information in the logs. Signed-off-by: Luis de Bethencourt --- fs/befs/btree.c | 6 ++++-- fs/befs/datastream.c | 5 ++++- fs/befs/linuxvfs.c | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/btree.c b/fs/befs/btree.c index 307645f9e284..679f69df3817 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c @@ -301,7 +301,8 @@ befs_btree_find(struct super_block *sb, const befs_data_stream *ds, kfree(this_node); if (res != BEFS_BT_MATCH) { - befs_debug(sb, "<--- %s Key %s not found", __func__, key); + befs_error(sb, "<--- %s Key %s not found", __func__, key); + befs_debug(sb, "<--- %s ERROR", __func__); *value = 0; return BEFS_BT_NOT_FOUND; } @@ -358,7 +359,8 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node, eq = befs_compare_strings(thiskey, keylen, findkey, findkey_len); if (eq < 0) { - befs_debug(sb, "<--- %s %s not found", __func__, findkey); + befs_error(sb, "<--- %s %s not found", __func__, findkey); + befs_debug(sb, "<--- %s ERROR", __func__); return BEFS_BT_NOT_FOUND; } diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index 26cc417cbdce..740fabcd57c0 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c @@ -275,6 +275,8 @@ befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data, } } + befs_error(sb, "%s failed to find file block %lu", __func__, + (unsigned long)blockno); befs_debug(sb, "---> %s ERROR", __func__); return BEFS_ERR; } @@ -328,9 +330,10 @@ befs_find_brun_indirect(struct super_block *sb, for (i = 0; i < indirect.len; i++) { indirblock = sb_bread(sb, indirblockno + i); if (indirblock == NULL) { - befs_debug(sb, "---> %s failed to read " + befs_error(sb, "---> %s failed to read " "disk block %lu from the indirect brun", __func__, (unsigned long)indirblockno + i); + befs_debug(sb, "<--- %s ERROR", __func__); return BEFS_ERR; } diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index e0979a471e84..67669a81cfd1 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -187,7 +187,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) return ERR_PTR(-ENOENT); } else if (ret != BEFS_OK || offset == 0) { - befs_warning(sb, "<--- %s Error", __func__); + befs_error(sb, "<--- %s Error", __func__); return ERR_PTR(-ENODATA); } -- cgit v1.2.3 From a26bc1adc74063ec116159d45f305d2a1dd4a07b Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Wed, 27 Jul 2016 03:35:59 +0100 Subject: fs: befs: Insert NULL inode to dentry As VFS expects, lookup inserts NULL inode to dentry when the named inode does not exist. Signed-off-by: Salah Triki Acked-by: Luis de Bethencourt --- fs/befs/linuxvfs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 67669a81cfd1..ebfc9f0b8a2d 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -184,6 +184,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) if (ret == BEFS_BT_NOT_FOUND) { befs_debug(sb, "<--- %s %pd not found", __func__, dentry); + d_add(dentry, NULL); return ERR_PTR(-ENOENT); } else if (ret != BEFS_OK || offset == 0) { -- cgit v1.2.3 From abcf911691ee2a4e3fd8c71adc397f67c56565a2 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sun, 31 Jul 2016 21:34:30 +0100 Subject: fs: befs: remove in vain variable assignment There is no need to init res, since it will be overwitten later by befs_fblock2brun(). Signed-off-by: Salah Triki Acked-by: Luis de Bethencourt --- fs/befs/linuxvfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index ebfc9f0b8a2d..c3909a6a24a3 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -120,7 +120,7 @@ befs_get_block(struct inode *inode, sector_t block, struct super_block *sb = inode->i_sb; befs_data_stream *ds = &BEFS_I(inode)->i_data.ds; befs_block_run run = BAD_IADDR; - int res = 0; + int res; ulong disk_off; befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld", -- cgit v1.2.3 From 33c712b4fcf23fba57cb9a8d947d9ab41e363b08 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Sun, 31 Jul 2016 21:34:31 +0100 Subject: fs: befs: remove ret variable ret is initialized to -EIO and is never modified, so remove ret and use -EIO directly. Signed-off-by: Salah Triki Acked-by: Luis de Bethencourt --- fs/befs/linuxvfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/befs/linuxvfs.c') diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index c3909a6a24a3..d307c1e44f49 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -299,7 +299,6 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino) struct befs_sb_info *befs_sb = BEFS_SB(sb); struct befs_inode_info *befs_ino; struct inode *inode; - long ret = -EIO; befs_debug(sb, "---> %s inode = %lu", __func__, ino); @@ -421,7 +420,7 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino) unacquire_none: iget_failed(inode); befs_debug(sb, "<--- %s - Bad inode", __func__); - return ERR_PTR(ret); + return ERR_PTR(-EIO); } /* Initialize the inode cache. Called at fs setup. -- cgit v1.2.3