Skip to content

Commit

Permalink
btrfs: fix empty_zero_page misusage
Browse files Browse the repository at this point in the history
Heiko Carstens noticed that btrfs was using empty_zero_page
incorrectly.  He explained:

	The definition of empty_zero_page is architecture specific.  It
	is (currently) either a character array, an unsigned long
	containing the address of the empty_zero_page, or even worse
	only the address of the struct page belonging to the
	empty_zero_page.

This commit changes btrfs to use a for-loop instead.  On x86
the resulting .ko is smaller, and we're no longer worrying about
how each arch builds its zeros.

Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
  • Loading branch information
Chris Mason committed Nov 15, 2013
1 parent 91aef86 commit 46e0f66
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,13 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)

int btrfs_is_empty_uuid(u8 *uuid)
{
BUILD_BUG_ON(BTRFS_UUID_SIZE > PAGE_SIZE);
return !memcmp(uuid, empty_zero_page, BTRFS_UUID_SIZE);
int i;

for (i = 0; i < BTRFS_UUID_SIZE; i++) {
if (uuid[i])
return 0;
}
return 1;
}

static noinline int create_subvol(struct inode *dir,
Expand Down

0 comments on commit 46e0f66

Please sign in to comment.