Skip to content

Commit 06ee5c7

Browse files
josephhztorvalds
authored andcommitted
ocfs2: add functions to add and remove inode in orphan dir
Add functions to add inode to orphan dir and remove inode in orphan dir. Here we do not call ocfs2_prepare_orphan_dir and ocfs2_orphan_add directly. Because append O_DIRECT will add inode to orphan two and may result in more than one orphan entry for the same inode. [akpm@linux-foundation.org: avoid dynamic stack allocation] Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Cc: Weiwei Wang <wangww631@huawei.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Xuejiufei <xuejiufei@huawei.com> Cc: alex chen <alex.chen@huawei.com> Cc: Fengguang Wu <fengguang.wu@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 026749a commit 06ee5c7

File tree

5 files changed

+238
-30
lines changed

5 files changed

+238
-30
lines changed

fs/ocfs2/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ static int ocfs2_remove_inode(struct inode *inode,
648648

649649
if (!(OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) {
650650
status = ocfs2_orphan_del(osb, handle, orphan_dir_inode, inode,
651-
orphan_dir_bh);
651+
orphan_dir_bh, false);
652652
if (status < 0) {
653653
mlog_errno(status);
654654
goto bail_commit;

fs/ocfs2/journal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,11 @@ static inline int ocfs2_unlink_credits(struct super_block *sb)
472472
* orphan dir index leaf */
473473
#define OCFS2_DELETE_INODE_CREDITS (3 * OCFS2_INODE_UPDATE_CREDITS + 4)
474474

475+
/* dinode + orphan dir dinode + extent tree leaf block + orphan dir entry +
476+
* orphan dir index root + orphan dir index leaf */
477+
#define OCFS2_INODE_ADD_TO_ORPHAN_CREDITS (2 * OCFS2_INODE_UPDATE_CREDITS + 4)
478+
#define OCFS2_INODE_DEL_FROM_ORPHAN_CREDITS OCFS2_INODE_ADD_TO_ORPHAN_CREDITS
479+
475480
/* dinode update, old dir dinode update, new dir dinode update, old
476481
* dir dir entry, new dir dir entry, dir entry update for renaming
477482
* directory + target unlink + 3 x dir index leaves */

0 commit comments

Comments
 (0)