diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-02-09 15:23:03 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-02-09 15:23:03 -0500 |
commit | 95eaefbdececae5e781d76d03fe7472a857c8c7a (patch) | |
tree | abe337e1490ded4166cf4d26f97cd1fe856a84ab /fs/ext4/xattr.c | |
parent | 64044abf05d0842a7fed30e102fa411a744c7d9f (diff) |
ext4: fix the number of credits needed for acl ops with inline data
Operations which modify extended attributes may need extra journal
credits if inline data is used, since there is a chance that some
extended attributes may need to get pushed to an external attribute
block.
Changes to reflect this was made in xattr.c, but they were missed in
fs/ext4/acl.c. To fix this, abstract the calculation of the number of
credits needed for xattr operations to an inline function defined in
ext4_jbd2.h, and use it in acl.c and xattr.c.
Also move the function declarations used in inline.c from xattr.h
(where they are non-obviously hidden, and caused problems since
ext4_jbd2.h needs to use the function ext4_has_inline_data), and move
them to ext4.h.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Tao Ma <boyu.mt@taobao.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/xattr.c')
-rw-r--r-- | fs/ext4/xattr.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 2efc5600b03b..cc31da027596 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -1165,16 +1165,9 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name, | |||
1165 | { | 1165 | { |
1166 | handle_t *handle; | 1166 | handle_t *handle; |
1167 | int error, retries = 0; | 1167 | int error, retries = 0; |
1168 | int credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb); | 1168 | int credits = ext4_jbd2_credits_xattr(inode); |
1169 | 1169 | ||
1170 | retry: | 1170 | retry: |
1171 | /* | ||
1172 | * In case of inline data, we may push out the data to a block, | ||
1173 | * So reserve the journal space first. | ||
1174 | */ | ||
1175 | if (ext4_has_inline_data(inode)) | ||
1176 | credits += ext4_writepage_trans_blocks(inode) + 1; | ||
1177 | |||
1178 | handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits); | 1171 | handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits); |
1179 | if (IS_ERR(handle)) { | 1172 | if (IS_ERR(handle)) { |
1180 | error = PTR_ERR(handle); | 1173 | error = PTR_ERR(handle); |