Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1571052ybi; Wed, 17 Jul 2019 17:55:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4INFmPZf4Z8e51HGp6ypVvtY8rURorySp1frED+nvs7DDPeIFBE8RMsyVauANTwfsbUoj X-Received: by 2002:a17:902:1102:: with SMTP id d2mr46848670pla.149.1563411319544; Wed, 17 Jul 2019 17:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563411319; cv=none; d=google.com; s=arc-20160816; b=pRO37kktXRSURaT19c5InVky+Q3f5zW2bJHZO8Qvl6UIz6YhrJZbhQh5+8kFJI5flJ 3S5YWEl7BjMIPZt4nItP6Kdqp6CmCCCqzDOMHSz4+F9X/qIzf/tf6tW11LVPF5nCe1kq pYLAMlsR2Ged+nbi89g2eZq1bPZlsmxnmAjz8svuJZgayCUwdjmtNn6ayM3U9KfNh8Ex ERUZvESh/ZUaK33r670zb50KIk40LYjHNjCq+bn1Oeyhj81G4GTA9yJDpRLGQ+ZZ5cn0 DhFF4y91wBZw1OmQBmV4RPTt6hwLO6rmwCOQo7NsuCrF+YhzTsr1bgrtnyH3u/WFuFmI pTlw== 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:references:cc:to:from:subject; bh=DWgt31VWlhEqM8O3OjG/a5wytidHfdbsVVDb/ShFkl0=; b=P3pxPbx0B7JAegJaNjSyT/hpAKQeDgpr9JUJzA76fDDrolDROCP8QqKCFImj58x6oi huUn4gn3FNVS3wjtHBX8mI3025Xz9pL61BrZMX+7+rUB54pF9FDxyLMAVjeUKsCEIyBt N5YrlsF/ZeIUkJqzb7AD+n+E0O+Bvss3XUuOBmXuXELUuh9RPw1soaL4TB7f/KDts0Ae icm1uE/sgPyyfmQFqRNAHMuke6IFHIqyfk2lnh/2Fcxty6BcC1cHMZ2M9yBChjGmjNt7 lv+CD0MtFq8Hz1J+4EE7Pknqrj7H/m2q2oIjKXflEt5M4qro3mRhKZ5qyL1EzfV7mSmM pUaA== 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 r199si24891626pfr.233.2019.07.17.17.54.53; Wed, 17 Jul 2019 17:55:19 -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 S1727804AbfGRAyj (ORCPT + 99 others); Wed, 17 Jul 2019 20:54:39 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:41393 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbfGRAyj (ORCPT ); Wed, 17 Jul 2019 20:54:39 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07487;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TX9szVo_1563411275; Received: from JosephdeMacBook-Pro.local(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0TX9szVo_1563411275) by smtp.aliyun-inc.com(127.0.0.1); Thu, 18 Jul 2019 08:54:35 +0800 Subject: Re: [Ocfs2-devel] [PATCH 1/2] ocfs2: use jbd2_inode dirty range scoping From: Joseph Qi To: akpm@linux-foundation.org Cc: Ross Zwisler , linux-ext4@vger.kernel.org, Theodore Ts'o , ocfs2-devel@oss.oracle.com References: <1562977611-8412-1-git-send-email-joseph.qi@linux.alibaba.com> <1a6e9c7b-b5ac-d745-17f2-7ef2073e9e8b@linux.alibaba.com> Message-ID: Date: Thu, 18 Jul 2019 08:54:35 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1a6e9c7b-b5ac-d745-17f2-7ef2073e9e8b@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Ping... If something else should be updated, please let me know. Thanks, Joseph On 19/7/16 19:15, Joseph Qi wrote: > Hi Andrew, > Could you please pick up these 2 patches? > > Thanks, > Joseph > > On 19/7/13 08:26, 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 >> Reviewed-by: Ross Zwisler >> --- >> v1 -> v2: >> rename ocfs2_jbd2_file_inode() to ocfs2_jbd2_inode_add_write() to keep >> consistent with ext4. >> wrap several long lines. >> >> fs/ocfs2/alloc.c | 5 ++++- >> fs/ocfs2/aops.c | 13 ++++++++++--- >> fs/ocfs2/file.c | 10 +++++++--- >> fs/ocfs2/journal.h | 11 +++++++---- >> 4 files changed, 28 insertions(+), 11 deletions(-) >> >> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c >> index d1348fc..54f72ad 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,8 @@ 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_inode_add_write(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..8de1c9d 100644 >> --- a/fs/ocfs2/aops.c >> +++ b/fs/ocfs2/aops.c >> @@ -942,7 +942,8 @@ 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_inode_add_write(wc->w_handle, inode, >> + user_pos, user_len); >> >> block_commit_write(tmppage, from, to); >> } >> @@ -2023,8 +2024,14 @@ 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); >> + if (handle && ocfs2_should_order_data(inode)) { >> + loff_t start_byte = >> + ((loff_t)tmppage->index << PAGE_SHIFT) + >> + from; >> + loff_t length = to - from; >> + ocfs2_jbd2_inode_add_write(handle, inode, >> + start_byte, length); >> + } >> block_commit_write(tmppage, from, to); >> } >> } >> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c >> index 4435df3..efe9988 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_byte, >> + 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_inode_add_write(handle, inode, start_byte, 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..f37473c 100644 >> --- a/fs/ocfs2/journal.h >> +++ b/fs/ocfs2/journal.h >> @@ -232,8 +232,8 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) >> * ocfs2_journal_access_*() unless you intend to >> * manage the checksum by hand. >> * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data. >> - * ocfs2_jbd2_file_inode - Mark an inode so that its data goes out before >> - * the current handle commits. >> + * ocfs2_jbd2_inode_add_write - Mark an inode with range so that its data goes >> + * out before the current handle commits. >> */ >> >> /* You must always start_trans with a number of buffs > 0, but it's >> @@ -603,9 +603,12 @@ 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_inode_add_write(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, >> > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel@oss.oracle.com > https://oss.oracle.com/mailman/listinfo/ocfs2-devel >