diff options
Diffstat (limited to 'fs/btrfs/delayed-inode.c')
| -rw-r--r-- | fs/btrfs/delayed-inode.c | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 375510913fe7..cbd9523ad09c 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include "delayed-inode.h" | 21 | #include "delayed-inode.h" |
| 22 | #include "disk-io.h" | 22 | #include "disk-io.h" |
| 23 | #include "transaction.h" | 23 | #include "transaction.h" |
| 24 | #include "ctree.h" | ||
| 24 | 25 | ||
| 25 | #define BTRFS_DELAYED_WRITEBACK 512 | 26 | #define BTRFS_DELAYED_WRITEBACK 512 |
| 26 | #define BTRFS_DELAYED_BACKGROUND 128 | 27 | #define BTRFS_DELAYED_BACKGROUND 128 |
| @@ -1453,10 +1454,10 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, | |||
| 1453 | 1454 | ||
| 1454 | dir_item = (struct btrfs_dir_item *)delayed_item->data; | 1455 | dir_item = (struct btrfs_dir_item *)delayed_item->data; |
| 1455 | dir_item->location = *disk_key; | 1456 | dir_item->location = *disk_key; |
| 1456 | dir_item->transid = cpu_to_le64(trans->transid); | 1457 | btrfs_set_stack_dir_transid(dir_item, trans->transid); |
| 1457 | dir_item->data_len = 0; | 1458 | btrfs_set_stack_dir_data_len(dir_item, 0); |
| 1458 | dir_item->name_len = cpu_to_le16(name_len); | 1459 | btrfs_set_stack_dir_name_len(dir_item, name_len); |
| 1459 | dir_item->type = type; | 1460 | btrfs_set_stack_dir_type(dir_item, type); |
| 1460 | memcpy((char *)(dir_item + 1), name, name_len); | 1461 | memcpy((char *)(dir_item + 1), name, name_len); |
| 1461 | 1462 | ||
| 1462 | ret = btrfs_delayed_item_reserve_metadata(trans, root, delayed_item); | 1463 | ret = btrfs_delayed_item_reserve_metadata(trans, root, delayed_item); |
| @@ -1470,13 +1471,11 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, | |||
| 1470 | mutex_lock(&delayed_node->mutex); | 1471 | mutex_lock(&delayed_node->mutex); |
| 1471 | ret = __btrfs_add_delayed_insertion_item(delayed_node, delayed_item); | 1472 | ret = __btrfs_add_delayed_insertion_item(delayed_node, delayed_item); |
| 1472 | if (unlikely(ret)) { | 1473 | if (unlikely(ret)) { |
| 1473 | printk(KERN_ERR "err add delayed dir index item(name: %s) into " | 1474 | printk(KERN_ERR "err add delayed dir index item(name: %.*s) " |
| 1474 | "the insertion tree of the delayed node" | 1475 | "into the insertion tree of the delayed node" |
| 1475 | "(root id: %llu, inode id: %llu, errno: %d)\n", | 1476 | "(root id: %llu, inode id: %llu, errno: %d)\n", |
| 1476 | name, | 1477 | name_len, name, delayed_node->root->objectid, |
| 1477 | (unsigned long long)delayed_node->root->objectid, | 1478 | delayed_node->inode_id, ret); |
| 1478 | (unsigned long long)delayed_node->inode_id, | ||
| 1479 | ret); | ||
| 1480 | BUG(); | 1479 | BUG(); |
| 1481 | } | 1480 | } |
| 1482 | mutex_unlock(&delayed_node->mutex); | 1481 | mutex_unlock(&delayed_node->mutex); |
| @@ -1547,9 +1546,7 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans, | |||
| 1547 | printk(KERN_ERR "err add delayed dir index item(index: %llu) " | 1546 | printk(KERN_ERR "err add delayed dir index item(index: %llu) " |
| 1548 | "into the deletion tree of the delayed node" | 1547 | "into the deletion tree of the delayed node" |
| 1549 | "(root id: %llu, inode id: %llu, errno: %d)\n", | 1548 | "(root id: %llu, inode id: %llu, errno: %d)\n", |
| 1550 | (unsigned long long)index, | 1549 | index, node->root->objectid, node->inode_id, |
| 1551 | (unsigned long long)node->root->objectid, | ||
| 1552 | (unsigned long long)node->inode_id, | ||
| 1553 | ret); | 1550 | ret); |
| 1554 | BUG(); | 1551 | BUG(); |
| 1555 | } | 1552 | } |
| @@ -1699,7 +1696,7 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx, | |||
| 1699 | 1696 | ||
| 1700 | di = (struct btrfs_dir_item *)curr->data; | 1697 | di = (struct btrfs_dir_item *)curr->data; |
| 1701 | name = (char *)(di + 1); | 1698 | name = (char *)(di + 1); |
| 1702 | name_len = le16_to_cpu(di->name_len); | 1699 | name_len = btrfs_stack_dir_name_len(di); |
| 1703 | 1700 | ||
| 1704 | d_type = btrfs_filetype_table[di->type]; | 1701 | d_type = btrfs_filetype_table[di->type]; |
| 1705 | btrfs_disk_key_to_cpu(&location, &di->location); | 1702 | btrfs_disk_key_to_cpu(&location, &di->location); |
| @@ -1716,27 +1713,6 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx, | |||
| 1716 | return 0; | 1713 | return 0; |
| 1717 | } | 1714 | } |
| 1718 | 1715 | ||
| 1719 | BTRFS_SETGET_STACK_FUNCS(stack_inode_generation, struct btrfs_inode_item, | ||
| 1720 | generation, 64); | ||
| 1721 | BTRFS_SETGET_STACK_FUNCS(stack_inode_sequence, struct btrfs_inode_item, | ||
| 1722 | sequence, 64); | ||
| 1723 | BTRFS_SETGET_STACK_FUNCS(stack_inode_transid, struct btrfs_inode_item, | ||
| 1724 | transid, 64); | ||
| 1725 | BTRFS_SETGET_STACK_FUNCS(stack_inode_size, struct btrfs_inode_item, size, 64); | ||
| 1726 | BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes, struct btrfs_inode_item, | ||
| 1727 | nbytes, 64); | ||
| 1728 | BTRFS_SETGET_STACK_FUNCS(stack_inode_block_group, struct btrfs_inode_item, | ||
| 1729 | block_group, 64); | ||
| 1730 | BTRFS_SETGET_STACK_FUNCS(stack_inode_nlink, struct btrfs_inode_item, nlink, 32); | ||
| 1731 | BTRFS_SETGET_STACK_FUNCS(stack_inode_uid, struct btrfs_inode_item, uid, 32); | ||
| 1732 | BTRFS_SETGET_STACK_FUNCS(stack_inode_gid, struct btrfs_inode_item, gid, 32); | ||
| 1733 | BTRFS_SETGET_STACK_FUNCS(stack_inode_mode, struct btrfs_inode_item, mode, 32); | ||
| 1734 | BTRFS_SETGET_STACK_FUNCS(stack_inode_rdev, struct btrfs_inode_item, rdev, 64); | ||
| 1735 | BTRFS_SETGET_STACK_FUNCS(stack_inode_flags, struct btrfs_inode_item, flags, 64); | ||
| 1736 | |||
| 1737 | BTRFS_SETGET_STACK_FUNCS(stack_timespec_sec, struct btrfs_timespec, sec, 64); | ||
| 1738 | BTRFS_SETGET_STACK_FUNCS(stack_timespec_nsec, struct btrfs_timespec, nsec, 32); | ||
| 1739 | |||
| 1740 | static void fill_stack_inode_item(struct btrfs_trans_handle *trans, | 1716 | static void fill_stack_inode_item(struct btrfs_trans_handle *trans, |
| 1741 | struct btrfs_inode_item *inode_item, | 1717 | struct btrfs_inode_item *inode_item, |
| 1742 | struct inode *inode) | 1718 | struct inode *inode) |
