summaryrefslogtreecommitdiff
path: root/inode.c
Commit message (Collapse)AuthorAge
* btrfs-progs: check: adjustments for further repairSu Yue2017-10-16
| | | | | | | | | | | For code reuse, btrfs_insert_dir_item() now calls inserts_with_overflow() even if the dir_item existed. Add a parameter @ignore_existed to btrfs_add_link(). If @ignore_existed is not zero, btrfs_add_link() continues to do link. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add a parameter to btrfs_mksubvolYingyi Luo2017-10-06
| | | | | | | | A convert parameter is added as a flag to indicate if btrfs_mksubvol() is used for btrfs-convert. The change cascades down to the callchain. Signed-off-by: Yingyi Luo <yingyil@google.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: move link_subvol out of mainYingyi Luo2017-10-06
| | | | | | | | link_subvol() is moved to inode.c and renamed as btrfs_mksubvol(). The change cascades down to the callchain. Signed-off-by: Yingyi Luo <yingyil@google.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: remove unused argument from btrfs_lookup_inode_refDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix a regression that ext2_save/image is not readonlyQu Wenruo2016-08-19
| | | | | | | | | | | | | | | | | | The new convert treats the convert image as a normal file, without any special flags and permissions. This is different from original code: 1) Permission changed from 0400 to 0600 2) Inode lacks READONLY flag This makes we can read-write mount the ext2 image and cause rollback failure. Follow old code behavior, use 0400 permission and add back READONLY flag to fix it. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: typo review of strings and commentsNicholas D Steeves2016-06-01
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: handle orphan creation error in btrfs_unlinkDavid Sterba2015-01-06
| | | | | | | | The error handling is simple and just returns an error upward, no cleanup. Resolves-coverity-id: 1260251 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add inode item rebuild function.Qu Wenruo2014-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a basic inode item rebuild function for I_ERR_NO_INODE_ITEM. The main use case is to repair btrfs which fs root has corrupted leaf, but it is already working for case if the corrupteed fs root leaf/node contains no inode extent_data. The repair needs 3 elements for inode rebuild: 1. inode number This is quite easy, existing inode_record codes will detect it quite well. 2. inode type This is the trick part. The only reliable method is to recovery it from parent's dir_index/item. The remaining method will search for regular file extent for FILE type or child's backref for DIR(todo). Fallback will be FILE. Inode name(inode_ref) will be recoverd by nlink repair function. This is just a fundamental implement, some advanced recovery can be improved later with btrfs-progs infrastructure change. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add btrfs_mkdir() function for the incoming 'lost+found' fsck ↵Qu Wenruo2014-12-10
| | | | | | | | | | | | | mechanism. With the previous btrfs inode operations patches, now we can use btrfs_mkdir() to create the 'lost+found' dir to do some data salvage in btrfsck. This patch along with previous ones will make data salvage easier. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add btrfs_unlink() and btrfs_add_link() functions.Qu Wenruo2014-12-10
Add btrfs_unlink() and btrfs_add_link() functions in inode.c, for the incoming btrfs_mkdir() and later inode operations functions. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>