linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Btrfs: fix btrfs_is_free_space_inode to recognize btree inode
@ 2012-07-10 11:28 Liu Bo
  2012-07-10 11:28 ` [PATCH 2/2] Btrfs: kill root from btrfs_is_free_space_inode Liu Bo
  2012-07-18 10:02 ` [PATCH 1/2] Btrfs: fix btrfs_is_free_space_inode to recognize btree inode Alex Lyakas
  0 siblings, 2 replies; 7+ messages in thread
From: Liu Bo @ 2012-07-10 11:28 UTC (permalink / raw)
  To: linux-btrfs

For btree inode, its root is also 'tree root', so btree inode can be
misunderstood as a free space inode.

We should add one more check for btree inode.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/btrfs_inode.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 12394a9..b168238 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -194,8 +194,10 @@ static inline void btrfs_i_size_write(struct inode *inode, u64 size)
 static inline bool btrfs_is_free_space_inode(struct btrfs_root *root,
 				       struct inode *inode)
 {
-	if (root == root->fs_info->tree_root ||
-	    BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID)
+	if (root == root->fs_info->tree_root &&
+	    btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
+		return true;
+	if (BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID)
 		return true;
 	return false;
 }
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-18 12:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10 11:28 [PATCH 1/2] Btrfs: fix btrfs_is_free_space_inode to recognize btree inode Liu Bo
2012-07-10 11:28 ` [PATCH 2/2] Btrfs: kill root from btrfs_is_free_space_inode Liu Bo
2012-07-17 13:43   ` David Sterba
2012-07-18  1:03     ` Liu Bo
2012-07-18 10:02 ` [PATCH 1/2] Btrfs: fix btrfs_is_free_space_inode to recognize btree inode Alex Lyakas
2012-07-18 12:02   ` Liu Bo
2012-07-18 12:39     ` Alex Lyakas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).