RE: [PATCH RFC] introduce ioctl to completely invalidate page cache

2 messages, 2 authors, 2014-10-03 · open the first message on its own page

RE: [PATCH RFC] introduce ioctl to completely invalidate page cache

From: Thanos Makatos <hidden>
Date: 2014-10-03 09:25:34

quoted
-		fsync_bdev(bdev);
-		invalidate_bdev(bdev);
+		flush_buffer_cache(bdev);
+		if (BLKFLSBUF2 == cmd)
+			return invalidate_inode_pages2(
+					bdev->bd_inode->i_mapping);
 		return 0;
We're currently ignoring the buffer cache sync and invalidation (which is odd),
but at least being consistent would be good.

Might also need a filemap_write_and_wait() to sync before invalidation.
(I've got zero knowledge in this area, so excuse my ignorance!)

Does filemap_write_and_wait() writes back modified, memory-mapped pages? If so, isn't there a race condition? Or have I got it completely wrong?

Re: [PATCH RFC] introduce ioctl to completely invalidate page cache

From: Jens Axboe <axboe@kernel.dk>
Date: 2014-10-03 14:28:28

On 2014-10-03 03:25, Thanos Makatos wrote:
quoted
quoted
-		fsync_bdev(bdev);
-		invalidate_bdev(bdev);
+		flush_buffer_cache(bdev);
+		if (BLKFLSBUF2 == cmd)
+			return invalidate_inode_pages2(
+					bdev->bd_inode->i_mapping);
  		return 0;
We're currently ignoring the buffer cache sync and invalidation (which is odd),
but at least being consistent would be good.

Might also need a filemap_write_and_wait() to sync before invalidation.
(I've got zero knowledge in this area, so excuse my ignorance!)

Does filemap_write_and_wait() writes back modified, memory-mapped pages? If so,
isn't there a race condition? Or have I got it completely wrong?
There's no race to be concerned of for this ioctl. Any page dirtied 
before you make the call will be synced, any page dirtied after may not. 
This is no different than what would happen on the buffer cache side in 
the current ioctl.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help