Skip to content

Commit

Permalink
fix ufs_isblockset()
Browse files Browse the repository at this point in the history
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jun 9, 2017
1 parent 8785d84 commit 414cf71
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fs/ufs/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,19 @@ static inline unsigned _ubh_find_last_zero_bit_(
static inline int _ubh_isblockset_(struct ufs_sb_private_info * uspi,
struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
{
u8 mask;
switch (uspi->s_fpb) {
case 8:
return (*ubh_get_addr (ubh, begin + block) == 0xff);
case 4:
return (*ubh_get_addr (ubh, begin + (block >> 1)) == (0x0f << ((block & 0x01) << 2)));
mask = 0x0f << ((block & 0x01) << 2);
return (*ubh_get_addr (ubh, begin + (block >> 1)) & mask) == mask;
case 2:
return (*ubh_get_addr (ubh, begin + (block >> 2)) == (0x03 << ((block & 0x03) << 1)));
mask = 0x03 << ((block & 0x03) << 1);
return (*ubh_get_addr (ubh, begin + (block >> 2)) & mask) == mask;
case 1:
return (*ubh_get_addr (ubh, begin + (block >> 3)) == (0x01 << (block & 0x07)));
mask = 0x01 << (block & 0x07);
return (*ubh_get_addr (ubh, begin + (block >> 3)) & mask) == mask;
}
return 0;
}
Expand Down

0 comments on commit 414cf71

Please sign in to comment.