From patchwork Tue Jul 9 00:11:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 257615 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 31CF62C0299 for ; Tue, 9 Jul 2013 09:53:20 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753419Ab3GHXxJ (ORCPT ); Mon, 8 Jul 2013 19:53:09 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:40461 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753400Ab3GHXxH (ORCPT ); Mon, 8 Jul 2013 19:53:07 -0400 Received: by mail-pb0-f45.google.com with SMTP id mc8so4820251pbc.18 for ; Mon, 08 Jul 2013 16:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=p64EjWnL4OHMSGdp0pkkC+VzBIRfVnghH5iEQW3MH3s=; b=WlPYUQq/WiyzQ55Th5Sa2UOjMxV7pryg2L9wVssKQucBI3KZ8AR/4Fd+eLti023/dq PX5XAsrORzLNPFjqEymJF6hTezbjQkl/FI2AtCaqRs2SwP9+xV9BZDUWLljnvTQaWmT8 OBQ6cwAF18yS5uKKETvryodvj5XgN2WNyyK5OnRNc8AA6CEUu5YLzu6Tsglavg05P+hi U1J2ulLdhlBRVD0VkwS0G+lm9gMfzNwxaKDhV+fywKfjFZQYJx6MLeh+dMLslFQquE3N rVK+m1fsAstx7xtLyPFatCopqr0bz66kRVcDqa/+AIeeQZ4So0woadTXFXFX4Jfq62H3 UEZg== X-Received: by 10.68.163.195 with SMTP id yk3mr1592952pbb.142.1373327587256; Mon, 08 Jul 2013 16:53:07 -0700 (PDT) Received: from lz-desktop.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPSA id xe9sm24757133pbc.21.2013.07.08.16.53.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Jul 2013 16:53:06 -0700 (PDT) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Zheng Liu , Tao Ma , "Theodore Ts'o" Subject: [PATCH] ext4: make ext4_add_dirent_to_inline function return 0 Date: Tue, 9 Jul 2013 08:11:39 +0800 Message-Id: <1373328699-23037-1-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.9.7 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu Currently ext4_add_dirent_to_inline() function returns 1 to indicate that a new directory entry has been added. But it sounds reasonable to return 0 in this function. Meanwhile we also can eliminate a if statement in ext4_add_entry() function when a directory entry has added correctly. Signed-off-by: Zheng Liu Cc: Tao Ma Cc: "Theodore Ts'o" --- fs/ext4/inline.c | 2 +- fs/ext4/namei.c | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index b8a0746..5a27d32 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -1027,7 +1027,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle, ext4_update_dx_flag(dir); dir->i_version++; ext4_mark_inode_dirty(handle, dir); - return 1; + return 0; } static void *ext4_get_inline_xattr_pos(struct inode *inode, diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index ab2f6dc..2a6a736 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1901,12 +1901,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, if (ext4_has_inline_data(dir)) { retval = ext4_try_add_inline_entry(handle, dentry, inode); - if (retval < 0) + if (retval <= 0) return retval; - if (retval == 1) { - retval = 0; - return retval; - } } if (is_dx(dir)) {