From patchwork Wed Jun 22 14:56:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liu weni X-Patchwork-Id: 905652 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5MEuieb009008 for ; Wed, 22 Jun 2011 14:56:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758016Ab1FVO4l (ORCPT ); Wed, 22 Jun 2011 10:56:41 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:49816 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757939Ab1FVO4l (ORCPT ); Wed, 22 Jun 2011 10:56:41 -0400 Received: by gyh3 with SMTP id 3so348850gyh.19 for ; Wed, 22 Jun 2011 07:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=b6HSQgSs4Pf8q89Y37y/vC/2Pu2PjA9+xj7UgS4wggI=; b=QBZ5T0+VGfYeYu6vYXDWeZaoy9k+QB2EhE47N74nqrfXyOVq4pQ+VaCsfKbM58niSy DDjh9eA+lyAJ0onX+HPndF9PosNPfz1/V0HrSt2K1UrgvEtXen1tM9m1C/e5nV+xWMyX PUK6Mce52LQHpwlo+8AB6Irk88MOmio8fBXYA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=nJ8lkHbOBrZzq5v7UU8zgdrIsA1rmPBSXhX/sWIAbhc8Yjc3ViNxlWDIR9UdeJodLh 8jIZA9rubA7Mplbx5Lcal/fTnTCsZ1k9/4FFWZst2iNCOPOTZUYCOg8i81SOkPWQ6jc7 MF8nDsiuJMh6Jk8ynqfvflkVZkR7c+mQu0zUg= MIME-Version: 1.0 Received: by 10.101.189.34 with SMTP id r34mr891054anp.77.1308754600307; Wed, 22 Jun 2011 07:56:40 -0700 (PDT) Received: by 10.100.106.6 with HTTP; Wed, 22 Jun 2011 07:56:39 -0700 (PDT) Date: Wed, 22 Jun 2011 22:56:39 +0800 Message-ID: Subject: [PATCH] btrfs: kick off the useless parameter From: Wenyi Liu To: linux-btrfs Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 22 Jun 2011 14:56:44 +0000 (UTC) If there is no future development plan, this parameter for btrfs_root should be removed. --- Signed-off-by: Liu Wenyi --- fs/btrfs/compression.c | 3 +-- fs/btrfs/disk-io.c | 6 +++--- fs/btrfs/disk-io.h | 2 +- fs/btrfs/file-item.c | 3 +-- fs/btrfs/free-space-cache.c | 6 +++--- fs/btrfs/inode.c | 5 ++--- 6 files changed, 11 insertions(+), 14 deletions(-) goto zeroit; @@ -5770,7 +5770,6 @@ static void btrfs_endio_direct_read(struct bio *bio, int err) struct bio_vec *bvec_end = bio->bi_io_vec + bio->bi_vcnt - 1; struct bio_vec *bvec = bio->bi_io_vec; struct inode *inode = dip->inode; - struct btrfs_root *root = BTRFS_I(inode)->root; u64 start; u32 *private = dip->csums; @@ -5784,7 +5783,7 @@ static void btrfs_endio_direct_read(struct bio *bio, int err) local_irq_save(flags); kaddr = kmap_atomic(page, KM_IRQ0); - csum = btrfs_csum_data(root, kaddr + bvec->bv_offset, + csum = btrfs_csum_data(kaddr + bvec->bv_offset, csum, bvec->bv_len); btrfs_csum_final(csum, (char *)&csum); kunmap_atomic(kaddr, KM_IRQ0); diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 41d1d7c..499d8a4 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -105,7 +105,6 @@ static int check_compressed_csum(struct inode *inode, u64 disk_start) { int ret; - struct btrfs_root *root = BTRFS_I(inode)->root; struct page *page; unsigned long i; char *kaddr; @@ -120,7 +119,7 @@ static int check_compressed_csum(struct inode *inode, csum = ~(u32)0; kaddr = kmap_atomic(page, KM_USER0); - csum = btrfs_csum_data(root, kaddr, csum, PAGE_CACHE_SIZE); + csum = btrfs_csum_data(kaddr, csum, PAGE_CACHE_SIZE); btrfs_csum_final(csum, (char *)&csum); kunmap_atomic(kaddr, KM_USER0); diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index fe5aec9..77fee13 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -192,7 +192,7 @@ out: return em; } -u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len) +u32 btrfs_csum_data(char *data, u32 seed, size_t len) { return crc32c(seed, data, len); } @@ -231,7 +231,7 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, if (err) return 1; cur_len = min(len, map_len - (offset - map_start)); - crc = btrfs_csum_data(root, kaddr + offset - map_start, + crc = btrfs_csum_data(kaddr + offset - map_start, crc, cur_len); len -= cur_len; offset += cur_len; @@ -2359,7 +2359,7 @@ static int write_dev_supers(struct btrfs_device *device, btrfs_set_super_bytenr(sb, bytenr); crc = ~(u32)0; - crc = btrfs_csum_data(NULL, (char *)sb + + crc = btrfs_csum_data((char *)sb + BTRFS_CSUM_SIZE, crc, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE); diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 07b20dc..9bef3e0 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h @@ -79,7 +79,7 @@ int btrfs_set_buffer_uptodate(struct extent_buffer *buf); int wait_on_tree_block_writeback(struct btrfs_root *root, struct extent_buffer *buf); int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); -u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len); +u32 btrfs_csum_data(char *data, u32 seed, size_t len); void btrfs_csum_final(u32 crc, char *result); int btrfs_open_device(struct btrfs_device *dev); int btrfs_verify_block_csum(struct btrfs_root *root, diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index a6a9d4e..611a1be 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -432,8 +432,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, data = kmap_atomic(bvec->bv_page, KM_USER0); sector_sum->sum = ~(u32)0; - sector_sum->sum = btrfs_csum_data(root, - data + bvec->bv_offset, + sector_sum->sum = btrfs_csum_data(data + bvec->bv_offset, sector_sum->sum, bvec->bv_len); kunmap_atomic(data, KM_USER0); diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 63731a1..64ffb39 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -378,7 +378,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, /* First lets check our crc before we do anything fun */ cur_crc = ~(u32)0; - cur_crc = btrfs_csum_data(root, addr + start_offset, cur_crc, + cur_crc = btrfs_csum_data(addr + start_offset, cur_crc, PAGE_CACHE_SIZE - start_offset); btrfs_csum_final(cur_crc, (char *)&cur_crc); if (cur_crc != *crc) { @@ -710,7 +710,7 @@ int btrfs_write_out_cache(struct btrfs_root *root, entry++; } *crc = ~(u32)0; - *crc = btrfs_csum_data(root, addr + start_offset, *crc, + *crc = btrfs_csum_data(addr + start_offset, *crc, PAGE_CACHE_SIZE - start_offset); kunmap(page); @@ -737,7 +737,7 @@ int btrfs_write_out_cache(struct btrfs_root *root, addr = kmap(page); memcpy(addr, entry->bitmap, PAGE_CACHE_SIZE); *crc = ~(u32)0; - *crc = btrfs_csum_data(root, addr, *crc, PAGE_CACHE_SIZE); + *crc = btrfs_csum_data(addr, *crc, PAGE_CACHE_SIZE); kunmap(page); btrfs_csum_final(*crc, (char *)crc); crc++; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 870869a..9aa2103 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1989,7 +1989,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end, if (ret) goto zeroit; - csum = btrfs_csum_data(root, kaddr + offset, csum, end - start + 1); + csum = btrfs_csum_data(kaddr + offset, csum, end - start + 1); btrfs_csum_final(csum, (char *)&csum); if (csum != private)