Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp339981pxv; Thu, 15 Jul 2021 05:38:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZFzu/M1k/ewZmFvfZllRAdO7MoP+HQnWXBK8AUjdJkq+CdIgv/wYZka/f3x/Q3vuQubos X-Received: by 2002:a05:6638:270c:: with SMTP id m12mr3869033jav.5.1626352720433; Thu, 15 Jul 2021 05:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626352720; cv=none; d=google.com; s=arc-20160816; b=GOHv8LlKJeqXCy8Ux7gVEI76HgoyxroI5TpMk5reCb+ryVPq2ZjE5dR8ruWCgnguBN gLbyWYdpfiHZDuLNAmnlvRCXePp2eKYzTY2tvLX0y+9e1+EpccO4PQWd/NSx19rdC0hO /HFkHrL3gh9CYeUN8D3FOCw38Zq1YMhgGDmIBoXtTZOf7b/QSJxT+gSzzhxP6l7RyU6Q /QXzJL5s9SdWC/1lFTyCNiTSNcgCXhhmVA9Q+Koxr+aB5njAQSszd6vY/X5/ER9vHXLt onSUnKZN9QXc7w55U2MOG48qpeiUEO43SyEe2GoMY4IADRp8yMsx/fcNVLd7idKRHXO6 rwgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=eH0jeVK2i8hz++sNM/JC6YrqWq5J9vwtnU9FAcE/fG8=; b=gaMFdud2cuhnePSy7N9bsCYjggiqJzNdBWJc5BwkvFSwNhZyHZ9488x27mNBfE6UpW yevaSIEg+nirDZFcYKiD1CksUOZCP2xVEmAMFPqPdoKoVWuu7eHcYr1CDcFgsxFld+z/ pfIsBXPrqttQXbDAjqShZVHBxTYJ8HcyB/bYt6HLf3aQVl2c4Wlc7rDfiwC7mKlwZle0 Sdje7hE9vJvUnjZqvHxo6Rkn3oOeA1oEpCWCSfKw31a0VMX6CjPGrzSQQqFruG1upVDi LhQx+TMwlU9O3bwyX6RlB6Qiv4On+tXBghPkE4WFz5POML61cGdr5qzu2ijabwKrpnIc R5Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=i42xtiZ1; dkim=neutral (no key) header.i=@suse.cz header.b=vOT5bLlu; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si6785269jao.15.2021.07.15.05.38.28; Thu, 15 Jul 2021 05:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=i42xtiZ1; dkim=neutral (no key) header.i=@suse.cz header.b=vOT5bLlu; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232318AbhGOMLM (ORCPT + 99 others); Thu, 15 Jul 2021 08:11:12 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:35764 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229973AbhGOMLM (ORCPT ); Thu, 15 Jul 2021 08:11:12 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8EE691FE19; Thu, 15 Jul 2021 12:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1626350898; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eH0jeVK2i8hz++sNM/JC6YrqWq5J9vwtnU9FAcE/fG8=; b=i42xtiZ1AbOIPhhaltTt2t+pK3GvqvK4IIAIlcsAEib+PpDDEMuKn3cfYI050NrjY44VIs Ypf69xlIhxC2nec1q73PFMwavNcO2+ugXsYOT8SGLelWa0f6K3SDo/lOG8MHVrJS93hYJ+ ej7Q4LQKkNFyy6oPTeZhpSd1Et9qlhY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1626350898; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eH0jeVK2i8hz++sNM/JC6YrqWq5J9vwtnU9FAcE/fG8=; b=vOT5bLlup9SCJ0lYGiOy0UFyQkDdrl3OAbwm9tucUavZ/x028rcUd0JT2g0igWcVnSf2ID z/r0ZatuEvOkPDCg== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 4CD3FA3BBE; Thu, 15 Jul 2021 12:08:18 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 2B52D1E0BF2; Thu, 15 Jul 2021 14:08:18 +0200 (CEST) Date: Thu, 15 Jul 2021 14:08:18 +0200 From: Jan Kara To: Zhang Yi Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yukuai3@huawei.com Subject: Re: [PATCH v2 3/4] ext4: factor out write end code of inline file Message-ID: <20210715120818.GF9457@quack2.suse.cz> References: <20210715015452.2542505-1-yi.zhang@huawei.com> <20210715015452.2542505-4-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715015452.2542505-4-yi.zhang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 15-07-21 09:54:51, Zhang Yi wrote: > Now that the inline_data file write end procedure are falled into the > common write end functions, it is not clear. Factor them out and do > some cleanup. This patch also drop ext4_da_write_inline_data_end() > and switch to use ext4_write_inline_data_end() instead because we also > need to do the same error processing if we failed to write data into > inline entry. > > Signed-off-by: Zhang Yi Just two small comments below. > diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c > index 28b666f25ac2..3d227b32b21c 100644 > --- a/fs/ext4/inline.c > +++ b/fs/ext4/inline.c ... > +out: > + /* > + * If we have allocated more blocks and copied less. We will have > + * blocks allocated outside inode->i_size, so truncate them. > + */ > + if (pos + len > inode->i_size && ext4_can_truncate(inode)) > + ext4_orphan_add(handle, inode); I don't think we need this error handling here. For inline data we never allocate any blocks so shorter writes don't need any cleanup. > - return copied; > + ret2 = ext4_journal_stop(handle); > + if (!ret) > + ret = ret2; > + if (pos + len > inode->i_size) { > + ext4_truncate_failed_write(inode); > + /* > + * If truncate failed early the inode might still be > + * on the orphan list; we need to make sure the inode > + * is removed from the orphan list in that case. > + */ > + if (inode->i_nlink) > + ext4_orphan_del(NULL, inode); > + } And this can go away as well... Honza -- Jan Kara SUSE Labs, CR