* question regarding caching
@ 2013-12-31 2:24 Aastha Mehta
2013-12-31 3:15 ` Kai Krakow
2013-12-31 18:27 ` Austin S Hemmelgarn
0 siblings, 2 replies; 7+ messages in thread
From: Aastha Mehta @ 2013-12-31 2:24 UTC (permalink / raw)
To: linux-btrfs
Hello,
I have some questions regarding caching in BTRFS. When a file system
is unmounted and mounted again, would all the previously cached
content be removed from the cache after flushing to disk? After
remounting, would the initial requests always be fetched from the
disk?
Rather than a local disk, I have a remote device to which my IO
requests are sent and from which the data is fetched. I need certain
data to be fetched from the remote device after a remount. But somehow
I do not see any request appearing at the device. I even tried to do
drop_caches after remounting the file system, but that does not seem
to help.
I guess my problem is not related to BTRFS, but since I am working
with BTRFS, I wanted to ask here for help. Could any one tell me how I
can ensure that requests are fetched from the (remote) device,
especially after file system remount, without having to use
drop_caches?
Please let me know if I described the problem too vaguely and should
give some more details.
Wishing everyone a happy new year.
Thanks and regards,
Aastha.
--
Aastha Mehta
MPI-SWS, Germany
E-mail: aasthakm@mpi-sws.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question regarding caching
2013-12-31 2:24 question regarding caching Aastha Mehta
@ 2013-12-31 3:15 ` Kai Krakow
2013-12-31 17:02 ` Alex Elsayed
2013-12-31 18:27 ` Austin S Hemmelgarn
1 sibling, 1 reply; 7+ messages in thread
From: Kai Krakow @ 2013-12-31 3:15 UTC (permalink / raw)
To: linux-btrfs
Aastha Mehta <aasthakm@gmail.com> schrieb:
> Rather than a local disk, I have a remote device to which my IO
> requests are sent and from which the data is fetched. I need certain
> data to be fetched from the remote device after a remount. But somehow
> I do not see any request appearing at the device. I even tried to do
> drop_caches after remounting the file system, but that does not seem
> to help.
Maybe you or your distribution deployed cachefilesd and uses it for the
remote fs?
HTH
Kai
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question regarding caching
2013-12-31 3:15 ` Kai Krakow
@ 2013-12-31 17:02 ` Alex Elsayed
0 siblings, 0 replies; 7+ messages in thread
From: Alex Elsayed @ 2013-12-31 17:02 UTC (permalink / raw)
To: linux-btrfs
Kai Krakow wrote:
> Aastha Mehta <aasthakm@gmail.com> schrieb:
>
>> Rather than a local disk, I have a remote device to which my IO
>> requests are sent and from which the data is fetched. I need certain
>> data to be fetched from the remote device after a remount. But somehow
>> I do not see any request appearing at the device. I even tried to do
>> drop_caches after remounting the file system, but that does not seem
>> to help.
>
> Maybe you or your distribution deployed cachefilesd and uses it for the
> remote fs?
The FS-Cache infrastructure only applies to filesystems which opt in to
using it (NFS, recent work on Ceph, etc), so mounting btrfs over a remote
block device wouldn't use it at all.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question regarding caching
2013-12-31 2:24 question regarding caching Aastha Mehta
2013-12-31 3:15 ` Kai Krakow
@ 2013-12-31 18:27 ` Austin S Hemmelgarn
2014-01-03 8:39 ` Sander
1 sibling, 1 reply; 7+ messages in thread
From: Austin S Hemmelgarn @ 2013-12-31 18:27 UTC (permalink / raw)
To: Aastha Mehta, linux-btrfs
On 12/30/2013 09:24 PM, Aastha Mehta wrote:
> Hello,
>
> I have some questions regarding caching in BTRFS. When a file
> system is unmounted and mounted again, would all the previously
> cached content be removed from the cache after flushing to disk?
> After remounting, would the initial requests always be fetched from
> the disk?
>
> Rather than a local disk, I have a remote device to which my IO
> requests are sent and from which the data is fetched. I need
> certain data to be fetched from the remote device after a remount.
> But somehow I do not see any request appearing at the device. I
> even tried to do drop_caches after remounting the file system, but
> that does not seem to help.
>
> I guess my problem is not related to BTRFS, but since I am working
> with BTRFS, I wanted to ask here for help. Could any one tell me
> how I can ensure that requests are fetched from the (remote)
> device, especially after file system remount, without having to
> use drop_caches?
>
> Please let me know if I described the problem too vaguely and
> should give some more details.
The data is probably still cached in the block layer, so after
unmounting, you could try 'echo 1 > /proc/sys/vm/drop_caches' before
mounting again, but make sure to run sync right before doing that,
otherwise you might lose data.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question regarding caching
2013-12-31 18:27 ` Austin S Hemmelgarn
@ 2014-01-03 8:39 ` Sander
2014-01-03 12:12 ` Austin S Hemmelgarn
0 siblings, 1 reply; 7+ messages in thread
From: Sander @ 2014-01-03 8:39 UTC (permalink / raw)
To: Austin S Hemmelgarn; +Cc: Aastha Mehta, linux-btrfs
Austin S Hemmelgarn wrote (ao):
> The data is probably still cached in the block layer, so after
> unmounting, you could try 'echo 1 > /proc/sys/vm/drop_caches' before
> mounting again, but make sure to run sync right before doing that,
> otherwise you might lose data.
Lose data? Where you get this from?
Sander
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question regarding caching
2014-01-03 8:39 ` Sander
@ 2014-01-03 12:12 ` Austin S Hemmelgarn
2014-01-07 14:50 ` Aastha Mehta
0 siblings, 1 reply; 7+ messages in thread
From: Austin S Hemmelgarn @ 2014-01-03 12:12 UTC (permalink / raw)
To: sander; +Cc: Aastha Mehta, linux-btrfs
On 2014-01-03 03:39, Sander wrote:
> Austin S Hemmelgarn wrote (ao):
>> The data is probably still cached in the block layer, so after
>> unmounting, you could try 'echo 1 > /proc/sys/vm/drop_caches'
>> before mounting again, but make sure to run sync right before
>> doing that, otherwise you might lose data.
>
> Lose data? Where you get this from?
>
> Sander
>
Sorry, misread the documentation, thought it said destructive where it
really said non-destructive.
It's still a good idea to run sync before trying to clear the caches
though, cause dirty objects aren't freeable.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question regarding caching
2014-01-03 12:12 ` Austin S Hemmelgarn
@ 2014-01-07 14:50 ` Aastha Mehta
0 siblings, 0 replies; 7+ messages in thread
From: Aastha Mehta @ 2014-01-07 14:50 UTC (permalink / raw)
To: Austin S Hemmelgarn; +Cc: sander, linux-btrfs
On 3 January 2014 13:12, Austin S Hemmelgarn <ahferroin7@gmail.com> wrote:
>
> On 2014-01-03 03:39, Sander wrote:
> > Austin S Hemmelgarn wrote (ao):
> >> The data is probably still cached in the block layer, so after
> >> unmounting, you could try 'echo 1 > /proc/sys/vm/drop_caches'
> >> before mounting again, but make sure to run sync right before
> >> doing that, otherwise you might lose data.
> >
> > Lose data? Where you get this from?
> >
> > Sander
> >
> Sorry, misread the documentation, thought it said destructive where it
> really said non-destructive.
> It's still a good idea to run sync before trying to clear the caches
> though, cause dirty objects aren't freeable.
Hello,
I figured out what the problem was. After remounting, I was doing
fseek to the end of file to calculate the file size. It seems that
fseek does prefetching of file data, which is why my reads were being
served from the cache rather than from the disk. I could not find
where this prefetching is called from. Anyways, using fstat instead of
fseek to find the file size ensures that there is no unwanted
prefetching.
Thanks,
Aastha.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-01-07 14:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-31 2:24 question regarding caching Aastha Mehta
2013-12-31 3:15 ` Kai Krakow
2013-12-31 17:02 ` Alex Elsayed
2013-12-31 18:27 ` Austin S Hemmelgarn
2014-01-03 8:39 ` Sander
2014-01-03 12:12 ` Austin S Hemmelgarn
2014-01-07 14:50 ` Aastha Mehta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).