Skip to contentSkip to conversation

write back cache and barriers

DISCUSSION calembour 3 participants 5 messages Jul 28, 2006 – Aug 7, 2006

lore
Share & tools
lore

calembour

author
#0 lore raw

Hi,
I don't have a deep knowledge about filesystems and I've few experiences with
raid configuration, so I need someone who can answer some questions about write back cache and barriers.

I have two sata hd (sda, sdb) configured in bios-raid 0 and relative device created by dmraid on boot (nvidia_ihfaaicb).

(1) what should I do to know if the write back cache is enabled or not ?
(2) if the write cache is enabled on both sda and sdb this mean that is enabled
also on the raid device (/dev/mapper/nvidia_ihfaaicb) ?
(3) how should I do to enable/disable the write cache on the raid device ?

If I try mounting a xfs filesystem I get a message like "barriers are not supported by this device" but if I mount a ext3 or a reiserfs filesystem respectively with options barrier=1 and barrier=flush they don't complain. If I mount the reiserfs I explicity get a message like "using barriers". So who tells the truth ??

(4) is there a way to know if the raid device supports barrier or not ?
(5) is there a (not dangerous) test I can do to figure out if barriers are really enabled and used with ext3 and reiserfs filesystems ?

Thanks for reading the message
Marco

Signature · 2 lines
View this message in context: http://www.nabble.com/write-back-cache-and-barriers-tf2017234.html#a5545990
Sent from the Xfs - General forum at Nabble.com.
#1 lore raw
Quoted 7 lines · calembour

Hi,
I don't have a deep knowledge about filesystems and I've few experiences
with raid configuration, so I need someone who can answer some questions about write back cache and barriers.

I have two sata hd (sda, sdb) configured in bios-raid 0 and relative device created by dmraid on boot (nvidia_ihfaaicb).

(1) what should I do to know if the write back cache is enabled or not ?

lots of this is in the faq:
http://oss.sgi.com/projects/xfs/faq.html#wcache

Quoted 2 lines

(2) if the write cache is enabled on both sda and sdb this mean that is enabled also on the raid device (/dev/mapper/nvidia_ihfaaicb) ?

I'd guess that if there's a write cache anywhere under your device, then in effect the raid device would be considered write-cached.

Quoted 1 line

(3) how should I do to enable/disable the write cache on the raid device ?

see faq

Quoted 3 lines

If I try mounting a xfs filesystem I get a message like "barriers are not supported by this device" but if I mount a ext3 or a reiserfs filesystem respectively with options barrier=1 and barrier=flush they don't complain. If I mount the reiserfs I explicity get a message like "using barriers".
So who tells the truth ??

I don't see ext3 or reiser actually checking whether the underlying device supports barriers. xfs does, in xfs_mountfs_check_barriers().

Quoted 1 line

(4) is there a way to know if the raid device supports barrier or not ?

I'm not sure how barriers interact with multiple devices; perhaps someone else can answer....

Quoted 1 line

(5) is there a (not dangerous) test I can do to figure out if barriers are really enabled and used with ext3 and reiserfs filesystems ?

Dunno :)

-Eric

Quoted 2 lines

Thanks for reading the message
Marco

author
#2 lore raw

Thanks a lot for your hints

Marco

Signature · 2 lines
View this message in context: http://www.nabble.com/write-back-cache-and-barriers-tf2017234.html#a5592702
Sent from the Xfs - General forum at Nabble.com.
#3 lore raw
In reply to Eric Sandeen

Am Sonntag 30 Juli 2006 05:52 schrieb Eric Sandeen:

Quoted 8 lines
Quoted 5 lines

If I try mounting a xfs filesystem I get a message like "barriers are not supported by this device" but if I mount a ext3 or a reiserfs filesystem respectively with options barrier=1 and barrier=flush they don't complain. If I mount the reiserfs I explicity get a message like "using barriers". So who tells the truth ??

I don't see ext3 or reiser actually checking whether the underlying device supports barriers. xfs does, in xfs_mountfs_check_barriers().

Hello Eric,

for my article I looked at the source code of those. It seems that journal block device tests wether barriers work

commit.c:       if (ret == -EOPNOTSUPP && barrier_done) {
commit.c:                       "JBD: barrier-based sync failed on %s - "
commit.c:                       "disabling barriers\n",

Also reiserfs 3 seems to deactivate barriers if not avaible (journal.c)

                if (reiserfs_barrier_flush(p_s_sb)) {
                        int ret;
                        lock_buffer(journal->j_header_bh);
                        ret = submit_barrier_buffer(journal->j_header_bh);
                        if (ret == -EOPNOTSUPP) {
                                set_buffer_uptodate(journal->j_header_bh);
                                disable_barrier(p_s_sb);
                                goto sync;
                        }
                        wait_on_buffer(journal->j_header_bh);
                        check_barrier_completion(p_s_sb, 
journal->j_header_bh);
                } else {

(both sources from kernel 2.6.17.7)

Regards,

Signature · 2 lines
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
#4 lore raw
Quoted 24 lines · Martin Steigerwald

Hello Eric,

for my article I looked at the source code of those. It seems that journal block device tests wether barriers work

commit.c:       if (ret == -EOPNOTSUPP && barrier_done) {
commit.c:                       "JBD: barrier-based sync failed on %s - "
commit.c:                       "disabling barriers\n",

Also reiserfs 3 seems to deactivate barriers if not avaible (journal.c)

                if (reiserfs_barrier_flush(p_s_sb)) {
                        int ret;
                        lock_buffer(journal->j_header_bh);
                        ret = submit_barrier_buffer(journal->j_header_bh);
                        if (ret == -EOPNOTSUPP) {
                                set_buffer_uptodate(journal->j_header_bh);
                                disable_barrier(p_s_sb);
                                goto sync;
                        }
                        wait_on_buffer(journal->j_header_bh);
                        check_barrier_completion(p_s_sb, 
journal->j_header_bh);
                } else {
Quoted 1 line

(both sources from kernel 2.6.17.7)

Yep, you're right, not quite sure how I missed that...

Thanks,

-Eric