* [PATCH 5/5] Btrfs: fix missing log when BTRFS_INODE_NEEDS_FULL_SYNC is set
@ 2012-11-01 7:35 Miao Xie
2012-11-01 9:21 ` Liu Bo
0 siblings, 1 reply; 3+ messages in thread
From: Miao Xie @ 2012-11-01 7:35 UTC (permalink / raw)
To: Linux Btrfs
If we set BTRFS_INODE_NEEDS_FULL_SYNC, we should log all the extent,
but now we forget to take it into account, and set a wrong max key,
if so, we will skip the file extent metadata when doing logging. Fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/btrfs/tree-log.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index f7e9387..c495b47 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3394,7 +3394,10 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
/* today the code can only do partial logging of directories */
- if (inode_only == LOG_INODE_EXISTS || S_ISDIR(inode->i_mode))
+ if (S_ISDIR(inode->i_mode) ||
+ (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
+ &BTRFS_I(inode)->runtime_flags) &&
+ inode_only == LOG_INODE_EXISTS))
max_key.type = BTRFS_XATTR_ITEM_KEY;
else
max_key.type = (u8)-1;
--
1.7.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 5/5] Btrfs: fix missing log when BTRFS_INODE_NEEDS_FULL_SYNC is set
2012-11-01 7:35 [PATCH 5/5] Btrfs: fix missing log when BTRFS_INODE_NEEDS_FULL_SYNC is set Miao Xie
@ 2012-11-01 9:21 ` Liu Bo
2012-11-02 4:00 ` Miao Xie
0 siblings, 1 reply; 3+ messages in thread
From: Liu Bo @ 2012-11-01 9:21 UTC (permalink / raw)
To: Miao Xie; +Cc: Linux Btrfs
On Thu, Nov 01, 2012 at 03:35:23PM +0800, Miao Xie wrote:
> If we set BTRFS_INODE_NEEDS_FULL_SYNC, we should log all the extent,
> but now we forget to take it into account, and set a wrong max key,
> if so, we will skip the file extent metadata when doing logging. Fix it.
>
But it's along with LOG_INODE_EXISTS, which is set by rename and link
and means we need to log just enough to rebuild the inode during log replay.
On the other side, if we do log all the extents because of having set
BTRFS_INODE_NEEDS_FULL_SYNC, we don't know if we actually get what we
want because rename and link do not wait for dirty pages as fsync does.
thanks,
liubo
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> fs/btrfs/tree-log.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index f7e9387..c495b47 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -3394,7 +3394,10 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
>
>
> /* today the code can only do partial logging of directories */
> - if (inode_only == LOG_INODE_EXISTS || S_ISDIR(inode->i_mode))
> + if (S_ISDIR(inode->i_mode) ||
> + (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
> + &BTRFS_I(inode)->runtime_flags) &&
> + inode_only == LOG_INODE_EXISTS))
> max_key.type = BTRFS_XATTR_ITEM_KEY;
> else
> max_key.type = (u8)-1;
> --
> 1.7.6.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/5] Btrfs: fix missing log when BTRFS_INODE_NEEDS_FULL_SYNC is set
2012-11-01 9:21 ` Liu Bo
@ 2012-11-02 4:00 ` Miao Xie
0 siblings, 0 replies; 3+ messages in thread
From: Miao Xie @ 2012-11-02 4:00 UTC (permalink / raw)
To: Linux Btrfs
On thu, 1 Nov 2012 17:21:12 +0800, Liu Bo wrote:
> On Thu, Nov 01, 2012 at 03:35:23PM +0800, Miao Xie wrote:
>> If we set BTRFS_INODE_NEEDS_FULL_SYNC, we should log all the extent,
>> but now we forget to take it into account, and set a wrong max key,
>> if so, we will skip the file extent metadata when doing logging. Fix it.
>>
>
> But it's along with LOG_INODE_EXISTS, which is set by rename and link
> and means we need to log just enough to rebuild the inode during log replay.
>
> On the other side, if we do log all the extents because of having set
> BTRFS_INODE_NEEDS_FULL_SYNC, we don't know if we actually get what we
> want because rename and link do not wait for dirty pages as fsync does.
Full sync is the safest way to log. I think we should not ignore it since it
is set.
Thanks
Miao
>
> thanks,
> liubo
>
>> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>> fs/btrfs/tree-log.c | 5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
>> index f7e9387..c495b47 100644
>> --- a/fs/btrfs/tree-log.c
>> +++ b/fs/btrfs/tree-log.c
>> @@ -3394,7 +3394,10 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
>>
>>
>> /* today the code can only do partial logging of directories */
>> - if (inode_only == LOG_INODE_EXISTS || S_ISDIR(inode->i_mode))
>> + if (S_ISDIR(inode->i_mode) ||
>> + (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
>> + &BTRFS_I(inode)->runtime_flags) &&
>> + inode_only == LOG_INODE_EXISTS))
>> max_key.type = BTRFS_XATTR_ITEM_KEY;
>> else
>> max_key.type = (u8)-1;
>> --
>> 1.7.6.5
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-02 3:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 7:35 [PATCH 5/5] Btrfs: fix missing log when BTRFS_INODE_NEEDS_FULL_SYNC is set Miao Xie
2012-11-01 9:21 ` Liu Bo
2012-11-02 4:00 ` Miao Xie
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).