FreeBSD/sys/boot/common/bcache.c
/*
 * Handle a write request; write directly to the disk, and populate the
 * cache with the new values.
 */
Handle a write request; write directly to the disk, and populate the
cache with the new values.
Handle a write request ; write directly to the disk and populate the cache with the new values .
static int
write_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
    size_t size, char *buf, size_t *rsize)
{
    struct bcache_devdata	*dd = (struct bcache_devdata *)devdata;
    struct bcache		*bc = dd->dv_cache;
    daddr_t			i, nblk;
    nblk = size / bcache_blksize;
    for (i = 0; i < nblk; i++) {
	bcache_invalidate(bc, blk + i);
    }
    return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, rsize));
}
static int write_strategy ( void * devdata , int rw , daddr_t blk , size_t offset , size_t size , char * buf , size_t * rsize ) { struct bcache_devdata * dd = ( struct bcache_devdata * ) devdata ; struct bcache * bc = dd -> dv_cache ; daddr_t i , nblk ; nblk = size / bcache_blksize ; for ( i = 0 ; i < nblk ; i ++ ) { bcache_invalidate ( bc , blk + i ) ; } return ( dd -> dv_strategy ( dd -> dv_devdata , rw , blk , offset , size , buf , rsize ) ) ; }
Handle a write request; write directly to the disk, and populate the
 cache with the new values.
Handle a write request ; write directly to the disk and populate the cache with the new values .
/* Invalidate the blocks being written */ /* Write the blocks */