* [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations.
@ 2010-03-09 5:12 Tao Ma
2010-03-09 9:33 ` jeff.liu
2010-03-10 1:43 ` Joel Becker
0 siblings, 2 replies; 5+ messages in thread
From: Tao Ma @ 2010-03-09 5:12 UTC (permalink / raw)
To: ocfs2-devel
In reflink, we need to upate i_blocks for the target inode.
Reported-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
fs/ocfs2/refcounttree.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 9e96921..f4aad88 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -4075,6 +4075,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
OCFS2_I(t_inode)->ip_dyn_features = OCFS2_I(s_inode)->ip_dyn_features;
spin_unlock(&OCFS2_I(t_inode)->ip_lock);
i_size_write(t_inode, size);
+ t_inode->i_blocks = ocfs2_inode_sector_count(t_inode);
di->i_xattr_inline_size = s_di->i_xattr_inline_size;
di->i_clusters = s_di->i_clusters;
--
1.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations.
2010-03-09 5:12 [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations Tao Ma
@ 2010-03-09 9:33 ` jeff.liu
2010-03-10 1:43 ` Joel Becker
1 sibling, 0 replies; 5+ messages in thread
From: jeff.liu @ 2010-03-09 9:33 UTC (permalink / raw)
To: ocfs2-devel
Hi Tao,
It works for my simple tests.
st_blks_ref is a flesh reflinked file.
jeff at jeff-laptop:/ocfs2$ ./st st_blks_ref
blocks#: 2048
It will show ZERO without this patch.
jeff at jeff-laptop:/ocfs2$ cat st.c
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int fd;
struct stat st;
if (!argv[1]) {
fprintf(stderr, "Usage:%s pathname\n", argv[0]);
return -1;
}
fd = open(argv[1], O_RDONLY);
if (fd < 0) {
perror("open");
return -1;
}
if (fstat(fd, &st) < 0) {
perror("fstat");
return -1;
}
fprintf(stderr, "blocks#: %d\n", st.st_blocks);
return 0;
}
Thanks,
Jeff
Tao Ma wrote:
> In reflink, we need to upate i_blocks for the target inode.
>
> Reported-by: Jie Liu <jeff.liu@oracle.com>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
> ---
> fs/ocfs2/refcounttree.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
> index 9e96921..f4aad88 100644
> --- a/fs/ocfs2/refcounttree.c
> +++ b/fs/ocfs2/refcounttree.c
> @@ -4075,6 +4075,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
> OCFS2_I(t_inode)->ip_dyn_features = OCFS2_I(s_inode)->ip_dyn_features;
> spin_unlock(&OCFS2_I(t_inode)->ip_lock);
> i_size_write(t_inode, size);
> + t_inode->i_blocks = ocfs2_inode_sector_count(t_inode);
>
> di->i_xattr_inline_size = s_di->i_xattr_inline_size;
> di->i_clusters = s_di->i_clusters;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations.
2010-03-09 5:12 [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations Tao Ma
2010-03-09 9:33 ` jeff.liu
@ 2010-03-10 1:43 ` Joel Becker
1 sibling, 0 replies; 5+ messages in thread
From: Joel Becker @ 2010-03-10 1:43 UTC (permalink / raw)
To: ocfs2-devel
On Tue, Mar 09, 2010 at 01:12:59PM +0800, Tao Ma wrote:
> In reflink, we need to upate i_blocks for the target inode.
>
> Reported-by: Jie Liu <jeff.liu@oracle.com>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
> ---
> fs/ocfs2/refcounttree.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
> index 9e96921..f4aad88 100644
> --- a/fs/ocfs2/refcounttree.c
> +++ b/fs/ocfs2/refcounttree.c
> @@ -4075,6 +4075,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
> OCFS2_I(t_inode)->ip_dyn_features = OCFS2_I(s_inode)->ip_dyn_features;
> spin_unlock(&OCFS2_I(t_inode)->ip_lock);
> i_size_write(t_inode, size);
> + t_inode->i_blocks = ocfs2_inode_sector_count(t_inode);
Curiously, why wouldn't it just be s_inode->i_blocks?
Joel
--
Life's Little Instruction Book #451
"Don't be afraid to say, 'I'm sorry.'"
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations.
@ 2010-03-10 1:56 Tao Ma
2010-03-17 19:29 ` Joel Becker
0 siblings, 1 reply; 5+ messages in thread
From: Tao Ma @ 2010-03-10 1:56 UTC (permalink / raw)
To: ocfs2-devel
Hi Joel,
>> + t_inode->i_blocks = ocfs2_inode_sector_count(t_inode);
> Curiously, why wouldn't it just be s_inode->i_blocks?
yeah, using i_blocks looks more natural. Here is the updated one.
Regards,
Tao
From 08c37fec54533cf3a04285caceda908eccab9d57 Mon Sep 17 00:00:00 2001
From: Tao Ma <tao.ma@oracle.com>
Date: Wed, 10 Mar 2010 09:45:00 +0800
Subject: [PATCH] ocfs2: Update i_blocks in reflink operations.
In reflink, we need to upate i_blocks for the target inode.
Reported-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
fs/ocfs2/refcounttree.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 9e96921..29405f2 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -4075,6 +4075,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
OCFS2_I(t_inode)->ip_dyn_features = OCFS2_I(s_inode)->ip_dyn_features;
spin_unlock(&OCFS2_I(t_inode)->ip_lock);
i_size_write(t_inode, size);
+ t_inode->i_blocks = s_inode->i_blocks;
di->i_xattr_inline_size = s_di->i_xattr_inline_size;
di->i_clusters = s_di->i_clusters;
--
1.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations.
2010-03-10 1:56 Tao Ma
@ 2010-03-17 19:29 ` Joel Becker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Becker @ 2010-03-17 19:29 UTC (permalink / raw)
To: ocfs2-devel
On Wed, Mar 10, 2010 at 09:56:52AM +0800, Tao Ma wrote:
> In reflink, we need to upate i_blocks for the target inode.
>
> Reported-by: Jie Liu <jeff.liu@oracle.com>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
This patch is now in the fixes branch of ocfs2.git.
Joel
--
"To fall in love is to create a religion that has a fallible god."
-Jorge Luis Borges
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-17 19:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 5:12 [Ocfs2-devel] [PATCH] ocfs2: Update i_blocks in reflink operations Tao Ma
2010-03-09 9:33 ` jeff.liu
2010-03-10 1:43 ` Joel Becker
-- strict thread matches above, loose matches on Subject: below --
2010-03-10 1:56 Tao Ma
2010-03-17 19:29 ` Joel Becker
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.