• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/ocfs2/

Lines Matching refs:loc

148 	int (*xlo_journal_access)(handle_t *handle, struct ocfs2_xa_loc *loc,
150 void (*xlo_journal_dirty)(handle_t *handle, struct ocfs2_xa_loc *loc);
153 * Return a pointer to the appropriate buffer in loc->xl_storage
154 * at the given offset from loc->xl_header.
156 void *(*xlo_offset_pointer)(struct ocfs2_xa_loc *loc, int offset);
159 int (*xlo_can_reuse)(struct ocfs2_xa_loc *loc,
163 int (*xlo_check_space)(struct ocfs2_xa_loc *loc,
170 int (*xlo_get_free_start)(struct ocfs2_xa_loc *loc);
176 void (*xlo_wipe_namevalue)(struct ocfs2_xa_loc *loc);
179 void (*xlo_add_entry)(struct ocfs2_xa_loc *loc, u32 name_hash);
182 void (*xlo_add_namevalue)(struct ocfs2_xa_loc *loc, int size);
188 void (*xlo_fill_value_buf)(struct ocfs2_xa_loc *loc,
1420 static int ocfs2_xa_journal_access(handle_t *handle, struct ocfs2_xa_loc *loc,
1423 return loc->xl_ops->xlo_journal_access(handle, loc, type);
1426 static void ocfs2_xa_journal_dirty(handle_t *handle, struct ocfs2_xa_loc *loc)
1428 loc->xl_ops->xlo_journal_dirty(handle, loc);
1432 static void *ocfs2_xa_offset_pointer(struct ocfs2_xa_loc *loc, int offset)
1434 BUG_ON(offset >= loc->xl_size);
1435 return loc->xl_ops->xlo_offset_pointer(loc, offset);
1443 static void ocfs2_xa_wipe_namevalue(struct ocfs2_xa_loc *loc)
1445 loc->xl_ops->xlo_wipe_namevalue(loc);
1452 static int ocfs2_xa_get_free_start(struct ocfs2_xa_loc *loc)
1454 return loc->xl_ops->xlo_get_free_start(loc);
1457 /* Can we reuse loc->xl_entry for xi? */
1458 static int ocfs2_xa_can_reuse_entry(struct ocfs2_xa_loc *loc,
1461 return loc->xl_ops->xlo_can_reuse(loc, xi);
1465 static int ocfs2_xa_check_space(struct ocfs2_xa_loc *loc,
1468 return loc->xl_ops->xlo_check_space(loc, xi);
1471 static void ocfs2_xa_add_entry(struct ocfs2_xa_loc *loc, u32 name_hash)
1473 loc->xl_ops->xlo_add_entry(loc, name_hash);
1474 loc->xl_entry->xe_name_hash = cpu_to_le32(name_hash);
1480 loc->xl_entry->xe_name_offset = cpu_to_le16(loc->xl_size);
1483 static void ocfs2_xa_add_namevalue(struct ocfs2_xa_loc *loc,
1490 loc->xl_ops->xlo_add_namevalue(loc, size);
1491 loc->xl_entry->xe_value_size = cpu_to_le64(xi->xi_value_len);
1492 loc->xl_entry->xe_name_len = xi->xi_name_len;
1493 ocfs2_xattr_set_type(loc->xl_entry, xi->xi_name_index);
1494 ocfs2_xattr_set_local(loc->xl_entry,
1497 nameval_offset = le16_to_cpu(loc->xl_entry->xe_name_offset);
1498 nameval_buf = ocfs2_xa_offset_pointer(loc, nameval_offset);
1503 static void ocfs2_xa_fill_value_buf(struct ocfs2_xa_loc *loc,
1506 int nameval_offset = le16_to_cpu(loc->xl_entry->xe_name_offset);
1507 int name_size = OCFS2_XATTR_SIZE(loc->xl_entry->xe_name_len);
1510 BUG_ON(ocfs2_xattr_is_local(loc->xl_entry));
1511 BUG_ON(namevalue_size_xe(loc->xl_entry) !=
1514 loc->xl_ops->xlo_fill_value_buf(loc, vb);
1516 (struct ocfs2_xattr_value_root *)ocfs2_xa_offset_pointer(loc,
1522 struct ocfs2_xa_loc *loc, int type)
1524 struct buffer_head *bh = loc->xl_storage;
1527 if (loc->xl_size == (bh->b_size -
1533 return access(handle, INODE_CACHE(loc->xl_inode), bh, type);
1537 struct ocfs2_xa_loc *loc)
1539 struct buffer_head *bh = loc->xl_storage;
1544 static void *ocfs2_xa_block_offset_pointer(struct ocfs2_xa_loc *loc,
1547 return (char *)loc->xl_header + offset;
1550 static int ocfs2_xa_block_can_reuse(struct ocfs2_xa_loc *loc,
1557 return namevalue_size_xe(loc->xl_entry) ==
1561 static int ocfs2_xa_block_get_free_start(struct ocfs2_xa_loc *loc)
1563 struct ocfs2_xattr_header *xh = loc->xl_header;
1565 int offset, free_start = loc->xl_size;
1576 static int ocfs2_xa_block_check_space(struct ocfs2_xa_loc *loc,
1579 int count = le16_to_cpu(loc->xl_header->xh_count);
1580 int free_start = ocfs2_xa_get_free_start(loc);
1588 if (loc->xl_entry) {
1590 if (ocfs2_xa_can_reuse_entry(loc, xi))
1593 needed_space -= ocfs2_xe_entry_usage(loc->xl_entry);
1604 static void ocfs2_xa_block_wipe_namevalue(struct ocfs2_xa_loc *loc)
1608 struct ocfs2_xattr_entry *entry = loc->xl_entry;
1609 struct ocfs2_xattr_header *xh = loc->xl_header;
1614 first_namevalue_offset = ocfs2_xa_get_free_start(loc);
1636 static void ocfs2_xa_block_add_entry(struct ocfs2_xa_loc *loc, u32 name_hash)
1638 int count = le16_to_cpu(loc->xl_header->xh_count);
1639 loc->xl_entry = &(loc->xl_header->xh_entries[count]);
1640 le16_add_cpu(&loc->xl_header->xh_count, 1);
1641 memset(loc->xl_entry, 0, sizeof(struct ocfs2_xattr_entry));
1644 static void ocfs2_xa_block_add_namevalue(struct ocfs2_xa_loc *loc, int size)
1646 int free_start = ocfs2_xa_get_free_start(loc);
1648 loc->xl_entry->xe_name_offset = cpu_to_le16(free_start - size);
1651 static void ocfs2_xa_block_fill_value_buf(struct ocfs2_xa_loc *loc,
1654 struct buffer_head *bh = loc->xl_storage;
1656 if (loc->xl_size == (bh->b_size -
1683 struct ocfs2_xa_loc *loc, int type)
1685 struct ocfs2_xattr_bucket *bucket = loc->xl_storage;
1691 struct ocfs2_xa_loc *loc)
1693 struct ocfs2_xattr_bucket *bucket = loc->xl_storage;
1698 static void *ocfs2_xa_bucket_offset_pointer(struct ocfs2_xa_loc *loc,
1701 struct ocfs2_xattr_bucket *bucket = loc->xl_storage;
1705 block = offset >> loc->xl_inode->i_sb->s_blocksize_bits;
1706 block_offset = offset % loc->xl_inode->i_sb->s_blocksize;
1711 static int ocfs2_xa_bucket_can_reuse(struct ocfs2_xa_loc *loc,
1714 return namevalue_size_xe(loc->xl_entry) >=
1718 static int ocfs2_xa_bucket_get_free_start(struct ocfs2_xa_loc *loc)
1720 struct ocfs2_xattr_bucket *bucket = loc->xl_storage;
1738 static int ocfs2_xa_bucket_check_space(struct ocfs2_xa_loc *loc,
1742 int count = le16_to_cpu(loc->xl_header->xh_count);
1743 int free_start = ocfs2_xa_get_free_start(loc);
1746 struct super_block *sb = loc->xl_inode->i_sb;
1754 if (loc->xl_entry) {
1756 if (ocfs2_xa_can_reuse_entry(loc, xi))
1783 static void ocfs2_xa_bucket_wipe_namevalue(struct ocfs2_xa_loc *loc)
1785 le16_add_cpu(&loc->xl_header->xh_name_value_len,
1786 -namevalue_size_xe(loc->xl_entry));
1789 static void ocfs2_xa_bucket_add_entry(struct ocfs2_xa_loc *loc, u32 name_hash)
1791 struct ocfs2_xattr_header *xh = loc->xl_header;
1820 loc->xl_entry = &xh->xh_entries[low];
1821 memset(loc->xl_entry, 0, sizeof(struct ocfs2_xattr_entry));
1824 static void ocfs2_xa_bucket_add_namevalue(struct ocfs2_xa_loc *loc, int size)
1826 int free_start = ocfs2_xa_get_free_start(loc);
1827 struct ocfs2_xattr_header *xh = loc->xl_header;
1828 struct super_block *sb = loc->xl_inode->i_sb;
1833 loc->xl_entry->xe_name_offset = cpu_to_le16(nameval_offset);
1839 static void ocfs2_xa_bucket_fill_value_buf(struct ocfs2_xa_loc *loc,
1842 struct ocfs2_xattr_bucket *bucket = loc->xl_storage;
1843 struct super_block *sb = loc->xl_inode->i_sb;
1844 int nameval_offset = le16_to_cpu(loc->xl_entry->xe_name_offset);
1845 int size = namevalue_size_xe(loc->xl_entry);
1872 static unsigned int ocfs2_xa_value_clusters(struct ocfs2_xa_loc *loc)
1876 if (ocfs2_xattr_is_local(loc->xl_entry))
1879 ocfs2_xa_fill_value_buf(loc, &vb);
1883 static int ocfs2_xa_value_truncate(struct ocfs2_xa_loc *loc, u64 bytes,
1889 ocfs2_xa_fill_value_buf(loc, &vb);
1890 trunc_rc = ocfs2_xattr_value_truncate(loc->xl_inode, &vb, bytes,
1895 * ocfs2_xa_journal_access on the loc. However, The truncate code
1903 access_rc = ocfs2_xa_journal_access(ctxt->handle, loc,
1910 static void ocfs2_xa_remove_entry(struct ocfs2_xa_loc *loc)
1913 struct ocfs2_xattr_header *xh = loc->xl_header;
1914 struct ocfs2_xattr_entry *entry = loc->xl_entry;
1916 ocfs2_xa_wipe_namevalue(loc);
1917 loc->xl_entry = NULL;
1961 static void ocfs2_xa_cleanup_value_truncate(struct ocfs2_xa_loc *loc,
1965 unsigned int new_clusters = ocfs2_xa_value_clusters(loc);
1966 char *nameval_buf = ocfs2_xa_offset_pointer(loc,
1967 le16_to_cpu(loc->xl_entry->xe_name_offset));
1973 what, loc->xl_entry->xe_name_len, nameval_buf,
1975 ocfs2_xa_remove_entry(loc);
1981 loc->xl_entry->xe_name_len, nameval_buf,
1983 ocfs2_xa_remove_entry(loc);
1989 loc->xl_entry->xe_name_len, nameval_buf,
1993 static int ocfs2_xa_remove(struct ocfs2_xa_loc *loc,
1999 if (!ocfs2_xattr_is_local(loc->xl_entry)) {
2000 orig_clusters = ocfs2_xa_value_clusters(loc);
2001 rc = ocfs2_xa_value_truncate(loc, 0, ctxt);
2010 if (orig_clusters != ocfs2_xa_value_clusters(loc))
2012 ocfs2_xa_cleanup_value_truncate(loc, "removing",
2019 ocfs2_xa_remove_entry(loc);
2025 static void ocfs2_xa_install_value_root(struct ocfs2_xa_loc *loc)
2027 int name_size = OCFS2_XATTR_SIZE(loc->xl_entry->xe_name_len);
2030 nameval_buf = ocfs2_xa_offset_pointer(loc,
2031 le16_to_cpu(loc->xl_entry->xe_name_offset));
2040 static int ocfs2_xa_reuse_entry(struct ocfs2_xa_loc *loc,
2048 int xe_local = ocfs2_xattr_is_local(loc->xl_entry);
2051 BUG_ON(OCFS2_XATTR_SIZE(loc->xl_entry->xe_name_len) !=
2054 nameval_buf = ocfs2_xa_offset_pointer(loc,
2055 le16_to_cpu(loc->xl_entry->xe_name_offset));
2058 namevalue_size_xe(loc->xl_entry) - name_size);
2060 ocfs2_xa_install_value_root(loc);
2062 orig_clusters = ocfs2_xa_value_clusters(loc);
2064 rc = ocfs2_xa_value_truncate(loc, 0, ctxt);
2069 namevalue_size_xe(loc->xl_entry) -
2071 } else if (le64_to_cpu(loc->xl_entry->xe_value_size) >
2073 rc = ocfs2_xa_value_truncate(loc, xi->xi_value_len,
2080 ocfs2_xa_cleanup_value_truncate(loc, "reusing",
2086 loc->xl_entry->xe_value_size = cpu_to_le64(xi->xi_value_len);
2087 ocfs2_xattr_set_local(loc->xl_entry, xi_local);
2094 * Prepares loc->xl_entry to receive the new xattr. This includes
2095 * properly setting up the name+value pair region. If loc->xl_entry
2101 static int ocfs2_xa_prepare_entry(struct ocfs2_xa_loc *loc,
2110 rc = ocfs2_xa_check_space(loc, xi);
2114 if (loc->xl_entry) {
2115 if (ocfs2_xa_can_reuse_entry(loc, xi)) {
2116 orig_value_size = loc->xl_entry->xe_value_size;
2117 rc = ocfs2_xa_reuse_entry(loc, xi, ctxt);
2123 if (!ocfs2_xattr_is_local(loc->xl_entry)) {
2124 orig_clusters = ocfs2_xa_value_clusters(loc);
2125 rc = ocfs2_xa_value_truncate(loc, 0, ctxt);
2128 ocfs2_xa_cleanup_value_truncate(loc,
2134 ocfs2_xa_wipe_namevalue(loc);
2136 ocfs2_xa_add_entry(loc, name_hash);
2142 ocfs2_xa_add_namevalue(loc, xi);
2144 ocfs2_xa_install_value_root(loc);
2148 orig_clusters = ocfs2_xa_value_clusters(loc);
2149 rc = ocfs2_xa_value_truncate(loc, xi->xi_value_len, ctxt);
2152 ocfs2_xa_cleanup_value_truncate(loc, "growing",
2160 if (loc->xl_entry) {
2162 loc->xl_entry->xe_value_size = orig_value_size;
2177 static int ocfs2_xa_store_value(struct ocfs2_xa_loc *loc,
2182 int nameval_offset = le16_to_cpu(loc->xl_entry->xe_name_offset);
2187 nameval_buf = ocfs2_xa_offset_pointer(loc, nameval_offset);
2189 ocfs2_xa_fill_value_buf(loc, &vb);
2190 rc = __ocfs2_xattr_set_value_outside(loc->xl_inode,
2200 static int ocfs2_xa_set(struct ocfs2_xa_loc *loc,
2205 u32 name_hash = ocfs2_xattr_name_hash(loc->xl_inode, xi->xi_name,
2208 ret = ocfs2_xa_journal_access(ctxt->handle, loc,
2223 ret = ocfs2_xa_remove(loc, ctxt);
2227 ret = ocfs2_xa_prepare_entry(loc, xi, name_hash, ctxt);
2234 ret = ocfs2_xa_store_value(loc, xi, ctxt);
2239 ocfs2_xa_journal_dirty(ctxt->handle, loc);
2245 static void ocfs2_init_dinode_xa_loc(struct ocfs2_xa_loc *loc,
2254 loc->xl_inode = inode;
2255 loc->xl_ops = &ocfs2_xa_block_loc_ops;
2256 loc->xl_storage = bh;
2257 loc->xl_entry = entry;
2258 loc->xl_size = le16_to_cpu(di->i_xattr_inline_size);
2259 loc->xl_header =
2261 loc->xl_size);
2264 static void ocfs2_init_xattr_block_xa_loc(struct ocfs2_xa_loc *loc,
2274 loc->xl_inode = inode;
2275 loc->xl_ops = &ocfs2_xa_block_loc_ops;
2276 loc->xl_storage = bh;
2277 loc->xl_header = &(xb->xb_attrs.xb_header);
2278 loc->xl_entry = entry;
2279 loc->xl_size = bh->b_size - offsetof(struct ocfs2_xattr_block,
2283 static void ocfs2_init_xattr_bucket_xa_loc(struct ocfs2_xa_loc *loc,
2287 loc->xl_inode = bucket->bu_inode;
2288 loc->xl_ops = &ocfs2_xa_bucket_loc_ops;
2289 loc->xl_storage = bucket;
2290 loc->xl_header = bucket_xh(bucket);
2291 loc->xl_entry = entry;
2292 loc->xl_size = OCFS2_XATTR_BUCKET_SIZE;
2752 struct ocfs2_xa_loc loc;
2774 ocfs2_init_dinode_xa_loc(&loc, inode, xs->inode_bh,
2776 ret = ocfs2_xa_set(&loc, xi, ctxt);
2782 xs->here = loc.xl_entry;
2937 struct ocfs2_xa_loc loc;
2957 ocfs2_init_xattr_block_xa_loc(&loc, inode, xs->xattr_bh,
2960 ret = ocfs2_xa_set(&loc, xi, ctxt);
2962 xs->here = loc.xl_entry;
5530 struct ocfs2_xa_loc loc;
5534 ocfs2_init_xattr_bucket_xa_loc(&loc, xs->bucket,
5536 ret = ocfs2_xa_set(&loc, xi, ctxt);
5538 xs->here = loc.xl_entry;
5554 ret = ocfs2_xa_set(&loc, xi, ctxt);
5556 xs->here = loc.xl_entry;