From patchwork Thu Nov 15 08:13:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 199209 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 CBD042C007D for ; Thu, 15 Nov 2012 19:01:17 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992805Ab2KOIBQ (ORCPT ); Thu, 15 Nov 2012 03:01:16 -0500 Received: from mail-da0-f46.google.com ([209.85.210.46]:39372 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992781Ab2KOIBP (ORCPT ); Thu, 15 Nov 2012 03:01:15 -0500 Received: by mail-da0-f46.google.com with SMTP id n41so561869dak.19 for ; Thu, 15 Nov 2012 00:01:15 -0800 (PST) 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:in-reply-to:references; bh=g35F8lGKJbZEQ2xRX9tZ8bdj/oQ/pHRJ7otDfVQHSME=; b=BfvfYuEAmPKPsjJargFxacbNaExY5OMljOROx6GW1A8jtH6dsU0/+CY2WdrwRGMpYa WUCYknrt95TbndSZviyn73jyChs4ZkXCLvZDpgxa2mQ9n4jPl9yLGbckldY5SlSLaL3z E03NnjKKr9zQKdSkFG7Of+1E91xi2SG1eVJ3IeRpsVu8/GB45rKJTtvTvRrMstOup+Jn QkAJxefWTqmLWw/yascaxaZe2ydR4t7WU4wCivACgjkfmxm1Btu/Cigeqho7lIAvh7x4 Wx9daGKfhQvRjEpaPN8PlP+F4YMfdNflUyi7CdA+W5KpU9lJbiNKh/yBW67IPvAhtPzr /l5Q== Received: by 10.66.80.194 with SMTP id t2mr948299pax.43.1352966475008; Thu, 15 Nov 2012 00:01:15 -0800 (PST) Received: from lz-desktop.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id os5sm9136355pbc.15.2012.11.15.00.01.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 00:01:14 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: Zheng Liu Subject: [PATCH 4/7] libext2fs: return written bytes in ext2fs_try_to_write_inline_data Date: Thu, 15 Nov 2012 16:13:26 +0800 Message-Id: <1352967209-29616-5-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <1352967209-29616-1-git-send-email-wenqing.lz@taobao.com> References: <1352967209-29616-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu unwritten variable is assigned to the bytes of written data if writting to inline data is done. Otherwise, it will be assigned to 0. Signed-off-by: Zheng Liu --- lib/ext2fs/inline_data.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c index 7f5ec3e..fd89360 100644 --- a/lib/ext2fs/inline_data.c +++ b/lib/ext2fs/inline_data.c @@ -890,6 +890,11 @@ errcode_t ext2fs_try_to_write_inline_data(ext2_filsys fs, ext2_ino_t ino, retval = ext2fs_write_inode_full(fs, ino, (void *)inode, EXT2_INODE_SIZE(fs->super)); + if (!retval) + *written = nbytes; + else + *written = 0; + out: ext2fs_free_mem(&inode); return retval;