OSDN Git Service

ext4: simplify some code in read_mmp_block()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 15 Aug 2015 15:30:31 +0000 (11:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 15 Aug 2015 15:30:31 +0000 (11:30 -0400)
commit9810446836ab5a4b34a749bb77f3eb5836f982cc
tree4bc7c2d3788f2dbd2fb58d185291799f3be9329a
parentc642dc9e1aaed953597e7092d7df329e6234096e
ext4: simplify some code in read_mmp_block()

My static check complains because we have:

if (!*bh)
return -ENOMEM;
if (*bh) {

The second check is unnecessary.

I've simplified this code by moving the "if (!*bh)" checks around.  Also
Andreas Dilger says we should probably print a warning if sb_getblk()
fails.

[ Restructured the code so that we print a warning message as well if
  the mmp block doesn't check out, and to print the error code to
  disambiguate between the error cases.  - TYT ]

Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mmp.c