xattr.c (695a461296e5df148c99ac087b9e1cb380f4db15) xattr.c (8cb471e8f82506937fe5e2e9fb0bf90f6b1f1170)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * xattr.c
5 *
6 * Copyright (C) 2004, 2008 Oracle. All rights reserved.
7 *
8 * CREDITS:

--- 240 unchanged lines hidden (view full) ---

249 bucket->bu_bhs[i] = sb_getblk(bucket->bu_inode->i_sb,
250 xb_blkno + i);
251 if (!bucket->bu_bhs[i]) {
252 rc = -EIO;
253 mlog_errno(rc);
254 break;
255 }
256
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * xattr.c
5 *
6 * Copyright (C) 2004, 2008 Oracle. All rights reserved.
7 *
8 * CREDITS:

--- 240 unchanged lines hidden (view full) ---

249 bucket->bu_bhs[i] = sb_getblk(bucket->bu_inode->i_sb,
250 xb_blkno + i);
251 if (!bucket->bu_bhs[i]) {
252 rc = -EIO;
253 mlog_errno(rc);
254 break;
255 }
256
257 if (!ocfs2_buffer_uptodate(bucket->bu_inode,
257 if (!ocfs2_buffer_uptodate(INODE_CACHE(bucket->bu_inode),
258 bucket->bu_bhs[i]))
258 bucket->bu_bhs[i]))
259 ocfs2_set_new_buffer_uptodate(bucket->bu_inode,
259 ocfs2_set_new_buffer_uptodate(INODE_CACHE(bucket->bu_inode),
260 bucket->bu_bhs[i]);
261 }
262
263 if (rc)
264 ocfs2_xattr_bucket_relse(bucket);
265 return rc;
266}
267
268/* Read the xattr bucket at xb_blkno */
269static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
270 u64 xb_blkno)
271{
272 int rc;
273
260 bucket->bu_bhs[i]);
261 }
262
263 if (rc)
264 ocfs2_xattr_bucket_relse(bucket);
265 return rc;
266}
267
268/* Read the xattr bucket at xb_blkno */
269static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
270 u64 xb_blkno)
271{
272 int rc;
273
274 rc = ocfs2_read_blocks(bucket->bu_inode, xb_blkno,
274 rc = ocfs2_read_blocks(INODE_CACHE(bucket->bu_inode), xb_blkno,
275 bucket->bu_blocks, bucket->bu_bhs, 0,
276 NULL);
277 if (!rc) {
278 spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
279 rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb,
280 bucket->bu_bhs,
281 bucket->bu_blocks,
282 &bucket_xh(bucket)->xh_check);

--- 111 unchanged lines hidden (view full) ---

394}
395
396static int ocfs2_read_xattr_block(struct inode *inode, u64 xb_blkno,
397 struct buffer_head **bh)
398{
399 int rc;
400 struct buffer_head *tmp = *bh;
401
275 bucket->bu_blocks, bucket->bu_bhs, 0,
276 NULL);
277 if (!rc) {
278 spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock);
279 rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb,
280 bucket->bu_bhs,
281 bucket->bu_blocks,
282 &bucket_xh(bucket)->xh_check);

--- 111 unchanged lines hidden (view full) ---

394}
395
396static int ocfs2_read_xattr_block(struct inode *inode, u64 xb_blkno,
397 struct buffer_head **bh)
398{
399 int rc;
400 struct buffer_head *tmp = *bh;
401
402 rc = ocfs2_read_block(inode, xb_blkno, &tmp,
402 rc = ocfs2_read_block(INODE_CACHE(inode), xb_blkno, &tmp,
403 ocfs2_validate_xattr_block);
404
405 /* If ocfs2_read_block() got us a new bh, pass it up. */
406 if (!rc && !*bh)
407 *bh = tmp;
408
409 return rc;
410}

--- 308 unchanged lines hidden (view full) ---

719 phys_cpos, alloc_size,
720 ctxt);
721 if (ret) {
722 mlog_errno(ret);
723 goto out;
724 }
725
726 block = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
403 ocfs2_validate_xattr_block);
404
405 /* If ocfs2_read_block() got us a new bh, pass it up. */
406 if (!rc && !*bh)
407 *bh = tmp;
408
409 return rc;
410}

--- 308 unchanged lines hidden (view full) ---

719 phys_cpos, alloc_size,
720 ctxt);
721 if (ret) {
722 mlog_errno(ret);
723 goto out;
724 }
725
726 block = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
727 ocfs2_remove_xattr_clusters_from_cache(inode, block,
728 alloc_size);
727 ocfs2_remove_xattr_clusters_from_cache(INODE_CACHE(inode),
728 block, alloc_size);
729 cpos += alloc_size;
730 trunc_len -= alloc_size;
731 }
732
733out:
734 return ret;
735}
736

--- 228 unchanged lines hidden (view full) ---

965 if (ret) {
966 mlog_errno(ret);
967 goto out;
968 }
969
970 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
971 /* Copy ocfs2_xattr_value */
972 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
729 cpos += alloc_size;
730 trunc_len -= alloc_size;
731 }
732
733out:
734 return ret;
735}
736

--- 228 unchanged lines hidden (view full) ---

965 if (ret) {
966 mlog_errno(ret);
967 goto out;
968 }
969
970 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
971 /* Copy ocfs2_xattr_value */
972 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
973 ret = ocfs2_read_block(inode, blkno, &bh, NULL);
973 ret = ocfs2_read_block(INODE_CACHE(inode), blkno,
974 &bh, NULL);
974 if (ret) {
975 mlog_errno(ret);
976 goto out;
977 }
978
979 cplen = len >= blocksize ? blocksize : len;
980 memcpy(buffer, bh->b_data, cplen);
981 len -= cplen;

--- 221 unchanged lines hidden (view full) ---

1203 if (ret) {
1204 mlog_errno(ret);
1205 goto out;
1206 }
1207
1208 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
1209
1210 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
975 if (ret) {
976 mlog_errno(ret);
977 goto out;
978 }
979
980 cplen = len >= blocksize ? blocksize : len;
981 memcpy(buffer, bh->b_data, cplen);
982 len -= cplen;

--- 221 unchanged lines hidden (view full) ---

1204 if (ret) {
1205 mlog_errno(ret);
1206 goto out;
1207 }
1208
1209 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
1210
1211 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
1211 ret = ocfs2_read_block(inode, blkno, &bh, NULL);
1212 ret = ocfs2_read_block(INODE_CACHE(inode), blkno,
1213 &bh, NULL);
1212 if (ret) {
1213 mlog_errno(ret);
1214 goto out;
1215 }
1216
1217 ret = ocfs2_journal_access(handle,
1218 inode,
1219 bh,

--- 896 unchanged lines hidden (view full) ---

2116 &suballoc_bit_start, &num_got,
2117 &first_blkno);
2118 if (ret < 0) {
2119 mlog_errno(ret);
2120 goto end;
2121 }
2122
2123 new_bh = sb_getblk(inode->i_sb, first_blkno);
1214 if (ret) {
1215 mlog_errno(ret);
1216 goto out;
1217 }
1218
1219 ret = ocfs2_journal_access(handle,
1220 inode,
1221 bh,

--- 896 unchanged lines hidden (view full) ---

2118 &suballoc_bit_start, &num_got,
2119 &first_blkno);
2120 if (ret < 0) {
2121 mlog_errno(ret);
2122 goto end;
2123 }
2124
2125 new_bh = sb_getblk(inode->i_sb, first_blkno);
2124 ocfs2_set_new_buffer_uptodate(inode, new_bh);
2126 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh);
2125
2126 ret = ocfs2_journal_access_xb(handle, inode, new_bh,
2127 OCFS2_JOURNAL_ACCESS_CREATE);
2128 if (ret < 0) {
2129 mlog_errno(ret);
2130 goto end;
2131 }
2132

--- 2707 unchanged lines hidden (view full) ---

4840
4841 ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
4842
4843 ocfs2_init_dealloc_ctxt(&dealloc);
4844
4845 mlog(0, "rm xattr extent rec at %u len = %u, start from %llu\n",
4846 cpos, len, (unsigned long long)blkno);
4847
2127
2128 ret = ocfs2_journal_access_xb(handle, inode, new_bh,
2129 OCFS2_JOURNAL_ACCESS_CREATE);
2130 if (ret < 0) {
2131 mlog_errno(ret);
2132 goto end;
2133 }
2134

--- 2707 unchanged lines hidden (view full) ---

4842
4843 ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
4844
4845 ocfs2_init_dealloc_ctxt(&dealloc);
4846
4847 mlog(0, "rm xattr extent rec at %u len = %u, start from %llu\n",
4848 cpos, len, (unsigned long long)blkno);
4849
4848 ocfs2_remove_xattr_clusters_from_cache(inode, blkno, len);
4850 ocfs2_remove_xattr_clusters_from_cache(INODE_CACHE(inode), blkno,
4851 len);
4849
4850 ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac);
4851 if (ret) {
4852 mlog_errno(ret);
4853 return ret;
4854 }
4855
4856 mutex_lock(&tl_inode->i_mutex);

--- 618 unchanged lines hidden ---
4852
4853 ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac);
4854 if (ret) {
4855 mlog_errno(ret);
4856 return ret;
4857 }
4858
4859 mutex_lock(&tl_inode->i_mutex);

--- 618 unchanged lines hidden ---