Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp907345ybi; Fri, 12 Jul 2019 06:33:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0e7Icaum0IdMaAMYoVV+oFdSKcpWcV3DIyY7+M4KMR22jH0Bhi+l30JHfS5AElPTTau9o X-Received: by 2002:a17:90a:26a1:: with SMTP id m30mr12059934pje.59.1562938381948; Fri, 12 Jul 2019 06:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562938381; cv=none; d=google.com; s=arc-20160816; b=JrGlzfDitlNakBmPUvnHYIgTC26hOmqqjUCWSviWNt3gPEuPAtMQX6fvI72pKWMjRi /Q7bI/gNYyx2+C3MUkVYEpLaasCi8AGlrPewEZhMMKv7xT88fjC+tgGG3UyyTKYYTif6 IXKugKikVEsT8UVK7Y/sIcjHNR3izHMVe6zxUYnu4UPr1RugZjgaSK7N2ShMv10pHSCE ZGUZIipJBLlia1GMdE5DVFOZ0uaU/Xy/sSEPDlCRlFmMq+/8gp27KuoKe06SMaWe4gGK wmmQOW+oTskQnrgZ9wn21SwGZWJv5lvpTwzEMfl/GHgNyejj8fgyxhGc5AyCg6RxufI/ YDCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=SOQsM7zsrljG4lEMXA1fAd5YOOBnyvwN1536xWGe+7s=; b=KVvPeVEK995yJKsajlW4bvuBy1WC3JdxFfuDrltypbGOU1gR8HpeXIKWMs/fNs6icR 7aQ2HRuPQxuBDTpgSgc8iTOOyIK/SyvmRRJRo6UFoy6X31UrZiXUUq63TbXqSGnHMxqf oaTIBtBkN28eZ2qPVDoVp7wZ5PQMPn3xZm/sAyEf/F+Sw7hYgOwtlsAbMAEi1pvbQEOy hU816keEp2+wK791RdaI3QjYDKYSLtQs2432dSh8jfZ4T7aBqC6WMbIx53ErX8Xd5oLu 9lrKK5LVhkdbOiB78YCj+ha2i0gycV/FYOZ6kYn6WOukNQQuVW2ophc9/4CTE38BHMBe WP1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si8065357plc.356.2019.07.12.06.32.41; Fri, 12 Jul 2019 06:33:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727465AbfGLNcX (ORCPT + 99 others); Fri, 12 Jul 2019 09:32:23 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:38857 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbfGLNcX (ORCPT ); Fri, 12 Jul 2019 09:32:23 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0TWiD7pF_1562938335; Received: from JosephdeMacBook-Pro.local(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0TWiD7pF_1562938335) by smtp.aliyun-inc.com(127.0.0.1); Fri, 12 Jul 2019 21:32:15 +0800 Subject: Re: [PATCH 1/2] ocfs2: use jbd2_inode dirty range scoping To: Changwei Ge , akpm@linux-foundation.org Cc: Theodore Ts'o , Ross Zwisler , linux-ext4@vger.kernel.org, ocfs2-devel@oss.oracle.com References: <1562914972-97318-1-git-send-email-joseph.qi@linux.alibaba.com> <30d43b0b-2cb6-916d-d514-268493a6691e@linux.alibaba.com> From: Joseph Qi Message-ID: <2d0bb5bf-c963-6ddb-3134-d0868640016e@linux.alibaba.com> Date: Fri, 12 Jul 2019 21:32:15 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <30d43b0b-2cb6-916d-d514-268493a6691e@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi Changwei, On 19/7/12 17:45, Changwei Ge wrote: > Hi Joseph, > > > Originally, ocfs2_jbd2_file_inode() is a wrapper of jbd2 routine jbd2_journal_file_inode() which has been renamed > > by Jan Kara long ago. (41617e1a8dec9fe082ba5dec26bacb154eb55482) > > > So how about we change ocfs2_jbd2_file_inode to ocfs2_jbd2_inode_add_write() this time within your patch? Sure, I'll make this change along with other opinions in v2. Thanks, Joseph > > > Thanks, > > Changwei > > > On 2019/7/12 3:02 下午, Joseph Qi wrote: >> commit 6ba0e7dc64a5 ("jbd2: introduce jbd2_inode dirty range scoping") >> allow us scoping each of the inode dirty ranges associated with a given >> transaction, and ext4 already does this way. >> Now let's also use the newly introduced jbd2_inode dirty range scoping >> to prevent us from waiting forever when trying to complete a journal >> transaction in ocfs2. >> >> Signed-off-by: Joseph Qi >> --- >>   fs/ocfs2/alloc.c   |  4 +++- >>   fs/ocfs2/aops.c    |  6 ++++-- >>   fs/ocfs2/file.c    | 10 +++++++--- >>   fs/ocfs2/journal.h |  6 ++++-- >>   4 files changed, 18 insertions(+), 8 deletions(-) >> >> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c >> index d1348fc..2a58ca4 100644 >> --- a/fs/ocfs2/alloc.c >> +++ b/fs/ocfs2/alloc.c >> @@ -6792,6 +6792,8 @@ void ocfs2_map_and_dirty_page(struct inode *inode, handle_t *handle, >>                     struct page *page, int zero, u64 *phys) >>   { >>       int ret, partial = 0; >> +    loff_t start_byte = ((loff_t)page->index << PAGE_SHIFT) + from; >> +    loff_t length = to - from; >>         ret = ocfs2_map_page_blocks(page, phys, inode, from, to, 0); >>       if (ret) >> @@ -6811,7 +6813,7 @@ void ocfs2_map_and_dirty_page(struct inode *inode, handle_t *handle, >>       if (ret < 0) >>           mlog_errno(ret); >>       else if (ocfs2_should_order_data(inode)) { >> -        ret = ocfs2_jbd2_file_inode(handle, inode); >> +        ret = ocfs2_jbd2_file_inode(handle, inode, start_byte, length); >>           if (ret < 0) >>               mlog_errno(ret); >>       } >> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c >> index a4c905d..bbb508a 100644 >> --- a/fs/ocfs2/aops.c >> +++ b/fs/ocfs2/aops.c >> @@ -942,7 +942,7 @@ static void ocfs2_write_failure(struct inode *inode, >>             if (tmppage && page_has_buffers(tmppage)) { >>               if (ocfs2_should_order_data(inode)) >> -                ocfs2_jbd2_file_inode(wc->w_handle, inode); >> +                ocfs2_jbd2_file_inode(wc->w_handle, inode, user_pos, user_len); >>                 block_commit_write(tmppage, from, to); >>           } >> @@ -2024,7 +2024,9 @@ int ocfs2_write_end_nolock(struct address_space *mapping, >>             if (page_has_buffers(tmppage)) { >>               if (handle && ocfs2_should_order_data(inode)) >> -                ocfs2_jbd2_file_inode(handle, inode); >> +                ocfs2_jbd2_file_inode(handle, inode, >> +                              ((loff_t)tmppage->index << PAGE_SHIFT) + from, >> +                              to - from); >>               block_commit_write(tmppage, from, to); >>           } >>       } >> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c >> index 4435df3..43e6c28 100644 >> --- a/fs/ocfs2/file.c >> +++ b/fs/ocfs2/file.c >> @@ -706,7 +706,9 @@ static int ocfs2_extend_allocation(struct inode *inode, u32 logical_start, >>    * Thus, we need to explicitly order the zeroed pages. >>    */ >>   static handle_t *ocfs2_zero_start_ordered_transaction(struct inode *inode, >> -                        struct buffer_head *di_bh) >> +                              struct buffer_head *di_bh, >> +                              loff_t start_bytes, >> +                              loff_t length) >>   { >>       struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); >>       handle_t *handle = NULL; >> @@ -722,7 +724,7 @@ static handle_t *ocfs2_zero_start_ordered_transaction(struct inode *inode, >>           goto out; >>       } >>   -    ret = ocfs2_jbd2_file_inode(handle, inode); >> +    ret = ocfs2_jbd2_file_inode(handle, inode, start_bytes, length); >>       if (ret < 0) { >>           mlog_errno(ret); >>           goto out; >> @@ -761,7 +763,9 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, >>       BUG_ON(abs_to > (((u64)index + 1) << PAGE_SHIFT)); >>       BUG_ON(abs_from & (inode->i_blkbits - 1)); >>   -    handle = ocfs2_zero_start_ordered_transaction(inode, di_bh); >> +    handle = ocfs2_zero_start_ordered_transaction(inode, di_bh, >> +                              abs_from, >> +                              abs_to - abs_from); >>       if (IS_ERR(handle)) { >>           ret = PTR_ERR(handle); >>           goto out; >> diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h >> index c0fe6ed..932e6a8 100644 >> --- a/fs/ocfs2/journal.h >> +++ b/fs/ocfs2/journal.h >> @@ -603,9 +603,11 @@ static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb, >>       return credits; >>   } >>   -static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode) >> +static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode, >> +                    loff_t start_byte, loff_t length) >>   { >> -    return jbd2_journal_inode_add_write(handle, &OCFS2_I(inode)->ip_jinode); >> +    return jbd2_journal_inode_ranged_write(handle, &OCFS2_I(inode)->ip_jinode, >> +                           start_byte, length); >>   } >>     static inline int ocfs2_begin_ordered_truncate(struct inode *inode,