Skip to contentSkip to conversation

PG_updatodate vs BH_updatodate

DISCUSSION Francis Moreau 4 participants 7 messages Nov 21, 2008 – Nov 24, 2008 VFS

lore
Share & tools
lore
#0 lore raw

Hello,

I'm wondering if there's any difference between these 2 flags except that one is a page flag and the other one is a buffer head flag.

But in my understanding these 2 flags means that the page contains uptodate data. So the buffer head flag seems useless since it could be calculated from bh->b_page->flags.

Thanks for any hints

Francis

#1 lore raw
Quoted 6 lines · Francis Moreau

I'm wondering if there's any difference between these 2 flags except that one is a page flag and the other one is a buffer head flag.

But in my understanding these 2 flags means that the page contains uptodate data. So the buffer head flag seems useless since it could be calculated from bh->b_page->flags.

There may be multiple buffers on a single page, and in some cases one buffer on a page can be uptodate while another buffer on the same page is not. This can be confusing at times, but I don't know if there is any easy way to avoid it.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

#2 lore raw

Hello,

Thanks for your answer.

Quoted 3 lines · Andreas Dilger

There may be multiple buffers on a single page, and in some cases one buffer on a page can be uptodate while another buffer on the same page is not.

Can this really happen ?

Are there any cases where a page can be partially uptodate ?

Francis

#3 lore raw
Quoted 11 lines · Francis Moreau

Hello,

Thanks for your answer.

Quoted 3 lines · Andreas Dilger

There may be multiple buffers on a single page, and in some cases one buffer on a page can be uptodate while another buffer on the same page is not.

Can this really happen ?

Yes.

Quoted 1 line

Are there any cases where a page can be partially uptodate ?

Consider a filesystem with 1k blocks and a system with a page size of 4k. You have a buffer_head for each of the four blocks that are being kept in the page, and you want to track their dirty state independently.

For file data, no this doesn't happen. But for metadata, it happens quite easily.

Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#4 lore raw
Quoted 7 lines · Matthew Wilcox
Quoted 1 line · Francis Moreau

Are there any cases where a page can be partially uptodate ?

Consider a filesystem with 1k blocks and a system with a page size of 4k. You have a buffer_head for each of the four blocks that are being kept in the page, and you want to track their dirty state independently.

Sorry but I'm confused since you're taking about the dirty state (tracked by BH_Dirty bit) and I was taking about the uptodate state (tracked by BH_Uptodate bit).

Quoted 3 lines

For file data, no this doesn't happen. But for metadata, it happens quite easily.

Could you give me an example of these metadata ?

Thanks

Francis

#5 lore raw
Quoted 5 lines · Francis Moreau
Quoted 4 lines · Matthew Wilcox
Quoted 1 line · Francis Moreau

Are there any cases where a page can be partially uptodate ?

Quoted 7 lines
Quoted 3 lines

Consider a filesystem with 1k blocks and a system with a page size of 4k. You have a buffer_head for each of the four blocks that are being kept in the page, and you want to track their dirty state independently.

Sorry but I'm confused since you're taking about the dirty state (tracked by BH_Dirty bit) and I was taking about the uptodate state (tracked by BH_Uptodate bit).

Think page cache, except that the granularity is not pages but 1k blocks. If your filesystem wants to read an indirect block, 1k is read into the cache, the other 3k (or 63k) of the page remain as they were.

If you have to cache data on a granularity smaller than a page, as many filesystems, your only alternative would be to leave the remaining 3k (or 63k) empty - a rather wasteful approach.

Jörn

Signature · 6 lines
A surrounded army must be given a way out.
-- Sun Tzu
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
Quoted 10 lines · Jörn Engel
Quoted 9 lines · Francis Moreau
Quoted 7 lines · Matthew Wilcox
Quoted 1 line · Francis Moreau

Are there any cases where a page can be partially uptodate ?

Consider a filesystem with 1k blocks and a system with a page size of 4k. You have a buffer_head for each of the four blocks that are being kept in the page, and you want to track their dirty state independently.

Quoted 8 lines
Quoted 3 lines

Sorry but I'm confused since you're taking about the dirty state (tracked by BH_Dirty bit) and I was taking about the uptodate state (tracked by BH_Uptodate bit).

Think page cache, except that the granularity is not pages but 1k blocks. If your filesystem wants to read an indirect block, 1k is read into the cache, the other 3k (or 63k) of the page remain as they were.

So if I understand you correctly, we can update a page cache partially only when the
filesystems needs to read its metadata. But not when reading a page of data.

That's pretty what Matthew answered I think but I'm confused about the dirty bit of the
buffer header he mentioned.

Thanks

Signature · 5 lines
Francis
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html