Re: Linux SATA RAID FAQ

Jakob Oestergaard
2004-08-15T21:42:52Z

On Sun, Aug 15, 2004 at 10:54:02PM +0200, Xavier Bestel wrote:
> Le sam 14/08/2004 à 23:49, Alan Cox a écrit :
> > > > * Caching
> >
> > Is it battery backed ? If it is battery backed then its useful, if not
> > then it becomes less useful although not always. The i2o drivers have
> > some ioctls so you can turn on writeback caching even without battery
> > backup. While this is suicidal for filesytems its just great for swap..
>
> Isn't sufficient to have it do ordered writes ? If you power your
> machine off, you'll have things half-written anyway, the only thing
> important with journaled filesystems (and raid5 arrays) is to have
> writes staying between barriers.

On a RAID controller with battery backed write-back cache, it can
complete a "sync" operation as soon as the data is in the controller
cache. This gives a significant performance speedup.

If the cache is not battery backed and power is lost after such a "sync"
operation, then data that the kernel/userspace thought was sync'ed to
disk is actually lost.

This *will* break journalling filesystems and databases. They work from
the assumption that 'sync' means 'sync' - and if it doesn't, then all
hell breaks lose.

It is common to enforce ordering of writes by issuing a 'sync' of some
data and after the sync completes then starting the writeout of the
'next' data. On a controller with write-back cache without battery
backup, you could actually risk that your 'next' data were written
before the data you just issued a 'sync' for.

In other words; write-back cache without battery backup is absolutely
insane, except for some few isolated cases, such as swap-space that Alan
pointed out.

--

/ jakob