Skip to content

Commit

Permalink
ocfs2: tweak to get the maximum inline data size with xattr
Browse files Browse the repository at this point in the history
Replace max_inline_data with max_inline_data_with_xattr
to ensure it correct when xattr inlined.

Signed-off-by: Tiger Yang <[email protected]>
Acked-by: Joel Becker <[email protected]>
Signed-off-by: Mark Fasheh <[email protected]>
  • Loading branch information
Tiger Yang authored and Mark Fasheh committed Mar 12, 2009
1 parent 6c9fd1d commit d9ae49d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 5 additions & 2 deletions fs/ocfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
size = i_size_read(inode);

if (size > PAGE_CACHE_SIZE ||
size > ocfs2_max_inline_data(inode->i_sb)) {
size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) {
ocfs2_error(inode->i_sb,
"Inode %llu has with inline data has bad size: %Lu",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
Expand Down Expand Up @@ -1555,6 +1555,7 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
int ret, written = 0;
loff_t end = pos + len;
struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_dinode *di = NULL;

mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
(unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
Expand Down Expand Up @@ -1587,7 +1588,9 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
/*
* Check whether the write can fit.
*/
if (mmap_page || end > ocfs2_max_inline_data(inode->i_sb))
di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
if (mmap_page ||
end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di))
return 0;

do_inline_write:
Expand Down
3 changes: 2 additions & 1 deletion fs/ocfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,

fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL);

fe->id2.i_data.id_count = cpu_to_le16(ocfs2_max_inline_data(osb->sb));
fe->id2.i_data.id_count = cpu_to_le16(
ocfs2_max_inline_data_with_xattr(osb->sb, fe));
} else {
fel = &fe->id2.i_list;
fel->l_tree_depth = 0;
Expand Down
6 changes: 0 additions & 6 deletions fs/ocfs2/ocfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1070,12 +1070,6 @@ static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
offsetof(struct ocfs2_dinode, id2.i_symlink);
}

static inline int ocfs2_max_inline_data(struct super_block *sb)
{
return sb->s_blocksize -
offsetof(struct ocfs2_dinode, id2.i_data.id_data);
}

static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
struct ocfs2_dinode *di)
{
Expand Down

0 comments on commit d9ae49d

Please sign in to comment.