On Jan 29, 2021, at 11:58 AM, Vinicius Tinti <viniciusti...@gmail.com> wrote:
> 
> By enabling -Wunreachable-code-aggressive on Clang the following code
> paths are unreachable.
> 
> Commit dd73b5d5cb67 ("ext4: convert dx_probe() to use the ERR_PTR
> convention")
> Commit ac27a0ec112a ("[PATCH] ext4: initial copy of files from ext3")
> 
> Clang warns:
> 
> fs/ext4/namei.c:831:17: warning: code will never be executed
> [-Wunreachable-code]
>                        unsigned n = count - 1;
>                                     ^~~~~
> fs/ext4/namei.c:830:7: note: silence by adding parentheses to mark code as
> explicitly dead
>                if (0) { // linear search cross check
>                    ^
>                    /* DISABLES CODE */ ( )
> 
> Signed-off-by: Vinicius Tinti <viniciusti...@gmail.com>
> ---
> fs/ext4/namei.c | 15 ---------------
> 1 file changed, 15 deletions(-)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index cf652ba3e74d..1f64dbd7237b 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -827,21 +827,6 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
>                               p = m + 1;
>               }
> 
> -             if (0) { // linear search cross check

I would rather put this block under "#ifdef DX_DEBUG" so that it is available
in the future for debugging problems with hashed directories.

> -                     unsigned n = count - 1;
> -                     at = entries;
> -                     while (n--)
> -                     {
> -                             dxtrace(printk(KERN_CONT ","));
> -                             if (dx_get_hash(++at) > hash)
> -                             {
> -                                     at--;
> -                                     break;
> -                             }
> -                     }
> -                     ASSERT(at == p - 1);
> -             }
> -
>               at = p - 1;
>               dxtrace(printk(KERN_CONT " %x->%u\n",
>                              at == entries ? 0 : dx_get_hash(at),
> --
> 2.25.1
> 


Cheers, Andreas





Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to