Commit 5bb0087
btrfs: simplify error handling logic for btrfs_link()
Instead of incrementing the inode's link count and refcount early before
adding the link, updating the inode and deleting orphan item, do it after
all those steps succeeded right before calling d_instantiate(). This makes
the error handling logic simpler by avoiding the need for the 'drop_inode'
variable to signal if we need to undo the link count increment and the
inode refcount increase under the 'fail' label.
This also reduces the level of indentation by one, making the code easier
to read.
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Filipe Manana <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent e87e953 commit 5bb0087
1 file changed
+19
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6805 | 6805 | | |
6806 | 6806 | | |
6807 | 6807 | | |
6808 | | - | |
6809 | 6808 | | |
6810 | 6809 | | |
6811 | 6810 | | |
| |||
6837 | 6836 | | |
6838 | 6837 | | |
6839 | 6838 | | |
6840 | | - | |
6841 | 6839 | | |
6842 | 6840 | | |
6843 | | - | |
6844 | 6841 | | |
6845 | 6842 | | |
6846 | 6843 | | |
6847 | 6844 | | |
| 6845 | + | |
| 6846 | + | |
6848 | 6847 | | |
| 6848 | + | |
| 6849 | + | |
| 6850 | + | |
6849 | 6851 | | |
6850 | | - | |
6851 | | - | |
6852 | | - | |
| 6852 | + | |
| 6853 | + | |
| 6854 | + | |
6853 | 6855 | | |
6854 | | - | |
| 6856 | + | |
| 6857 | + | |
| 6858 | + | |
| 6859 | + | |
| 6860 | + | |
| 6861 | + | |
6855 | 6862 | | |
6856 | 6863 | | |
6857 | | - | |
6858 | 6864 | | |
6859 | 6865 | | |
6860 | | - | |
6861 | | - | |
6862 | | - | |
6863 | | - | |
6864 | | - | |
6865 | | - | |
6866 | | - | |
6867 | | - | |
6868 | | - | |
6869 | | - | |
6870 | | - | |
6871 | | - | |
6872 | | - | |
6873 | | - | |
6874 | 6866 | | |
6875 | 6867 | | |
| 6868 | + | |
| 6869 | + | |
| 6870 | + | |
| 6871 | + | |
| 6872 | + | |
6876 | 6873 | | |
6877 | 6874 | | |
6878 | 6875 | | |
6879 | 6876 | | |
6880 | | - | |
6881 | | - | |
6882 | | - | |
6883 | | - | |
6884 | 6877 | | |
6885 | 6878 | | |
6886 | 6879 | | |
| |||
0 commit comments