Skip to content

Commit

Permalink
ufs: set correct ->s_maxsize
Browse files Browse the repository at this point in the history
Cc: [email protected]
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jun 9, 2017
1 parent eb315d2 commit 6b0d144
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fs/ufs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,23 @@ static void ufs_put_super(struct super_block *sb)
return;
}

static u64 ufs_max_bytes(struct super_block *sb)
{
struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
int bits = uspi->s_apbshift;
u64 res;

if (bits > 21)
res = ~0ULL;
else
res = UFS_NDADDR + (1LL << bits) + (1LL << (2*bits)) +
(1LL << (3*bits));

if (res >= (MAX_LFS_FILESIZE >> uspi->s_bshift))
return MAX_LFS_FILESIZE;
return res << uspi->s_bshift;
}

static int ufs_fill_super(struct super_block *sb, void *data, int silent)
{
struct ufs_sb_info * sbi;
Expand Down Expand Up @@ -1212,6 +1229,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
"fast symlink size (%u)\n", uspi->s_maxsymlinklen);
uspi->s_maxsymlinklen = maxsymlen;
}
sb->s_maxbytes = ufs_max_bytes(sb);
sb->s_max_links = UFS_LINK_MAX;

inode = ufs_iget(sb, UFS_ROOTINO);
Expand Down

0 comments on commit 6b0d144

Please sign in to comment.