Loading fs/ocfs2/xattr.c +70 −45 Original line number Diff line number Diff line Loading @@ -2105,37 +2105,29 @@ cleanup: return ret; } /* * ocfs2_xattr_block_set() * * Set, replace or remove an extended attribute into external block. * */ static int ocfs2_xattr_block_set(struct inode *inode, struct ocfs2_xattr_info *xi, struct ocfs2_xattr_search *xs, struct ocfs2_xattr_set_ctxt *ctxt) static int ocfs2_create_xattr_block(handle_t *handle, struct inode *inode, struct buffer_head *inode_bh, struct ocfs2_alloc_context *meta_ac, struct buffer_head **ret_bh) { struct buffer_head *new_bh = NULL; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; handle_t *handle = ctxt->handle; struct ocfs2_xattr_block *xblk = NULL; int ret; u16 suballoc_bit_start; u32 num_got; u64 first_blkno; int ret; struct ocfs2_dinode *di = (struct ocfs2_dinode *)inode_bh->b_data; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct buffer_head *new_bh = NULL; struct ocfs2_xattr_block *xblk; if (!xs->xattr_bh) { ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), xs->inode_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), inode_bh, OCFS2_JOURNAL_ACCESS_CREATE); if (ret < 0) { mlog_errno(ret); goto end; } ret = ocfs2_claim_metadata(osb, handle, ctxt->meta_ac, 1, ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1, &suballoc_bit_start, &num_got, &first_blkno); if (ret < 0) { Loading @@ -2155,7 +2147,6 @@ static int ocfs2_xattr_block_set(struct inode *inode, } /* Initialize ocfs2_xattr_block */ xs->xattr_bh = new_bh; xblk = (struct ocfs2_xattr_block *)new_bh->b_data; memset(xblk, 0, inode->i_sb->s_blocksize); strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE); Loading @@ -2164,18 +2155,52 @@ static int ocfs2_xattr_block_set(struct inode *inode, xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation); xblk->xb_blkno = cpu_to_le64(first_blkno); xs->header = &xblk->xb_attrs.xb_header; xs->base = (void *)xs->header; xs->end = (void *)xblk + inode->i_sb->s_blocksize; xs->here = xs->header->xh_entries; ret = ocfs2_journal_dirty(handle, new_bh); if (ret < 0) { mlog_errno(ret); goto end; } di->i_xattr_loc = cpu_to_le64(first_blkno); ocfs2_journal_dirty(handle, xs->inode_bh); ocfs2_journal_dirty(handle, inode_bh); *ret_bh = new_bh; new_bh = NULL; end: brelse(new_bh); return ret; } /* * ocfs2_xattr_block_set() * * Set, replace or remove an extended attribute into external block. * */ static int ocfs2_xattr_block_set(struct inode *inode, struct ocfs2_xattr_info *xi, struct ocfs2_xattr_search *xs, struct ocfs2_xattr_set_ctxt *ctxt) { struct buffer_head *new_bh = NULL; handle_t *handle = ctxt->handle; struct ocfs2_xattr_block *xblk = NULL; int ret; if (!xs->xattr_bh) { ret = ocfs2_create_xattr_block(handle, inode, xs->inode_bh, ctxt->meta_ac, &new_bh); if (ret) { mlog_errno(ret); goto end; } xs->xattr_bh = new_bh; xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data; xs->header = &xblk->xb_attrs.xb_header; xs->base = (void *)xs->header; xs->end = (void *)xblk + inode->i_sb->s_blocksize; xs->here = xs->header->xh_entries; } else xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data; Loading Loading
fs/ocfs2/xattr.c +70 −45 Original line number Diff line number Diff line Loading @@ -2105,37 +2105,29 @@ cleanup: return ret; } /* * ocfs2_xattr_block_set() * * Set, replace or remove an extended attribute into external block. * */ static int ocfs2_xattr_block_set(struct inode *inode, struct ocfs2_xattr_info *xi, struct ocfs2_xattr_search *xs, struct ocfs2_xattr_set_ctxt *ctxt) static int ocfs2_create_xattr_block(handle_t *handle, struct inode *inode, struct buffer_head *inode_bh, struct ocfs2_alloc_context *meta_ac, struct buffer_head **ret_bh) { struct buffer_head *new_bh = NULL; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; handle_t *handle = ctxt->handle; struct ocfs2_xattr_block *xblk = NULL; int ret; u16 suballoc_bit_start; u32 num_got; u64 first_blkno; int ret; struct ocfs2_dinode *di = (struct ocfs2_dinode *)inode_bh->b_data; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct buffer_head *new_bh = NULL; struct ocfs2_xattr_block *xblk; if (!xs->xattr_bh) { ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), xs->inode_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), inode_bh, OCFS2_JOURNAL_ACCESS_CREATE); if (ret < 0) { mlog_errno(ret); goto end; } ret = ocfs2_claim_metadata(osb, handle, ctxt->meta_ac, 1, ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1, &suballoc_bit_start, &num_got, &first_blkno); if (ret < 0) { Loading @@ -2155,7 +2147,6 @@ static int ocfs2_xattr_block_set(struct inode *inode, } /* Initialize ocfs2_xattr_block */ xs->xattr_bh = new_bh; xblk = (struct ocfs2_xattr_block *)new_bh->b_data; memset(xblk, 0, inode->i_sb->s_blocksize); strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE); Loading @@ -2164,18 +2155,52 @@ static int ocfs2_xattr_block_set(struct inode *inode, xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation); xblk->xb_blkno = cpu_to_le64(first_blkno); xs->header = &xblk->xb_attrs.xb_header; xs->base = (void *)xs->header; xs->end = (void *)xblk + inode->i_sb->s_blocksize; xs->here = xs->header->xh_entries; ret = ocfs2_journal_dirty(handle, new_bh); if (ret < 0) { mlog_errno(ret); goto end; } di->i_xattr_loc = cpu_to_le64(first_blkno); ocfs2_journal_dirty(handle, xs->inode_bh); ocfs2_journal_dirty(handle, inode_bh); *ret_bh = new_bh; new_bh = NULL; end: brelse(new_bh); return ret; } /* * ocfs2_xattr_block_set() * * Set, replace or remove an extended attribute into external block. * */ static int ocfs2_xattr_block_set(struct inode *inode, struct ocfs2_xattr_info *xi, struct ocfs2_xattr_search *xs, struct ocfs2_xattr_set_ctxt *ctxt) { struct buffer_head *new_bh = NULL; handle_t *handle = ctxt->handle; struct ocfs2_xattr_block *xblk = NULL; int ret; if (!xs->xattr_bh) { ret = ocfs2_create_xattr_block(handle, inode, xs->inode_bh, ctxt->meta_ac, &new_bh); if (ret) { mlog_errno(ret); goto end; } xs->xattr_bh = new_bh; xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data; xs->header = &xblk->xb_attrs.xb_header; xs->base = (void *)xs->header; xs->end = (void *)xblk + inode->i_sb->s_blocksize; xs->here = xs->header->xh_entries; } else xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data; Loading