linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Kinglong Mee <kinglongmee@gmail.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH 3/3] f2fs: drop calling alloc_nid_failed when no nid is allocated
Date: Sat, 25 Feb 2017 19:23:46 +0800	[thread overview]
Message-ID: <77d8220f-8cf4-0af4-3390-cd28fbeb6437@gmail.com> (raw)

If hsize is less than or equal to inlien_size, and i_xattr_nid is valid, 
the new_nid is not allocated (no alloc_nid is called).

       if (hsize > inline_size && !F2FS_I(inode)->i_xattr_nid)
                if (!alloc_nid(sbi, &new_nid))
                        return -ENOSPC;

Although it's harmless calling alloc_nid_failed, it's better drop them.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/f2fs/xattr.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 7298a44..fd9dc99 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -428,19 +428,18 @@ static inline int write_all_xattrs(struct inode *inode, __u32 hsize,
 		/* no need to use xattr node block */
 		if (hsize <= inline_size) {
 			err = truncate_xattr_node(inode, ipage);
-			alloc_nid_failed(sbi, new_nid);
+			f2fs_bug_on(sbi, new_nid);
 			return err;
 		}
 	}
 
 	/* write to xattr node block */
 	if (F2FS_I(inode)->i_xattr_nid) {
+		f2fs_bug_on(sbi, new_nid);
 		xpage = get_node_page(sbi, F2FS_I(inode)->i_xattr_nid);
-		if (IS_ERR(xpage)) {
-			alloc_nid_failed(sbi, new_nid);
+		if (IS_ERR(xpage))
 			return PTR_ERR(xpage);
-		}
-		f2fs_bug_on(sbi, new_nid);
+
 		f2fs_wait_on_page_writeback(xpage, NODE, true);
 	} else {
 		struct dnode_of_data dn;
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

             reply	other threads:[~2017-02-25 11:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 11:23 Kinglong Mee [this message]
2017-02-27  2:21 ` [PATCH 3/3] f2fs: drop calling alloc_nid_failed when no nid is allocated Chao Yu
2017-02-27  3:08   ` Kinglong Mee
2017-02-27  3:16     ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77d8220f-8cf4-0af4-3390-cd28fbeb6437@gmail.com \
    --to=kinglongmee@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).