Index: linux-stage/fs/ext4/namei.c =================================================================== --- linux-stage.orig/fs/ext4/namei.c +++ linux-stage/fs/ext4/namei.c @@ -1609,7 +1709,7 @@ static void ext4_inc_count(handle_t *han * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2, * since this indicates that nlinks count was previously 1. */ -static void ext4_inc_count(handle_t *handle, struct inode *inode) +void ext4_inc_count(handle_t *handle, struct inode *inode) { inc_nlink(inode); if (is_dx(inode) && inode->i_nlink > 1) { @@ -1709,17 +1709,18 @@ static void ext4_inc_count(handle_t *han } } } +EXPORT_SYMBOL(ext4_inc_count); /* * If a directory had nlink == 1, then we should let it be 1. This indicates * directory has >EXT4_LINK_MAX subdirs. */ -static void ext4_dec_count(handle_t *handle, struct inode *inode) +void ext4_dec_count(handle_t *handle, struct inode *inode) { - drop_nlink(inode); - if (S_ISDIR(inode->i_mode) && inode->i_nlink == 0) - inc_nlink(inode); + if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2) + drop_nlink(inode); } +EXPORT_SYMBOL(ext4_dec_count); static int ext4_add_nondir(handle_t *handle,