From: Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
To: Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: CIFS data coherency problem
Date: Sun, 12 Sep 2010 20:09:16 -0400 [thread overview]
Message-ID: <20100912200916.1df5d752@corrin.poochiereds.net> (raw)
In-Reply-To: <AANLkTi=XT_X27Cuioe_M6zMee0XQAZe+P-TLHbh6n+Yk-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Sun, 12 Sep 2010 23:14:35 +0400
Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 2010/9/12 Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>:
> > write_begin/write_end are called on each page in a write syscall. So if
> > your application is writing in 64k page-aligned chunks, write_end will
> > be called 16 times. When you have no oplock with this patch, for each
> > call to write_end, you're calling cifs_write which will flush each
> > single page synchronously and only that single page to the server. Your
> > 64k write will take 16 round trips to the server to complete.
> >
> > What you probably want to do instead is populate the pagecache with the
> > write contents (as is done today), flush the write and wait on the
> > result. Optionally, you could then invalidate the cache to free up the
> > pagecache pages (though you'll need to take care not to race with other
> > writers).
>
> Ok, I understand you. What do you think about the following idea?
>
> 1) if we don't have an exclusive oplock, we write the data to the
> server before do_sync_write but in cifs_write_end we don't mark the
> page as dirty and don't write to the server;
>
> 2) if we have an exclusive oplock, we don't write the data before
> do_sync_write and mark page as dirty in cifs_write_end (again we don't
> write anything to the server in cifs_write_end);
>
Sorry, I'm not quite following what you mean here. I don't think you
need to mess with cifs_write_end at all.
What I think you basically want to do is replace the filemap_fdatawrite
clause in cifs_file_aio_write with a filemap_write_and_wait. If you
want to get a little more fancy, you could just have it flush the range
of the file actually being written.
After that, you could also consider invalidating the pages in the
mapping (thereby allowing the VM to reclaim them) if you don't have an
oplock.
IOW, you want to write to the pagecache regardless of whether you have
an oplock or not. The oplock only decides whether you flush the data to
the server and wait on the result after writing to the pagecache.
--
Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
next prev parent reply other threads:[~2010-09-13 0:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTin2iSc=Ob3DkhARJRV7CzwRUBJSGRMUJNJM+82k@mail.gmail.com>
[not found] ` <AANLkTin2iSc=Ob3DkhARJRV7CzwRUBJSGRMUJNJM+82k-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-08 6:49 ` Fwd: CIFS data coherency problem Pavel Shilovsky
[not found] ` <AANLkTi=_eMSC99K1a2zWpgW5nc8UArzKj2MWHaRmCXzK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-08 10:32 ` Jeff Layton
[not found] ` <20100908063224.240b0419-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-09-08 11:04 ` Jeff Layton
[not found] ` <20100908070416.1f231387-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-09-09 18:22 ` Pavel Shilovsky
2010-09-09 18:18 ` Pavel Shilovsky
[not found] ` <AANLkTinYFe6O-4ANt1VYcvEMukiis-11cDuMP2GSKZ7j-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-09 18:25 ` Steve French
[not found] ` <AANLkTin+qiQsF_hOCvdBKtCh0n0bcd82RDOUz=h3K6gu-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-09 18:34 ` Pavel Shilovsky
[not found] ` <AANLkTikOR_HU934L6FKq8q2ZwcaTTOTPfaSofimK6OFH-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-10 0:50 ` Steve French
[not found] ` <AANLkTi=zc7G847VHqVjO7LRfLkzzSGsJURvJmH1C8gOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-10 7:50 ` Pavel Shilovsky
[not found] ` <AANLkTikXWGNtuOjPbG0wAdHLuVQOVuouaUaBi4HRwSR--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-10 12:15 ` Jeff Layton
[not found] ` <20100910081549.41de32d1-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-09-10 20:16 ` Pavel Shilovsky
[not found] ` <AANLkTi=5YgKzG=rXJ5MuV+R_MGkEd+2ERouUiEc8K5B8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-10 22:50 ` Jeff Layton
[not found] ` <20100910185002.73e61b8b-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-09-11 7:08 ` Pavel Shilovsky
[not found] ` <AANLkTik_=xi5Engkm4Xcrk_WUaXSsSAsWUhh=M8VYWer-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-12 13:16 ` Jeff Layton
[not found] ` <20100912091659.73ef9cdb-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-09-12 14:55 ` Pavel Shilovsky
[not found] ` <AANLkTi=gSm+=djrj796Gfjx9FiRQ7s==6DSV=DhYOk7U-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-12 15:40 ` Jeff Layton
[not found] ` <20100912114055.55520f0c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-09-12 16:16 ` Pavel Shilovsky
[not found] ` <AANLkTi=LMy37zVnyKTX_gnf1QAqXja6vuTruVMjfRCdp-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-12 16:55 ` Jeff Layton
[not found] ` <20100912125535.60c3c897-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-09-12 19:14 ` Pavel Shilovsky
[not found] ` <AANLkTi=XT_X27Cuioe_M6zMee0XQAZe+P-TLHbh6n+Yk-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-13 0:09 ` Jeff Layton [this message]
2010-09-12 21:19 ` Steve French
[not found] ` <AANLkTi=x6gnS=++JtjEG6KVwq4_JPLfU+pKuCYgFd+xD-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-13 0:15 ` Jeff Layton
[not found] ` <20100912201502.624c8f33-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-09-13 0:37 ` Steve French
[not found] ` <AANLkTinfnGh8-egSfoEeik_iR2=hRvUF0qk9DFTVcdU8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-14 12:41 ` Pavel Shilovsky
2010-09-13 9:49 ` Pavel Shilovsky
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=20100912200916.1df5d752@corrin.poochiereds.net \
--to=jlayton-eunubhrolfbytjvyw6ydsg@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox