Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
btrfsprogs
btrfs-progs-convert-convert-ext-inode-flags-to-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File btrfs-progs-convert-convert-ext-inode-flags-to-btrfs-inode-flags.patch of Package btrfsprogs
From: Qu Wenruo <quwenruo@cn.fujitsu.com> Subject: btrfs-progs: convert: Convert ext inode flags to btrfs inode flags Git-commit: 8570a0c3a4f681bc5ae1f04c56730bea8fb6cdc9 Patch-mainline: v4.8.2 References: bsc#1042369 Before this patch, btrfs-convert never copy ext* inode flags to corresponding btrfs inode flags. This makes common flags like APPEND/SYNC/SYNCDIR/IMMUTABLE not copied to btrfs inode. This patch introduces ext2_convert_inode_flags() function to handle the convert, so btrfs-convert can copy as many inode flags as possible. Reported-by: Lakshmipathi.G <lakshmipathi.g@gmail.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com> Acked-by: Jeff Mahoney <jeffm@suse.com> --- btrfs-convert.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/btrfs-convert.c b/btrfs-convert.c index 542179eb..2bcc16cd 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -2201,6 +2201,31 @@ static int ext2_check_state(struct btrfs_convert_context *cctx) return 0; } +/* EXT2_*_FL to BTRFS_INODE_FLAG_* stringification helper */ +#define COPY_ONE_EXT2_FLAG(flags, ext2_inode, name) ({ \ + if (ext2_inode->i_flags & EXT2_##name##_FL) \ + flags |= BTRFS_INODE_##name; \ +}) + +/* + * Convert EXT2_*_FL to corresponding BTRFS_INODE_* flags + * + * Only a subset of EXT_*_FL is supported in btrfs. + */ +static void ext2_convert_inode_flags(struct btrfs_inode_item *dst, + struct ext2_inode *src) +{ + u64 flags = 0; + + COPY_ONE_EXT2_FLAG(flags, src, APPEND); + COPY_ONE_EXT2_FLAG(flags, src, SYNC); + COPY_ONE_EXT2_FLAG(flags, src, IMMUTABLE); + COPY_ONE_EXT2_FLAG(flags, src, NODUMP); + COPY_ONE_EXT2_FLAG(flags, src, NOATIME); + COPY_ONE_EXT2_FLAG(flags, src, DIRSYNC); + btrfs_set_stack_inode_flags(dst, flags); +} + /* * copy a single inode. do all the required works, such as cloning * inode item, creating file extents and creating directory entries. @@ -2223,6 +2248,7 @@ static int ext2_copy_single_inode(struct btrfs_trans_handle *trans, BTRFS_INODE_NODATASUM; btrfs_set_stack_inode_flags(&btrfs_inode, flags); } + ext2_convert_inode_flags(&btrfs_inode, ext2_inode); switch (ext2_inode->i_mode & S_IFMT) { case S_IFREG:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor