From patchwork Wed Nov 28 18:08:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 13274 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 356024C1798 for ; Wed, 28 Nov 2012 18:08:42 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id D9AB0A18C63 for ; Wed, 28 Nov 2012 18:08:41 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so7183669iag.11 for ; Wed, 28 Nov 2012 10:08:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-sa-exim-connect-ip :x-sa-exim-mail-from:x-sa-exim-scanned:x-gm-message-state; bh=kIpTBgZemAo8iDfjAxkYJaklcumcvYyzWrixqF/WsfQ=; b=A2uDzP5ZzALzowpAgnvm9pDXPis/FjmJXVHc7Gzut3lFAJ+F6XsudakCe6yb8Y0afI 69EtzexPIoL4lL8CMOCfLuyxeeh+503LkTXdVNCERDJJc/RT2ZuKgC/lIVOWJmc1msjP dOkG9y3jRM9aedct7RYJQPiIdb2l/CP74oQnqWSep4RWDcvIp7k4e006klbb2vZabfD+ W18EVPhvJIccfCDNnnlBwi0At30ntGQf3XhW0kdVlfu7+TWRdZZ4G3hVmEumZWH20aNj hPI85FoadApEBr3SVPYj1Bj2Rzc4qMztGjJ0Dx8B8EdEAynI6W4VOcT+uFuMQYUvh5n6 wJ8w== Received: by 10.43.46.2 with SMTP id um2mr17600145icb.18.1354126120027; Wed, 28 Nov 2012 10:08:40 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp705461igt; Wed, 28 Nov 2012 10:08:39 -0800 (PST) Received: by 10.68.252.40 with SMTP id zp8mr60974770pbc.66.1354126119172; Wed, 28 Nov 2012 10:08:39 -0800 (PST) Received: from imap.thunk.org (li9-11.members.linode.com. [67.18.176.11]) by mx.google.com with ESMTPS id d3si16424570paw.215.2012.11.28.10.08.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 28 Nov 2012 10:08:39 -0800 (PST) Received-SPF: pass (google.com: domain of tytso@thunk.org designates 67.18.176.11 as permitted sender) client-ip=67.18.176.11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of tytso@thunk.org designates 67.18.176.11 as permitted sender) smtp.mail=tytso@thunk.org Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.72) (envelope-from ) id 1Tdm3e-0006t2-AP; Wed, 28 Nov 2012 18:08:26 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id 84505241109; Wed, 28 Nov 2012 13:08:34 -0500 (EST) Date: Wed, 28 Nov 2012 13:08:34 -0500 From: Theodore Ts'o To: Sachin Kamat Cc: linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca, patches@linaro.org, Zheng Liu Subject: Re: [PATCH 1/1] ext4: Remove duplicate inclusion of ext4_extents.h in super.c Message-ID: <20121128180834.GD24431@thunk.org> References: <1353323842-32283-1-git-send-email-sachin.kamat@linaro.org> <20121119133944.GA11095@gmail.com> <20121119162356.GB2337@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false X-Gm-Message-State: ALoCoQmYnHrYFx+esOpkTkSzHv4dSU+kEorq68vj3ERpqxNAvBd/4w5hvqXDJtxAoUXsES7nphK6 This is the patch which I plan to be using instead. There is more cleanup that could be done, but I assume the reason the reason why you were interested in this was to reduce ext4's compile time (we have protection against double inclusion, so it otherwise wouldn't have made much difference). So this approach (which I had suggested and had been hoping you would do :-) is better in that regard... - Ted commit 4a092d737955301da22b9d5e07f5036da821a932 Author: Theodore Ts'o Date: Wed Nov 28 13:03:30 2012 -0500 ext4: rationalize ext4_extents.h inclusion Previously, ext4_extents.h was being included at the end of ext4.h, which was bad for a number of reasons: (a) it was not being included in the expected place, and (b) it caused the header to be included multiple times. There were #ifdef's to prevent this from causing any problems, but it still was unnecessary. By moving the function declarations that were in ext4_extents.h to ext4.h, which is standard practice for where the function declarations for the rest of ext4.h can be found, we can remove ext4_extents.h from being included in ext4.h at all, and then we can only include ext4_extents.h where it is needed in ext4's source files. It should be possible to move a few more things into ext4.h, and further reduce the number of source files that need to #include ext4_extents.h, but that's a cleanup for another day. Reported-by: Sachin Kamat Reported-by: Wei Yongjun Signed-off-by: "Theodore Ts'o" diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 246e38f..2e9ffa9 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -57,6 +57,16 @@ #define ext4_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) #endif +/* + * Turn on EXT_DEBUG to get lots of info about extents operations. + */ +#define EXT_DEBUG__ +#ifdef EXT_DEBUG +#define ext_debug(fmt, ...) printk(fmt, ##__VA_ARGS__) +#else +#define ext_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) +#endif + #define EXT4_ERROR_INODE(inode, fmt, a...) \ ext4_error_inode((inode), __func__, __LINE__, 0, (fmt), ## a) @@ -2399,6 +2409,9 @@ extern int ext4_check_blockref(const char *, unsigned int, struct inode *, __le32 *, unsigned int); /* extents.c */ +struct ext4_ext_path; +struct ext4_extent; + extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, @@ -2416,8 +2429,27 @@ extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, ssize_t len); extern int ext4_map_blocks(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, int flags); +extern int ext4_ext_calc_metadata_amount(struct inode *inode, + ext4_lblk_t lblocks); +extern int ext4_extent_tree_init(handle_t *, struct inode *); +extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, + int num, + struct ext4_ext_path *path); +extern int ext4_can_extents_be_merged(struct inode *inode, + struct ext4_extent *ex1, + struct ext4_extent *ex2); +extern int ext4_ext_insert_extent(handle_t *, struct inode *, + struct ext4_ext_path *, + struct ext4_extent *, int); +extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t, + struct ext4_ext_path *); +extern void ext4_ext_drop_refs(struct ext4_ext_path *); +extern int ext4_ext_check_inode(struct inode *inode); +extern int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk); extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, __u64 start, __u64 len); + + /* move_extent.c */ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 start_orig, __u64 start_donor, @@ -2505,6 +2537,4 @@ extern void ext4_resize_end(struct super_block *sb); #endif /* __KERNEL__ */ -#include "ext4_extents.h" - #endif /* _EXT4_H */ diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h index 173b6c5..487fda1 100644 --- a/fs/ext4/ext4_extents.h +++ b/fs/ext4/ext4_extents.h @@ -43,16 +43,6 @@ #define CHECK_BINSEARCH__ /* - * Turn on EXT_DEBUG to get lots of info about extents operations. - */ -#define EXT_DEBUG__ -#ifdef EXT_DEBUG -#define ext_debug(fmt, ...) printk(fmt, ##__VA_ARGS__) -#else -#define ext_debug(fmt, ...) no_printk(fmt, ##__VA_ARGS__) -#endif - -/* * If EXT_STATS is defined then stats numbers are collected. * These number will be displayed at umount time. */ @@ -286,20 +276,5 @@ static inline void ext4_idx_store_pblock(struct ext4_extent_idx *ix, 0xffff); } -extern int ext4_ext_calc_metadata_amount(struct inode *inode, - ext4_lblk_t lblocks); -extern int ext4_extent_tree_init(handle_t *, struct inode *); -extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, - int num, - struct ext4_ext_path *path); -extern int ext4_can_extents_be_merged(struct inode *inode, - struct ext4_extent *ex1, - struct ext4_extent *ex2); -extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *, int); -extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t, - struct ext4_ext_path *); -extern void ext4_ext_drop_refs(struct ext4_ext_path *); -extern int ext4_ext_check_inode(struct inode *inode); -extern int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk); #endif /* _EXT4_EXTENTS */ diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 5625146..1dc19a7 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -41,6 +41,7 @@ #include #include #include "ext4_jbd2.h" +#include "ext4_extents.h" #include diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index f6663c3..20862f9 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c @@ -22,6 +22,7 @@ #include "ext4_jbd2.h" #include "truncate.h" +#include "ext4_extents.h" /* Needed for EXT_MAX_BLOCKS */ #include diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index f1bb32e..db8226d 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -14,6 +14,7 @@ #include #include "ext4_jbd2.h" +#include "ext4_extents.h" /* * The contiguous blocks details which can be diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 292daee..d9cc5ee 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -18,6 +18,7 @@ #include #include "ext4_jbd2.h" #include "ext4.h" +#include "ext4_extents.h" /** * get_ext_path - Find an extent path for designated logical block number. diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 0fd16e6..0016fbc 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -27,7 +27,6 @@ #include "ext4_jbd2.h" #include "xattr.h" #include "acl.h" -#include "ext4_extents.h" static struct kmem_cache *io_page_cachep, *io_end_cachep; diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 66a4e20..856206f 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -45,12 +45,11 @@ #include #include "ext4.h" -#include "ext4_extents.h" +#include "ext4_extents.h" /* Needed for trace points definition */ #include "ext4_jbd2.h" #include "xattr.h" #include "acl.h" #include "mballoc.h" -#include "ext4_extents.h" #define CREATE_TRACE_POINTS #include