aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/xattr.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 74d1faba23bb..789fb70462c9 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -1792,52 +1792,6 @@ cleanup:
1792} 1792}
1793 1793
1794/* 1794/*
1795 * When all the xattrs are deleted from index btree, the ocfs2_xattr_tree
1796 * will be erased and ocfs2_xattr_block will have its ocfs2_xattr_header
1797 * re-initialized.
1798 */
1799static int ocfs2_restore_xattr_block(struct inode *inode,
1800 struct ocfs2_xattr_search *xs)
1801{
1802 int ret;
1803 handle_t *handle;
1804 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1805 struct ocfs2_xattr_block *xb =
1806 (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
1807 struct ocfs2_extent_list *el = &xb->xb_attrs.xb_root.xt_list;
1808 u16 xb_flags = le16_to_cpu(xb->xb_flags);
1809
1810 BUG_ON(!(xb_flags & OCFS2_XATTR_INDEXED) ||
1811 le16_to_cpu(el->l_next_free_rec) != 0);
1812
1813 handle = ocfs2_start_trans(osb, OCFS2_XATTR_BLOCK_UPDATE_CREDITS);
1814 if (IS_ERR(handle)) {
1815 ret = PTR_ERR(handle);
1816 handle = NULL;
1817 goto out;
1818 }
1819
1820 ret = ocfs2_journal_access(handle, inode, xs->xattr_bh,
1821 OCFS2_JOURNAL_ACCESS_WRITE);
1822 if (ret < 0) {
1823 mlog_errno(ret);
1824 goto out_commit;
1825 }
1826
1827 memset(&xb->xb_attrs, 0, inode->i_sb->s_blocksize -
1828 offsetof(struct ocfs2_xattr_block, xb_attrs));
1829
1830 xb->xb_flags = cpu_to_le16(xb_flags & ~OCFS2_XATTR_INDEXED);
1831
1832 ocfs2_journal_dirty(handle, xs->xattr_bh);
1833
1834out_commit:
1835 ocfs2_commit_trans(osb, handle);
1836out:
1837 return ret;
1838}
1839
1840/*
1841 * ocfs2_xattr_block_set() 1795 * ocfs2_xattr_block_set()
1842 * 1796 *
1843 * Set, replace or remove an extended attribute into external block. 1797 * Set, replace or remove an extended attribute into external block.
@@ -1947,8 +1901,6 @@ out:
1947 } 1901 }
1948 1902
1949 ret = ocfs2_xattr_set_entry_index_block(inode, xi, xs); 1903 ret = ocfs2_xattr_set_entry_index_block(inode, xi, xs);
1950 if (!ret && xblk->xb_attrs.xb_root.xt_list.l_next_free_rec == 0)
1951 ret = ocfs2_restore_xattr_block(inode, xs);
1952 1904
1953end: 1905end:
1954 1906