mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ali Ahmed Thawerani" <aaht14@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: PROBLEM how to sync page cache ?
Date: Thu, 9 Mar 2006 10:53:30 +0500	[thread overview]
Message-ID: <ca8cd3800603082153j12b809ted85baad825bfb2a@mail.gmail.com> (raw)
In-Reply-To: <ca8cd3800603080152t5495d42chda434f1256a59a1b@mail.gmail.com>

On 3/8/06, Ali Ahmed Thawerani <aaht14@gmail.com> wrote:
> i have written a wrapper for a block device. my wrapper is also
> registered as a block device and i am obtaining the pointer bdev of
> the wrapper block device by using the open_by_devnum function with
> FMODE_READ | FMODE_WRITE
>
> i want to sync the memory pages that are in the page cache for this
> particular wrapper block device
>
> what i am doing is using two functions filemap_fdatawrite and
> filemap_fdatawait which take bdev->bd_inode->i_mapping as argument and
> sync the data associated with a particular block device
>
> the return status of these two functions is 0 which i think means no success
>
> i have tried to figure out what can be the reason for this and i
> followed the function calling that have been made
>
> some of the possible reasons were: when
> i_mapping->backing_dev_info->memory_backed is 1 then these functions
> return 0 i have checked that this value is not greater than 0 moreover
> i have also checked that the i_mapping->nr_pages are also greater than
> 0
>
> i was not able to go any further
>
> i am calling these two functions in a thread
>
> there was also another problem that when there is some request coming
> to my wrapper block device and wake up the thread which tries to sync
> the page cache my system gets stuck may be both the threads are trying
> to modify the inodes at the same time and none is succeeding
>
> what i did to solve this problem that i used kernel timer if there is
> no request in the request queue for jiffies + 30 then i wake up the
> thread to sync the buffer cache and at the same time set a
> flag........ as according to my assumption when buffer cache will sync
> data will come to my wrapper block device and i have to requeue it to
> avoid any sort of problem but the thing is no such thing happens that
> is there is no new request in request queue at all
>
> can any one help me out in this
>
i want to add a few more things that i have tried

i looked at the function filemap_fdatawrite and followed the function
calling at got to do_writepages which was in turn calling either the
i_mapping->a_ops->writepages or generic_writepages with the parameters
mapping and wbc

i copied do_writepages as it is in my code and gave i_mapping in place
of mapping and defined a structure of struct writeback_control with
syncmode = WB_SYNC_ALL, start = 0, end = 0, nr_to_write =
i_mapping->nr_pages * 2 and non_blocking = 1 the values of start and
end are given 0 in __filemap_fdatawrite and syncmode = WB_SYNC_ALL is
given in filemap_fdatawrite so i just gave the same values

i have seen that i_mapping->a_ops->writepages is assigned
generic_writepages and generic_writepages calls mpage_writepages

  reply	other threads:[~2006-03-09  5:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-08  9:52 Ali Ahmed Thawerani
2006-03-09  5:53 ` Ali Ahmed Thawerani [this message]
2006-03-10 12:50   ` Ali Ahmed Thawerani

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=ca8cd3800603082153j12b809ted85baad825bfb2a@mail.gmail.com \
    --to=aaht14@gmail.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®