f2fs: fix calculating incorrect free size when update xattr in __f2fs_setxattr

During xattr updating, free size should be corrected to remainder free size
+ old entry size.
It can avoid ENOSPC error when we update old entry with the same size new
entry at fully filled xattr.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
Chao Yu 2013-10-29 14:17:05 +08:00 committed by Jaegeuk Kim
parent 5d56b6718a
commit cc3de6a3ac
1 changed files with 1 additions and 1 deletions

View File

@ -520,7 +520,7 @@ static int __f2fs_setxattr(struct inode *inode, int name_index,
*/
free = MIN_OFFSET(inode) - ((char *)last - (char *)base_addr);
if (found)
free = free - ENTRY_SIZE(here);
free = free + ENTRY_SIZE(here);
if (free < newsize) {
error = -ENOSPC;