Lines Matching defs:inode
20 #include "inode-map.h"
27 * LOG_INODE_EXISTS means to log just enough to recreate the inode
40 * 1) on rename or unlink, if the inode being unlinked isn't in the fsync
56 * log. ---> check inode while renaming/linking.
60 * ---> check inode and old parent dir during rename
76 * directory tree. The inode link count fixup code takes care of the
97 struct btrfs_root *root, struct btrfs_inode *inode,
274 * Ignore any items from the inode currently being processed. Needs
412 * We need to load the old nbytes into the inode so when we
441 * New inode, set nbytes to 0 so that the nbytes comes out
479 /* don't overwrite an existing inode if the generation number
481 * is just logging an inode to make sure it exists after recovery.
501 * logging that an inode exists, as part of a directory
502 * fsync, and the inode wasn't fsynced before. In this
503 * case don't set the size of the inode in the fs/subvol
547 * simple helper to read an inode off the disk from a given root
550 static noinline struct inode *read_one_inode(struct btrfs_root *root,
553 struct inode *inode;
555 inode = btrfs_iget(root->fs_info->sb, objectid, root);
556 if (IS_ERR(inode))
557 inode = NULL;
558 return inode;
585 struct inode *inode = NULL;
613 inode = read_one_inode(root, key->objectid);
614 if (!inode) {
625 btrfs_ino(BTRFS_I(inode)), start, 0);
656 ret = btrfs_drop_extents(trans, root, inode, start, extent_end, 1);
828 ret = btrfs_inode_set_file_extent_range(BTRFS_I(inode), start,
833 inode_add_bytes(inode, nbytes);
835 ret = btrfs_update_inode(trans, root, inode);
837 if (inode)
838 iput(inode);
845 * inode back references, we may have to unlink inodes from directories.
856 struct inode *inode;
874 inode = read_one_inode(root, location.objectid);
875 if (!inode) {
884 ret = btrfs_unlink_inode(trans, root, dir, BTRFS_I(inode), name,
892 iput(inode);
897 * See if a given name and sequence number found in an inode back reference are
898 * already in a directory and correctly point to this inode.
943 * an inode. This is used to decide if a back reference that is
946 * inode backreferences may have multiple refs in a single item,
990 struct btrfs_inode *inode,
1047 inc_nlink(&inode->vfs_inode);
1050 ret = btrfs_unlink_inode(trans, root, dir, inode,
1084 struct inode *victim_parent;
1121 inc_nlink(&inode->vfs_inode);
1126 inode,
1221 * Take an inode reference item from the log tree and iterate all names from the
1222 * inode reference item in the subvolume tree with the same key (if it exists).
1223 * For any name that is not in the inode reference item from the log tree, do a
1224 * proper unlink of that name (that is, remove its entry from the inode
1230 struct btrfs_inode *inode,
1278 struct inode *dir;
1288 inode, name, namelen);
1318 static int btrfs_inode_ref_exists(struct inode *inode, struct inode *dir,
1331 key.objectid = btrfs_ino(BTRFS_I(inode));
1338 ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &key, path, 0, 0);
1358 struct inode *dir, struct inode *inode, const char *name,
1364 struct inode *other_inode = NULL;
1383 * Our inode's dentry collides with the dentry of another inode which is
1384 * in the log but not yet processed since it has a higher inode number.
1400 * on the inode will not free it. We will fixup the link count later.
1409 ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
1419 * replay one inode back reference item found in the log tree.
1431 struct inode *dir = NULL;
1432 struct inode *inode = NULL;
1463 * for a given inode. If we don't find the dir, just don't
1473 inode = read_one_inode(root, inode_objectid);
1474 if (!inode) {
1501 btrfs_ino(BTRFS_I(inode)), ref_index,
1517 BTRFS_I(inode),
1530 * If a reference item already exists for this inode
1537 ret = btrfs_inode_ref_exists(inode, dir, key->type,
1542 BTRFS_I(inode),
1546 * that later the iput() on the inode will not
1549 if (!ret && inode->i_nlink == 0)
1550 inc_nlink(inode);
1565 ret = add_link(trans, root, dir, inode, name, namelen,
1570 btrfs_update_inode(trans, root, inode);
1584 * Before we overwrite the inode reference item in the subvolume tree
1586 * parent directory that are in the subvolume's tree inode reference
1588 * dir index entries exist for a name but there is no inode reference
1591 ret = unlink_old_inode_refs(trans, root, path, BTRFS_I(inode), eb, slot,
1596 /* finally write the back reference in the inode */
1602 iput(inode);
1619 struct btrfs_inode *inode, struct btrfs_path *path)
1626 u64 inode_objectid = btrfs_ino(inode);
1663 struct btrfs_inode *inode, struct btrfs_path *path)
1671 u64 ino = btrfs_ino(inode);
1725 * The scan will update the link count on the inode to reflect the
1727 * will free the inode.
1731 struct inode *inode)
1736 u64 ino = btrfs_ino(BTRFS_I(inode));
1742 ret = count_inode_refs(root, BTRFS_I(inode), path);
1748 ret = count_inode_extrefs(root, BTRFS_I(inode), path);
1756 if (nlink != inode->i_nlink) {
1757 set_nlink(inode, nlink);
1758 btrfs_update_inode(trans, root, inode);
1760 BTRFS_I(inode)->index_cnt = (u64)-1;
1762 if (inode->i_nlink == 0) {
1763 if (S_ISDIR(inode->i_mode)) {
1783 struct inode *inode;
1810 inode = read_one_inode(root, key.offset);
1811 if (!inode) {
1816 ret = fixup_inode_link_count(trans, root, inode);
1817 iput(inode);
1834 * record a given inode in the fixup dir so we can check its link
1836 * so the inode won't go away until we check it
1845 struct inode *inode;
1847 inode = read_one_inode(root, objectid);
1848 if (!inode)
1859 if (!inode->i_nlink)
1860 set_nlink(inode, 1);
1862 inc_nlink(inode);
1863 ret = btrfs_update_inode(trans, root, inode);
1867 iput(inode);
1883 struct inode *inode;
1884 struct inode *dir;
1887 inode = read_one_inode(root, location->objectid);
1888 if (!inode)
1893 iput(inode);
1897 ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode), name,
1900 /* FIXME, put inode into FIXUP list */
1902 iput(inode);
1912 * the inode it points to is unlinked and put into the link count
1921 * non-existing inode) and 1 if the name was replayed.
1935 struct inode *dir;
2005 * don't drop the conflicting directory entry if the inode
2031 * Check if the inode reference exists in the log for the given name,
2032 * inode and parent inode
2107 * the inode it the entry points to. Otherwise something like
2109 * inode with a wrong link that does not account for this dir
2237 * item is not in the log, the item is removed and the inode it points
2245 struct inode *dir,
2258 struct inode *inode;
2293 inode = read_one_inode(root, location.objectid);
2294 if (!inode) {
2303 iput(inode);
2307 inc_nlink(inode);
2309 BTRFS_I(inode), name, name_len);
2313 iput(inode);
2464 struct inode *dir;
2473 /* it isn't an error if the inode isn't there, that can happen
2474 * because we replay the deletes before we copy in the inode item
2559 * only in the log (references come from either directory items or inode
2589 /* inode keys are done during the first stage */
2628 * Before replaying extents, truncate the inode to its
2631 * added beyond the inode's i_size. If we did it after,
2636 struct inode *inode;
2639 inode = read_one_inode(root, key.objectid);
2640 if (!inode) {
2644 from = ALIGN(i_size_read(inode),
2646 ret = btrfs_drop_extents(wc->trans, root, inode,
2649 /* Update the inode's nbytes. */
2651 root, inode);
2653 iput(inode);
3355 * Check if an inode was logged in the current transaction. We can't always rely
3356 * on an inode's logged_trans value, because it's an in-memory only field and
3357 * therefore not persisted. This means that its value is lost if the inode gets
3360 * the full_sync flag is set in the inode's runtime flags, so on that case we
3362 * worst case, that the inode was logged before in the current transaction.
3365 struct btrfs_inode *inode)
3367 if (inode->logged_trans == trans->transid)
3370 if (inode->last_trans == trans->transid &&
3371 test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags) &&
3391 * We solve this by removing directory entries and inode backrefs from the
3396 * This optimizations allows us to avoid relogging the entire inode
3512 struct btrfs_inode *inode, u64 dirid)
3518 if (!inode_logged(trans, inode))
3525 mutex_lock(&inode->log_mutex);
3527 ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(inode),
3529 mutex_unlock(&inode->log_mutex);
3579 struct btrfs_root *root, struct btrfs_inode *inode,
3594 u64 ino = btrfs_ino(inode);
3697 * the corresponding inode, after log replay, has a
3709 * file inode would have a link count of 1, but we get
3710 * two directory entries pointing to the same inode.
3787 struct btrfs_root *root, struct btrfs_inode *inode,
3801 ret = log_dir_items(trans, root, inode, path, dst_path, key_type,
3819 * inode. max_key_type indicates the highest item type to remove.
3878 struct inode *inode, int log_inode_only,
3888 * just to say 'this inode exists' and a logging
3889 * to say 'update this inode with these values'
3895 BTRFS_I(inode)->generation);
3896 btrfs_set_token_inode_size(&token, item, inode->i_size);
3899 btrfs_set_token_inode_uid(&token, item, i_uid_read(inode));
3900 btrfs_set_token_inode_gid(&token, item, i_gid_read(inode));
3901 btrfs_set_token_inode_mode(&token, item, inode->i_mode);
3902 btrfs_set_token_inode_nlink(&token, item, inode->i_nlink);
3905 inode->i_atime.tv_sec);
3907 inode->i_atime.tv_nsec);
3910 inode->i_mtime.tv_sec);
3912 inode->i_mtime.tv_nsec);
3915 inode->i_ctime.tv_sec);
3917 inode->i_ctime.tv_nsec);
3919 btrfs_set_token_inode_nbytes(&token, item, inode_get_bytes(inode));
3921 btrfs_set_token_inode_sequence(&token, item, inode_peek_iversion(inode));
3923 btrfs_set_token_inode_rdev(&token, item, inode->i_rdev);
3924 btrfs_set_token_inode_flags(&token, item, BTRFS_I(inode)->flags);
3930 struct btrfs_inode *inode)
3936 &inode->location, sizeof(*inode_item));
3941 fill_inode_item(trans, path->nodes[0], inode_item, &inode->vfs_inode,
3948 struct btrfs_inode *inode,
3957 * If this inode was not used for reflink operations in the current
3961 if (inode->last_reflink_trans < trans->transid)
3994 struct btrfs_inode *inode,
4003 struct btrfs_root *log = inode->root->log_root;
4013 int skip_csum = inode->flags & BTRFS_INODE_NODATASUM;
4047 &inode->vfs_inode,
4056 * or deletes of this inode don't have to relog the inode
4111 ret = log_csums(trans, inode, log, sums);
4135 struct btrfs_inode *inode,
4148 if (inode->flags & BTRFS_INODE_NODATASUM ||
4201 ret = log_csums(trans, inode, log_root, sums);
4233 ret = log_csums(trans, inode, log_root, sums);
4242 struct btrfs_inode *inode, struct btrfs_root *root,
4257 ret = log_extent_csums(trans, inode, log, em, ctx);
4261 ret = __btrfs_drop_extents(trans, log, inode, path, em->start,
4268 key.objectid = btrfs_ino(inode);
4319 * Log all prealloc extents beyond the inode's i_size to make sure we do not
4321 * subvolume's root instead of iterating the inode's extent map tree because
4327 struct btrfs_inode *inode,
4330 struct btrfs_root *root = inode->root;
4332 const u64 i_size = i_size_read(&inode->vfs_inode);
4333 const u64 ino = btrfs_ino(inode);
4343 if (!(inode->flags & BTRFS_INODE_PREALLOC))
4393 ret = copy_items(trans, inode, dst_path, path,
4426 &inode->vfs_inode,
4447 ret = copy_items(trans, inode, dst_path, path,
4457 struct btrfs_inode *inode,
4465 struct extent_map_tree *tree = &inode->extent_tree;
4494 em->start >= i_size_read(&inode->vfs_inode))
4523 ret = log_one_extent(trans, inode, root, em, path, ctx);
4533 ret = btrfs_log_prealloc_extents(trans, inode, path);
4549 spin_lock_irq(&inode->ordered_tree.lock);
4554 spin_unlock_irq(&inode->ordered_tree.lock);
4562 static int logged_inode_size(struct btrfs_root *log, struct btrfs_inode *inode,
4568 key.objectid = btrfs_ino(inode);
4584 * If the in-memory inode's i_size is smaller then the inode
4585 * size stored in the btree, return the inode's i_size, so
4586 * that we get a correct inode size after replaying the log
4589 * Otherwise return the inode size from the btree, to avoid
4591 * write that expands the inode's size and logging a new name
4594 if (*size_ret > inode->vfs_inode.i_size)
4595 *size_ret = inode->vfs_inode.i_size;
4606 * because if a xattr is deleted, the inode is fsynced and a power failure
4613 struct btrfs_inode *inode,
4619 const u64 ino = btrfs_ino(inode);
4624 if (test_bit(BTRFS_INODE_NO_XATTRS, &inode->runtime_flags))
4642 ret = copy_items(trans, inode, dst_path, path,
4668 ret = copy_items(trans, inode, dst_path, path,
4675 set_bit(BTRFS_INODE_NO_XATTRS, &inode->runtime_flags);
4683 * that contains the inode item and references) we may end up not processing
4685 * current transaction that have extent items for our inode. So we need to find
4687 * truncate operation that changes the inode's size.
4691 struct btrfs_inode *inode,
4696 const u64 ino = btrfs_ino(inode);
4697 const u64 i_size = i_size_read(&inode->vfs_inode);
4749 * an extent item and we are holding the inode lock, the
4784 * When we are logging a new inode X, check if it doesn't have a reference that
4785 * matches the reference from some other inode Y created in a past transaction
4787 * log replay time we can lose inode Y (and all its files if it's a directory):
4800 * For the case where inode Y is not a directory we simply end up losing it:
4828 struct btrfs_inode *inode,
4884 di = btrfs_lookup_dir_item(NULL, inode->root, search_path,
4944 struct inode *inode;
4957 inode = btrfs_iget(fs_info->sb, ino, root);
4959 * If the other inode that had a conflicting dir entry was
4963 if (IS_ERR(inode)) {
4964 ret = PTR_ERR(inode);
4966 inode = btrfs_iget(fs_info->sb, parent, root);
4967 if (IS_ERR(inode)) {
4968 ret = PTR_ERR(inode);
4971 BTRFS_I(inode),
4974 btrfs_add_delayed_iput(inode);
4980 * If the inode was already logged skip it - otherwise we can
4986 * inode 257 a directory
4987 * inode 258 with references "zz" and "zz_link" on inode 257
4988 * inode 259 with reference "a" on inode 257
4992 * inode 257 a directory, unchanged
4993 * inode 258 with references "a" and "a2" on inode 257
4994 * inode 259 with reference "zz_link" on inode 257
4995 * inode 261 with reference "zz" on inode 257
4997 * When logging inode 261 the following infinite loop could
5000 * - we detect inode 258 as a conflicting inode, with inode 261
5003 * - we detect inode 259 as a conflicting inode, with inode 258
5006 * - we detect inode 258 as a conflicting inode, with inode 259
5010 spin_lock(&BTRFS_I(inode)->lock);
5012 * Check the inode's logged_trans only instead of
5014 * the inode is not updated when we only log that it exists and
5017 if (BTRFS_I(inode)->logged_trans == trans->transid) {
5018 spin_unlock(&BTRFS_I(inode)->lock);
5019 btrfs_add_delayed_iput(inode);
5022 spin_unlock(&BTRFS_I(inode)->lock);
5024 * We are safe logging the other inode without acquiring its
5026 * are safe against concurrent renames of the other inode as
5030 ret = btrfs_log_inode(trans, root, BTRFS_I(inode),
5033 btrfs_add_delayed_iput(inode);
5042 btrfs_add_delayed_iput(inode);
5072 BTRFS_I(inode), &other_ino,
5089 btrfs_add_delayed_iput(inode);
5096 struct btrfs_inode *inode,
5107 const u64 i_size = i_size_read(&inode->vfs_inode);
5108 struct btrfs_root *root = inode->root;
5141 inode->generation == trans->transid &&
5147 path->slots[0], min_key, inode,
5152 other_ino != btrfs_ino(BTRFS_I(ctx->inode))) {
5159 ret = copy_items(trans, inode, dst_path, path,
5177 ret = copy_items(trans, inode, dst_path, path,
5195 ret = copy_items(trans, inode, dst_path, path, ins_start_slot,
5209 ret = copy_items(trans, inode, dst_path, path,
5228 ret = copy_items(trans, inode, dst_path, path, ins_start_slot,
5234 if (inode_only == LOG_INODE_ALL && S_ISREG(inode->vfs_inode.i_mode)) {
5240 ret = btrfs_log_prealloc_extents(trans, inode, dst_path);
5246 /* log a single inode in the tree log.
5247 * At least one parent directory for this inode must exist in the tree
5250 * Any items from this inode changed by the current transaction are copied
5261 struct btrfs_root *root, struct btrfs_inode *inode,
5273 u64 ino = btrfs_ino(inode);
5274 struct extent_map_tree *em_tree = &inode->extent_tree;
5297 if (S_ISDIR(inode->vfs_inode.i_mode) ||
5299 &inode->runtime_flags) &&
5311 * Otherwise commit the delayed inode only if the full sync flag is set,
5314 * it to the log tree. For a non full sync, we always log the inode item
5317 if (S_ISDIR(inode->vfs_inode.i_mode))
5318 ret = btrfs_commit_inode_delayed_items(trans, inode);
5319 else if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags))
5320 ret = btrfs_commit_inode_delayed_inode(inode);
5334 mutex_lock_nested(&inode->log_mutex, SINGLE_DEPTH_NESTING);
5336 mutex_lock(&inode->log_mutex);
5348 if (S_ISLNK(inode->vfs_inode.i_mode))
5355 if (S_ISDIR(inode->vfs_inode.i_mode)) {
5364 * Make sure the new inode item we write to the log has
5371 * we use the inode's current i_size, after log replay
5376 err = logged_inode_size(log, inode, path, &logged_isize);
5381 &inode->runtime_flags)) {
5388 &inode->runtime_flags);
5390 &inode->runtime_flags);
5393 log, &inode->vfs_inode, 0, 0);
5399 &inode->runtime_flags) ||
5418 err = copy_inode_items_to_log(trans, inode, &min_key, &max_key,
5427 err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path);
5434 err = btrfs_log_holes(trans, root, inode, path);
5442 err = log_inode_item(trans, log, dst_path, inode);
5444 err = btrfs_log_all_xattrs(trans, root, inode, path,
5452 ret = btrfs_log_changed_extents(trans, root, inode, dst_path,
5467 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->vfs_inode.i_mode)) {
5468 ret = log_directory_changes(trans, root, inode, path, dst_path,
5477 * If we are logging that an ancestor inode exists as part of logging a
5478 * new name from a link or rename operation, don't mark the inode as
5480 * the fsync considers the inode in the log and doesn't sync the log,
5482 * log was synced as part of an fsync against any other unrelated inode.
5487 !(S_ISDIR(inode->vfs_inode.i_mode) && ctx->logging_new_name &&
5488 &inode->vfs_inode != ctx->inode)) {
5489 spin_lock(&inode->lock);
5490 inode->logged_trans = trans->transid;
5492 * Don't update last_log_commit if we logged that an inode exists
5494 * This is to prevent data loss when we do a write to the inode,
5495 * then the inode gets evicted after all delalloc was flushed,
5501 !test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags))
5502 inode->last_log_commit = inode->last_sub_trans;
5503 spin_unlock(&inode->lock);
5506 mutex_unlock(&inode->log_mutex);
5514 * Check if we must fallback to a transaction commit when logging an inode.
5515 * This must be called after logging the inode and is used only in the context
5516 * when fsyncing an inode requires the need to log some other inode - in which
5517 * case we can't lock the i_mutex of each other inode we need to log as that
5520 * we take the log_mutex of the inode after we have logged it and then check for
5525 * all the inode items, otherwise we are not sure and must do a transaction
5527 * we logged the inode or it might have also done the unlink).
5530 struct btrfs_inode *inode)
5532 struct btrfs_fs_info *fs_info = inode->root->fs_info;
5535 mutex_lock(&inode->log_mutex);
5536 if (inode->last_unlink_trans > fs_info->last_trans_committed) {
5544 mutex_unlock(&inode->log_mutex);
5556 struct btrfs_inode *inode,
5565 * for regular files, if its inode is already on disk, we don't
5570 if (S_ISREG(inode->vfs_inode.i_mode) &&
5571 inode->generation <= last_committed &&
5572 inode->last_unlink_trans <= last_committed)
5575 if (!S_ISDIR(inode->vfs_inode.i_mode)) {
5578 inode = BTRFS_I(d_inode(parent));
5582 if (btrfs_must_commit_transaction(trans, inode)) {
5591 inode = BTRFS_I(d_inode(parent));
5592 if (btrfs_must_commit_transaction(trans, inode))
5600 inode = BTRFS_I(d_inode(parent));
5634 * that while logging the inode new references (names) are added or removed
5635 * from the inode, leaving the logged inode item with a link count that does
5636 * not match the number of logged inode reference items. This is fine because
5638 * link count in the inode item (see replay_one_buffer() and
5642 * while logging the inode's items new items with keys BTRFS_DIR_ITEM_KEY and
5643 * BTRFS_DIR_INDEX_KEY are added to fs/subvol tree and the logged inode item
5651 * The directory's inode item with a wrong i_size is not a problem as well,
5652 * since we don't use it at log replay time to set the i_size in the inode
5709 struct inode *di_inode;
5787 struct btrfs_inode *inode,
5794 struct btrfs_root *root = inode->root;
5795 const u64 ino = btrfs_ino(inode);
5835 struct inode *dir_inode;
5858 * If the parent inode was deleted, return an error to
5860 * getting an inode that was moved from one parent A to
5922 struct inode *inode;
5933 inode = btrfs_iget(fs_info->sb, ino, root);
5934 if (IS_ERR(inode))
5935 return PTR_ERR(inode);
5937 if (BTRFS_I(inode)->generation > last_committed)
5938 ret = btrfs_log_inode(trans, root, BTRFS_I(inode),
5940 btrfs_add_delayed_iput(inode);
5973 struct btrfs_inode *inode,
5977 struct btrfs_root *root = inode->root;
5980 struct super_block *sb = inode->vfs_inode.i_sb;
5988 inode = BTRFS_I(d_inode(parent));
5989 if (root != inode->root)
5992 if (inode->generation > fs_info->last_trans_committed) {
5993 ret = btrfs_log_inode(trans, root, inode,
6011 struct btrfs_inode *inode,
6015 struct btrfs_root *root = inode->root;
6016 const u64 ino = btrfs_ino(inode);
6025 if (inode->vfs_inode.i_nlink < 2)
6026 return log_new_ancestors_fast(trans, inode, parent, ctx);
6076 * Keep track of the last inode ref key and resume from that key
6095 * parent directories also end up in the log. A minimal inode and backref
6100 struct btrfs_inode *inode,
6105 struct btrfs_root *root = inode->root;
6112 sb = inode->vfs_inode.i_sb;
6134 ret = check_parent_dirs_for_sync(trans, inode, parent, sb,
6144 if ((btrfs_inode_in_log(inode, trans->transid) &&
6146 inode->vfs_inode.i_nlink == 0) {
6155 ret = btrfs_log_inode(trans, root, inode, inode_only, ctx);
6160 * for regular files, if its inode is already on disk, we don't
6165 if (S_ISREG(inode->vfs_inode.i_mode) &&
6166 inode->generation <= last_committed &&
6167 inode->last_unlink_trans <= last_committed) {
6172 if (S_ISDIR(inode->vfs_inode.i_mode) && ctx && ctx->log_new_dentries)
6195 * directory still has an entry pointing to the file inode using the bar
6197 * the file inode has a link count of 1.
6212 * testdir still has an entry pointing to the inode file with name foo3
6213 * but the file inode does not have a matching BTRFS_INODE_REF_KEY item
6216 if (inode->last_unlink_trans > last_committed) {
6217 ret = btrfs_log_all_parents(trans, inode, ctx);
6222 ret = log_all_new_ancestors(trans, inode, parent, ctx);
6227 ret = log_new_dir_dentries(trans, root, inode, ctx);
6448 struct btrfs_inode *dir, struct btrfs_inode *inode,
6453 * or unlinked, and its inode is fully committed on disk,
6461 mutex_lock(&inode->log_mutex);
6462 inode->last_unlink_trans = trans->transid;
6463 mutex_unlock(&inode->log_mutex);
6473 * if the inode we're about to unlink was logged,
6476 if (inode->logged_trans == trans->transid)
6523 struct btrfs_inode *inode, struct btrfs_inode *old_dir,
6532 if (!S_ISDIR(inode->vfs_inode.i_mode))
6533 inode->last_unlink_trans = trans->transid;
6536 * if this inode hasn't been logged and directory we're renaming it
6539 if (!inode_logged(trans, inode) &&
6543 btrfs_init_log_ctx(&ctx, &inode->vfs_inode);
6552 btrfs_log_inode_parent(trans, inode, parent, LOG_INODE_EXISTS, &ctx);