Add multi device strip support written by Guillermo Amaral and reviewed by me.
This commit is contained in:
parent
fb8751aba4
commit
58b6472739
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dm.h,v 1.17 2009/12/29 23:37:48 haad Exp $ */
|
||||
/* $NetBSD: dm.h,v 1.18 2010/05/18 15:10:41 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,9 @@
|
|||
#include <sys/errno.h>
|
||||
|
||||
#include <sys/atomic.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/rwlock.h>
|
||||
#include <sys/queue.h>
|
||||
|
@ -226,6 +228,7 @@ typedef struct dm_target {
|
|||
*/
|
||||
char * (*status)(void *);
|
||||
int (*strategy)(dm_table_entry_t *, struct buf *);
|
||||
int (*sync)(dm_table_entry_t *);
|
||||
int (*upcall)(dm_table_entry_t *, struct buf *);
|
||||
|
||||
uint32_t version[3];
|
||||
|
@ -284,26 +287,11 @@ int dm_target_init(void);
|
|||
|
||||
#define DM_MAX_PARAMS_SIZE 1024
|
||||
|
||||
/* dm_target_zero.c */
|
||||
int dm_target_zero_init(dm_dev_t *, void**, char *);
|
||||
char * dm_target_zero_status(void *);
|
||||
int dm_target_zero_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_zero_destroy(dm_table_entry_t *);
|
||||
int dm_target_zero_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_zero_upcall(dm_table_entry_t *, struct buf *);
|
||||
|
||||
/* dm_target_error.c */
|
||||
int dm_target_error_init(dm_dev_t *, void**, char *);
|
||||
char * dm_target_error_status(void *);
|
||||
int dm_target_error_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_error_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_error_destroy(dm_table_entry_t *);
|
||||
int dm_target_error_upcall(dm_table_entry_t *, struct buf *);
|
||||
|
||||
/* dm_target_linear.c */
|
||||
int dm_target_linear_init(dm_dev_t *, void**, char *);
|
||||
char * dm_target_linear_status(void *);
|
||||
int dm_target_linear_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_linear_sync(dm_table_entry_t *);
|
||||
int dm_target_linear_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_linear_destroy(dm_table_entry_t *);
|
||||
int dm_target_linear_upcall(dm_table_entry_t *, struct buf *);
|
||||
|
@ -311,38 +299,15 @@ int dm_target_linear_upcall(dm_table_entry_t *, struct buf *);
|
|||
/* Generic function used to convert char to string */
|
||||
uint64_t atoi(const char *);
|
||||
|
||||
/* dm_target_mirror.c */
|
||||
int dm_target_mirror_init(dm_dev_t *, void**, char *);
|
||||
char * dm_target_mirror_status(void *);
|
||||
int dm_target_mirror_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_mirror_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_mirror_destroy(dm_table_entry_t *);
|
||||
int dm_target_mirror_upcall(dm_table_entry_t *, struct buf *);
|
||||
|
||||
/* dm_target_stripe.c */
|
||||
int dm_target_stripe_init(dm_dev_t *, void**, char *);
|
||||
char * dm_target_stripe_status(void *);
|
||||
int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_stripe_sync(dm_table_entry_t *);
|
||||
int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_stripe_destroy(dm_table_entry_t *);
|
||||
int dm_target_stripe_upcall(dm_table_entry_t *, struct buf *);
|
||||
|
||||
/* dm_target_snapshot.c */
|
||||
int dm_target_snapshot_init(dm_dev_t *, void**, char *);
|
||||
char * dm_target_snapshot_status(void *);
|
||||
int dm_target_snapshot_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_snapshot_destroy(dm_table_entry_t *);
|
||||
int dm_target_snapshot_upcall(dm_table_entry_t *, struct buf *);
|
||||
|
||||
/* dm snapshot origin driver */
|
||||
int dm_target_snapshot_orig_init(dm_dev_t *, void**, char *);
|
||||
char * dm_target_snapshot_orig_status(void *);
|
||||
int dm_target_snapshot_orig_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_snapshot_orig_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_snapshot_orig_destroy(dm_table_entry_t *);
|
||||
int dm_target_snapshot_orig_upcall(dm_table_entry_t *, struct buf *);
|
||||
|
||||
/* dm_table.c */
|
||||
#define DM_TABLE_ACTIVE 0
|
||||
#define DM_TABLE_INACTIVE 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*$NetBSD: dm_target_stripe.c,v 1.9 2010/01/04 00:14:41 haad Exp $*/
|
||||
/*$NetBSD: dm_target_stripe.c,v 1.10 2010/05/18 15:10:41 haad Exp $*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -76,6 +76,7 @@ dm_target_stripe_modcmd(modcmd_t cmd, void *arg)
|
|||
dmt->init = &dm_target_stripe_init;
|
||||
dmt->status = &dm_target_stripe_status;
|
||||
dmt->strategy = &dm_target_stripe_strategy;
|
||||
dmt->sync = &dm_target_stripe_sync;
|
||||
dmt->deps = &dm_target_stripe_deps;
|
||||
dmt->destroy = &dm_target_stripe_destroy;
|
||||
dmt->upcall = &dm_target_stripe_upcall;
|
||||
|
@ -237,7 +238,28 @@ dm_target_stripe_strategy(dm_table_entry_t * table_en, struct buf * bp)
|
|||
|
||||
return 0;
|
||||
}
|
||||
/* Doesn't do anything here. */
|
||||
/* Sync underlying disk caches. */
|
||||
int
|
||||
dm_target_stripe_sync(dm_table_entry_t * table_en)
|
||||
{
|
||||
int cmd, err, i;
|
||||
dm_target_stripe_config_t *tsc;
|
||||
|
||||
tsc = table_en->target_config;
|
||||
|
||||
err = 0;
|
||||
cmd = 1;
|
||||
|
||||
for (i = 0; i < tsc->stripe_num; i++) {
|
||||
if ((err = VOP_IOCTL(tsc->stripe_devs[i].pdev->pdev_vnode, DIOCCACHESYNC,
|
||||
&cmd, FREAD|FWRITE, kauth_cred_get())) != 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
}
|
||||
/* Destroy target specific data. */
|
||||
int
|
||||
dm_target_stripe_destroy(dm_table_entry_t * table_en)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue