/* They revolve around files there were unlinked from the directory, and this function updates the parent directory so that a full commit is properly done if it is fsync'd later after the unlinks are done.  */
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, struct inode *dir, struct inode *inode, int for_rename)
/* They revolve around files there were unlinked from the directory, and this function updates the parent directory so that a full commit is properly done if it is fsync'd later after the unlinks are done.  */
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, struct inode *dir, struct inode *inode, int for_rename)
{
	if (S_ISREG(inode->i_mode))
		BTRFS_I(inode)->last_unlink_trans = trans->transid;
	smp_mb();
	if (BTRFS_I(dir)->logged_trans == trans->transid)
		return;
	if (BTRFS_I(inode)->logged_trans == trans->transid)
		return;
	if (for_rename)
		goto record;
	return;
record:
	BTRFS_I(dir)->last_unlink_trans = trans->transid;
}