Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btrfs-progs: convert: fix inline extent size for symbol link #884

Closed
wants to merge 1 commit into from

Commits on Sep 3, 2024

  1. btrfs-progs: convert: fix inline extent size for symbol link

    [BUG]
    For btrfs converted from ext* or reiserfs, the inlined data extent is
    always one byte larger than the inode size:
    
    	item 10 key (267 INODE_ITEM 0) itemoff 15543 itemsize 160
    		generation 1 transid 1 size 4 nbytes 5
    		block group 0 mode 120777 links 1 uid 0 gid 0 rdev 0
    		sequence 0 flags 0x0(none)
    	item 11 key (267 INODE_REF 256) itemoff 15529 itemsize 14
    		index 3 namelen 4 name: path
    	item 12 key (267 EXTENT_DATA 0) itemoff 15503 itemsize 26
    		generation 4 type 0 (inline)
    		inline extent data size 5 ram_bytes 5 compression 0 (none)
    
    [CAUSE]
    Inside the symbol link creation path for each fs, they all create the
    inline data extent with a tailing NUL ('\0').
    
    This is different from what btrfs kernel module does:
    
    	item 4 key (257 INODE_ITEM 0) itemoff 15883 itemsize 160
    		generation 9 transid 9 size 4 nbytes 4
    		block group 0 mode 120777 links 1 uid 0 gid 0 rdev 0
    		sequence 0 flags 0x0(none)
    	item 5 key (257 INODE_REF 256) itemoff 15869 itemsize 14
    		index 2 namelen 4 name: path
    	item 6 key (257 EXTENT_DATA 0) itemoff 15844 itemsize 25
    		generation 9 type 0 (inline)
    		inline extent data size 4 ram_bytes 4 compression 0 (none)
    
    [FIX]
    Thankfully this is not a big deal, kernel properly reads the content and
    use inode size to determine the proper link target.
    
    Just align the btrfs-progs convert behavior to the kernel one.
    
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    adam900710 committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    08ff5d6 View commit details
    Browse the repository at this point in the history