All of lore.kernel.org
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: "Yan, Zheng" <ukernel@gmail.com>
Cc: sage <sage@inktank.com>, ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: Re: question about striped_read
Date: Tue, 30 Jul 2013 10:08:15 +0800	[thread overview]
Message-ID: <201307300856506858451@gmail.com> (raw)
In-Reply-To: CAAM7YAmB=o28DjT4N2KzQ73zo14miq8pDR2U6MKrGRo1MpawwQ@mail.gmail.com

>On Mon, Jul 29, 2013 at 11:00 AM, majianpeng <majianpeng@gmail.com> wrote:
>>
>> [snip]
>> >I don't think the later was_short can handle the hole case. For the hole case,
>> >we should try reading next strip object instead of return. how about
>> >below patch.
>> >
>> Hi Yan,
>>         i uesed this demo to test hole case.
>> dd if=/dev/urandom bs=4096 count=2 of=file_with_holes
>> dd if=/dev/urandom bs=4096 seek=7 count=2 of=file_with_holes
>>
>> dd if=file_with_holes of=/dev/null bs=16k count=1 iflag=direct
>> Using the dynamic_debug in striped_read,  the message are:
>> >[ 8743.663499] ceph:           file.c:350  : striped_read 0~16384 (read 0) got 16384
>> >[ 8743.663502] ceph:           file.c:390  : striped_read returns 16384
>> From the messages, we can see it can't hit the short-read.
>> For the ceph-file-hole, how does the ceph handle?
>> Or am i missing something?
>
>the default strip size is 4M, all data are written to the first object
>in your test case.
>could you try something like below.
>
>dd if=/dev/urandom bs=1M count=2 of=file_with_holes
>dd if=/dev/urandom bs=1M count=2 seek=4 of=file_with_holes conv=notrunc
>dd if=file_with_holes bs=8M >/dev/null
>

From above test, i think your patch is right.
Although, the original code can work but it  call multi striped_read.
As your said for stripe short-read,it doesn't make sense to return rather than reading next stripe.
But can you add some comments for this?
The short-read reasongs are two:EOF or hit-hole.
But for hit-hole there are some differents case. For that i don't know.

Thanks!
Jianpeng Ma
>Regards
>Yan, Zheng
>
>
>>
>>
>> Thanks!
>> Jianpeng Ma
>>
>> >Regards
>> >Yan, Zheng
>> >---
>> >diff --git a/fs/ceph/file.c b/fs/ceph/file.c
>> >index 271a346..6ca2921 100644
>> >--- a/fs/ceph/file.c
>> >+++ b/fs/ceph/file.c
>> >@@ -350,16 +350,17 @@ more:
>> >            ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : "");
>> >
>> >       if (ret > 0) {
>> >-              int didpages = (page_align + ret) >> PAGE_CACHE_SHIFT;
>> >+              int didpages = (page_align + this_len) >> PAGE_CACHE_SHIFT;
>> >
>> >-              if (read < pos - off) {
>> >-                      dout(" zero gap %llu to %llu\n", off + read, pos);
>> >-                      ceph_zero_page_vector_range(page_align + read,
>> >-                                                  pos - off - read, pages);
>> >+              if (was_short) {
>> >+                      dout(" zero gap %llu to %llu\n",
>> >+                           pos + ret, pos + this_len);
>> >+                      ceph_zero_page_vector_range(page_align + ret,
>> >+                                                  this_len - ret, page_pos);
>> >               }
>> >-              pos += ret;
>> >+              pos += this_len;
>> >               read = pos - off;
>> >-              left -= ret;
>> >+              left -= this_len;
>> >               page_pos += didpages;
>> >               pages_left -= didpages;
>> >
Thanks!
Jianpeng Ma
>On Mon, Jul 29, 2013 at 11:00 AM, majianpeng <majianpeng@gmail.com> wrote:
>>
>> [snip]
>> >I don't think the later was_short can handle the hole case. For the hole case,
>> >we should try reading next strip object instead of return. how about
>> >below patch.
>> >
>> Hi Yan,
>>         i uesed this demo to test hole case.
>> dd if=/dev/urandom bs=4096 count=2 of=file_with_holes
>> dd if=/dev/urandom bs=4096 seek=7 count=2 of=file_with_holes
>>
>> dd if=file_with_holes of=/dev/null bs=16k count=1 iflag=direct
>> Using the dynamic_debug in striped_read,  the message are:
>> >[ 8743.663499] ceph:           file.c:350  : striped_read 0~16384 (read 0) got 16384
>> >[ 8743.663502] ceph:           file.c:390  : striped_read returns 16384
>> From the messages, we can see it can't hit the short-read.
>> For the ceph-file-hole, how does the ceph handle?
>> Or am i missing something?
>
>the default strip size is 4M, all data are written to the first object
>in your test case.
>could you try something like below.
>
>dd if=/dev/urandom bs=1M count=2 of=file_with_holes
>dd if=/dev/urandom bs=1M count=2 seek=4 of=file_with_holes conv=notrunc
>dd if=file_with_holes bs=8M >/dev/null
>
>Regards
>Yan, Zheng
>
>
>>
>>
>> Thanks!
>> Jianpeng Ma
>>
>> >Regards
>> >Yan, Zheng
>> >---
>> >diff --git a/fs/ceph/file.c b/fs/ceph/file.c
>> >index 271a346..6ca2921 100644
>> >--- a/fs/ceph/file.c
>> >+++ b/fs/ceph/file.c
>> >@@ -350,16 +350,17 @@ more:
>> >            ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : "");
>> >
>> >       if (ret > 0) {
>> >-              int didpages = (page_align + ret) >> PAGE_CACHE_SHIFT;
>> >+              int didpages = (page_align + this_len) >> PAGE_CACHE_SHIFT;
>> >
>> >-              if (read < pos - off) {
>> >-                      dout(" zero gap %llu to %llu\n", off + read, pos);
>> >-                      ceph_zero_page_vector_range(page_align + read,
>> >-                                                  pos - off - read, pages);
>> >+              if (was_short) {
>> >+                      dout(" zero gap %llu to %llu\n",
>> >+                           pos + ret, pos + this_len);
>> >+                      ceph_zero_page_vector_range(page_align + ret,
>> >+                                                  this_len - ret, page_pos);
>> >               }
>> >-              pos += ret;
>> >+              pos += this_len;
>> >               read = pos - off;
>> >-              left -= ret;
>> >+              left -= this_len;
>> >               page_pos += didpages;
>> >               pages_left -= didpages;
>> >

  reply	other threads:[~2013-07-30  2:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25  0:52 question about striped_read majianpeng
2013-07-25  5:54 ` Sage Weil
2013-07-25  6:55   ` majianpeng
2013-07-25 12:27     ` Yan, Zheng
2013-07-25 15:50       ` Sage Weil
2013-07-26  0:48         ` majianpeng
2013-07-26  1:14           ` Yan, Zheng
2013-07-26  1:22             ` majianpeng
2013-07-26  1:36               ` Yan, Zheng
2013-07-26  1:38                 ` majianpeng
2013-07-26  1:59                   ` Yan, Zheng
2013-07-26  2:07                     ` majianpeng
     [not found]                       ` <CAAM7YAkNQA5PqVr15CXRQ5xPLk42VCCb3kf3U8ic9f6n3d9SGg@mail.gmail.com>
2013-07-29  3:00                         ` majianpeng
2013-07-29  5:02                           ` Yan, Zheng
2013-07-30  2:08                             ` majianpeng [this message]
2013-07-30  2:56                               ` Yan, Zheng
2013-07-30 11:01                             ` majianpeng
2013-07-30 11:14                               ` Yan, Zheng
2013-07-30 11:20                                 ` majianpeng
2013-07-30 11:41                                 ` majianpeng
2013-07-30 12:25                                   ` Yan, Zheng
2013-07-31  0:27                                     ` majianpeng
2013-07-31  0:40                                       ` Sage Weil
2013-07-31  0:44                                         ` majianpeng
2013-07-31  0:47                                           ` Sage Weil
2013-07-31  1:36                                             ` majianpeng
     [not found]                                               ` <CAAM7YAnGaXcQm1LcaCUGL71FGRV5zfNx1iRObFkvXsyVpu91Ag@mail.gmail.com>
2013-07-31  5:46                                                 ` majianpeng
     [not found]                                                   ` <CAAM7YAmv6Ar_oTdYG31YSHnQwyUUYSNq3Zj_4fHcwMoOvno7Sw@mail.gmail.com>
2013-07-31  7:32                                                     ` majianpeng
2013-07-31  8:26                                                       ` Yan, Zheng
2013-08-01  1:45                                                         ` majianpeng
2013-08-01  3:29                                                           ` Yan, Zheng
2013-08-01  6:30                                                             ` majianpeng
2013-08-01  7:19                                                               ` Yan, Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201307300856506858451@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    --cc=ukernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.