ocfs2: Update i_blocks in reflink operations.
PATCH 1/1 ocfs2: Update i_blocks in reflink operations.
In reflink, we need to upate i_blocks for the target inode.
--- fs/ocfs2/refcounttree.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
fs/ocfs2/refcounttree.c +1 -0
@@ -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;
Signature · 1 line
1.5.5
PATCH 1/1 ocfs2: Update i_blocks in reflink operations.
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
Quoted 20 lines · Tao Ma
In reflink, we need to upate
i_blocksfor the target inode.Reported-by Jie Liu <[email protected]>Signed-off-by Tao Ma <[email protected]>--- fs/ocfs2/refcounttree.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)fs/ocfs2/refcounttree.c +1
-0@@ -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;
PATCH 1/1 ocfs2: Update i_blocks in reflink operations.
In reply to Tao MaQuoted 13 lines · Tao Ma
In reflink, we need to upate
i_blocksfor the target inode.Reported-by Jie Liu <[email protected]>Signed-off-by Tao Ma <[email protected]>--- fs/ocfs2/refcounttree.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)fs/ocfs2/refcounttree.c +0
-0
fs/ocfs2/refcounttree.c static int ocfs2_complete_reflink(struct inode *s_inode, · line 4078
Quoted 4 lines
fs/ocfs2/refcounttree.c +1
-0@@ -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
Signature · 9 lines
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