<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }p { margin-top: 0px; margin-bottom: 0px; }div.foxdiv20170526114444302913 { }body { font-size: 10.5pt; font-family: 'Times New Roman'; color: rgb(0, 0, 0); line-height: 1.5; }</style>
</head>
<body>
<div><span></span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div>
<div class="FoxDiv20170526114444302913">
<div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div class="FoxDiv20170422163954881342">
<p style="font-size: 16px; margin-top: 0px; margin-bottom: 0px;"><font face="\Times New Roman\" size="2" style="font-size: 16px;">This patch r<span style="line-height: 24px; widows: 1;">eplace that </span>function ocfs2_direct_IO_get_blocks with </font></p>
<p style="font-size: 16px; margin-top: 0px; margin-bottom: 0px;"><font face="\Times New Roman\" size="2" style="font-size: 16px;"><span style="line-height: 24px; widows: 1;">this function </span>ocfs2_get_blocks in ocfs2_direct_IO, </font><span style="line-height: 1.5; background-color: window;">and
remove the ip_alloc_sem.</span></p>
<p style="font-size: 16px; margin-top: 0px; margin-bottom: 0px;"><font face="\Times New Roman\" size="2" style="font-size: 16px;">but i think ip_alloc_sem is still needed because protect </font><span style="line-height: 19px; background-color: window;">allocation
changes is very correct. </span></p>
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="line-height: 19px; background-color: rgb(255, 255, 255);"><font face="\Times New Roman\" size="3">Now, BUG_ON hav</font></span><span style="font-size: 16px; line-height: 19px; background-color: window;">e
been tiggered </span><span style="font-size: 16px; line-height: 1.5; background-color: window;"> in the process of testing direct-io. </span></p>
</div>
</blockquote>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div class="FoxDiv20170422163954881342" style="font-size: 16px;"><span style="line-height: normal;"><font face="\Times New Roman\" size="2" style="font-size: 16px;">Comments and questions are, as always, welcome. Thanks </font></span></div>
<div class="FoxDiv20170422163954881342" style="font-size: 16px;"><span style="line-height: normal;"><font face="\Times New Roman\" size="2" style="font-size: 16px;"><br>
</font></span></div>
<div class="FoxDiv20170422163954881342" style="font-size: 16px;">
<p style="font-size: 14px; line-height: 21px; margin-top: 0px; margin-bottom: 0px;">
<span style="line-height: normal;"><font face="\Times New Roman\" size="3">As wangww631 described</font></span></p>
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="line-height: 19px;">In ocfs2, ip_alloc_sem is used to protect allocation changes on the node.</span><br style="line-height: 19px;">
<span style="line-height: 19px;">In direct IO, we add ip_alloc_sem to protect date consistent between</span><br style="line-height: 19px;">
<span style="line-height: 19px;">direct-io and ocfs2_truncate_file race (buffer io use ip_alloc_sem</span><br style="line-height: 19px;">
<span style="line-height: 19px;">already). Although inode->i_mutex lock is used to avoid concurrency of</span><br style="line-height: 19px;">
<span style="line-height: 19px;">above situation, i think ip_alloc_sem is still needed because protect</span><br style="line-height: 19px;">
<span style="line-height: 19px;">allocation changes is significant.</span><br style="line-height: 19px;">
<br style="line-height: 19px;">
<span style="line-height: 19px;">Other filesystem like ext4 also uses rw_semaphore to protect data</span><br style="line-height: 19px;">
<span style="line-height: 19px;">consistent between get_block-vs-truncate race by other means, So</span><br style="line-height: 19px;">
<span style="line-height: 19px;">ip_alloc_sem in ocfs2 direct io is needed.</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="line-height: 19px;"><br>
</span></p>
</div>
<div class="FoxDiv20170422163954881342"><span style="line-height: normal;"><font face="\Times New Roman\" size="2"><br>
</font></span></div>
</blockquote>
</div>
<div><span style="font-size: small; line-height: 19px;">Date: Fri, 11 Sep 2015 16:19:18 +0800</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">From: Ryan Ding <ryan.ding@oracle.com></span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">Subject: [Ocfs2-devel] [PATCH 7/8] ocfs2: fix sparse file & data</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> ordering issue in direct io.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">To: ocfs2-devel@oss.oracle.com</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">Cc: mfasheh@suse.de</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">Message-ID: <1441959559-29947-8-git-send-email-ryan.ding@oracle.com></span><br style="font-size: small; line-height: 19px;">
<br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">There are mainly 3 issue in the direct io code path after commit 24c40b329e03 ("ocfs2: implement ocfs2_direct_IO_write"):</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> * Do not support sparse file.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> * Do not support data ordering. eg: when write to a file hole, it will alloc</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> extent first. If system crashed before io finished, data will corrupt.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> * Potential risk when doing aio+dio. The -EIOCBQUEUED return value is likely</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> to be ignored by ocfs2_direct_IO_write().</span><br style="font-size: small; line-height: 19px;">
<br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">To resolve above problems, re-design direct io code with following ideas:</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> * Use buffer io to fill in holes. And this will make better performance also.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> * Clear unwritten after direct write finished. So we can make sure meta data</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> changes after data write to disk. (Unwritten extent is invisible to user,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> from user's view, meta data is not changed when allocate an unwritten</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> extent.)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> * Clear ocfs2_direct_IO_write(). Do all ending work in end_io.</span><br style="font-size: small; line-height: 19px;">
<br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">This patch has passed fs,dio,ltp-aiodio.part1,ltp-aiodio.part2,ltp-aiodio.part4</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">test cases of ltp.</span><br style="font-size: small; line-height: 19px;">
<br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">Signed-off-by: Ryan Ding <ryan.ding@oracle.com></span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com></span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">cc: Joseph Qi <joseph.qi@huawei.com></span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">---</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> fs/ocfs2/aops.c | 851 ++++++++++++++++++++++---------------------------------</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> 1 files changed, 342 insertions(+), 509 deletions(-)</span><br style="font-size: small; line-height: 19px;">
<br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">index b4ec600..4bb9921 100644</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">--- a/fs/ocfs2/aops.c</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+++ b/fs/ocfs2/aops.c</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">@@ -499,152 +499,6 @@ bail:</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> return status;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> }</span><br style="font-size: small; line-height: 19px;">
<br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-/*</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * TODO: Make this into a generic get_blocks function.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- *</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * From do_direct_io in direct-io.c:</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * "So what we do is to permit the ->get_blocks function to populate</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * bh.b_size with the size of IO which is permitted at this offset and</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * this i_blkbits."</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- *</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * This function is called directly from get_more_blocks in direct-io.c.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- *</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * called like this: dio->get_blocks(dio->inode, fs_startblk,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * fs_count, map_bh, dio->rw == WRITE);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- struct buffer_head *bh_result, int create)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-{</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- int ret;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- u32 cpos = 0;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- int alloc_locked = 0;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- u64 p_blkno, inode_blocks, contig_blocks;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- unsigned int ext_flags;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- unsigned long len = bh_result->b_size;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- unsigned int clusters_to_alloc = 0, contig_clusters = 0;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- cpos = ocfs2_blocks_to_clusters(inode->i_sb, iblock);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /* This function won't even be called if the request isn't all</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * nicely aligned and of the right size, so there's no need</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * for us to check any of that. */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- inode_blocks = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- down_read(&OCFS2_I(inode)->ip_alloc_sem);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /* This figures out the size of the next contiguous block, and</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * our logical offset */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- ret = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- &contig_blocks, &ext_flags);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- up_read(&OCFS2_I(inode)->ip_alloc_sem);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (ret) {</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- mlog(ML_ERROR, "get_blocks() failed iblock=%llu\n",</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- (unsigned long long)iblock);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- ret = -EIO;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- goto bail;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- }</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /* We should already CoW the refcounted extent in case of create. */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- BUG_ON(create && (ext_flags & OCFS2_EXT_REFCOUNTED));</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /* allocate blocks if no p_blkno is found, and create == 1 */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (!p_blkno && create) {</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- ret = ocfs2_inode_lock(inode, NULL, 1);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (ret < 0) {</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- mlog_errno(ret);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- goto bail;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- }</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- alloc_locked = 1;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- down_write(&OCFS2_I(inode)->ip_alloc_sem);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /* fill hole, allocate blocks can't be larger than the size</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * of the hole */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- clusters_to_alloc = ocfs2_clusters_for_bytes(inode->i_sb, len);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- contig_clusters = ocfs2_clusters_for_blocks(inode->i_sb,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- contig_blocks);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (clusters_to_alloc > contig_clusters)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- clusters_to_alloc = contig_clusters;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /* allocate extent and insert them into the extent tree */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- ret = ocfs2_extend_allocation(inode, cpos,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- clusters_to_alloc, 0);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (ret < 0) {</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- up_write(&OCFS2_I(inode)->ip_alloc_sem);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- mlog_errno(ret);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- goto bail;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- }</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- ret = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- &contig_blocks, &ext_flags);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (ret < 0) {</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- up_write(&OCFS2_I(inode)->ip_alloc_sem);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- mlog(ML_ERROR, "get_blocks() failed iblock=%llu\n",</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- (unsigned long long)iblock);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- ret = -EIO;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- goto bail;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- }</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- up_write(&OCFS2_I(inode)->ip_alloc_sem);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- }</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /*</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * get_more_blocks() expects us to describe a hole by clearing</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * the mapped bit on bh_result().</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- *</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- * Consider an unwritten extent as a hole.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (p_blkno && !(ext_flags & OCFS2_EXT_UNWRITTEN))</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- map_bh(bh_result, inode->i_sb, p_blkno);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- else</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- clear_buffer_mapped(bh_result);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- /* make sure we don't map more than max_blocks blocks here as</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- that's all the kernel will handle at this point. */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (max_blocks < contig_blocks)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- contig_blocks = max_blocks;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- bh_result->b_size = contig_blocks << blocksize_bits;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-bail:</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- if (alloc_locked)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- ocfs2_inode_unlock(inode, 1);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">- return ret;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">-}</span><br style="font-size: small; line-height: 19px;">
<br>
<font size="2"><span style="line-height: 19px;">......</span></font></div>
<div><br>
</div>
<div><span style="font-size: small; line-height: 19px;">+static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ loff_t offset)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+{</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ struct file *file = iocb->ki_filp;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ struct inode *inode = file_inode(file)->i_mapping->host;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ loff_t end = offset + iter->count;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ get_block_t *get_block;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ /*</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ * Fallback to buffered I/O if we see an inode without</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ * extents.</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ return 0;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ /* Fallback to buffered I/O if we do not support append dio. */</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ if (end > i_size_read(inode) && !ocfs2_supports_append_dio(osb))</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ return 0;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ if (iov_iter_rw(iter) == READ)</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ get_block = ocfs2_get_block;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ else</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ get_block = ocfs2_dio_get_block;</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ iter, offset, get_block,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+ ocfs2_dio_end_io, NULL, 0);</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+}</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;">+</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> const struct address_space_operations ocfs2_aops = {</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> .readpage = ocfs2_readpage,</span><br style="font-size: small; line-height: 19px;">
<span style="font-size: small; line-height: 19px;"> .readpages = ocfs2_readpages,</span></div>
<hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span>
<div style="margin: 10px; font-size: 10pt;">
<div style="font-size: 16px;"><font face="verdana" color="#000080"><i>All the best wishes for you.</i></font></div>
<div style="font-size: 16px;"><i style="line-height: 1.5; font-family: verdana; background-color: window;"><font color="#000080">zhangguanghui</font></i></div>
</div>
</span></div>
</div>
</div>
</blockquote>
<span style="font-size:7.5pt;font-family:华文细黑;color:gray"><span lang="EN-US">-------------------------------------------------------------------------------------------------------------------------------------<br>
</span>本邮件及其附件含有新华三技术有限公司的保密信息,仅限于发送给上面地址中列出<span lang="EN-US"><br>
</span>的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、<span lang="EN-US"><br>
</span>或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本<span lang="EN-US"><br>
</span>邮件!<span lang="EN-US"><br>
</span></span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:gray">This e-mail and its attachments contain confidential information from New H3C, which is
<br>
intended only for the person or entity whose address is listed above. Any use of the
<br>
information contained herein in any way (including, but not limited to, total or partial
<br>
disclosure, reproduction, or dissemination) by persons other than the intended <br>
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
<br>
by phone or email immediately and delete it!</span>
</body>
</html>