mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-08 12:53:47 +00:00
dm: storage: remove GEOM support
There is no GEOM framework in Linux. Remove dead code. v1 -> v2: - complete removal of the entire GEOM logic Tracked-On: #1422 Signed-off-by: Peter Fang <peter.fang@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
parent
b4a7a1ea1a
commit
7101ce87a7
@ -98,7 +98,6 @@ struct blockif_ctxt {
|
|||||||
int magic;
|
int magic;
|
||||||
int fd;
|
int fd;
|
||||||
int isblk;
|
int isblk;
|
||||||
int isgeom;
|
|
||||||
int candelete;
|
int candelete;
|
||||||
int rdonly;
|
int rdonly;
|
||||||
off_t size;
|
off_t size;
|
||||||
@ -233,99 +232,38 @@ blockif_complete(struct blockif_ctxt *bc, struct blockif_elem *be)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be, uint8_t *buf)
|
blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be)
|
||||||
{
|
{
|
||||||
struct blockif_req *br;
|
struct blockif_req *br;
|
||||||
off_t arg[2];
|
off_t arg[2];
|
||||||
ssize_t clen, len, off, boff, voff;
|
ssize_t len;
|
||||||
int i, err;
|
int err;
|
||||||
|
|
||||||
br = be->req;
|
br = be->req;
|
||||||
if (br->iovcnt <= 1)
|
|
||||||
buf = NULL;
|
|
||||||
err = 0;
|
err = 0;
|
||||||
switch (be->op) {
|
switch (be->op) {
|
||||||
case BOP_READ:
|
case BOP_READ:
|
||||||
if (buf == NULL) {
|
len = preadv(bc->fd, br->iov, br->iovcnt,
|
||||||
len = preadv(bc->fd, br->iov, br->iovcnt,
|
br->offset + bc->sub_file_start_lba);
|
||||||
br->offset + bc->sub_file_start_lba);
|
if (len < 0)
|
||||||
if (len < 0)
|
err = errno;
|
||||||
err = errno;
|
else
|
||||||
else
|
|
||||||
br->resid -= len;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
off = voff = 0;
|
|
||||||
while (br->resid > 0) {
|
|
||||||
len = MIN(br->resid, MAXPHYS);
|
|
||||||
if (pread(bc->fd, buf, len, br->offset +
|
|
||||||
off + bc->sub_file_start_lba) < 0) {
|
|
||||||
err = errno;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
boff = 0;
|
|
||||||
do {
|
|
||||||
clen = MIN(len - boff, br->iov[i].iov_len -
|
|
||||||
voff);
|
|
||||||
memcpy(br->iov[i].iov_base + voff,
|
|
||||||
buf + boff, clen);
|
|
||||||
if (clen < br->iov[i].iov_len - voff)
|
|
||||||
voff += clen;
|
|
||||||
else {
|
|
||||||
i++;
|
|
||||||
voff = 0;
|
|
||||||
}
|
|
||||||
boff += clen;
|
|
||||||
} while (boff < len);
|
|
||||||
off += len;
|
|
||||||
br->resid -= len;
|
br->resid -= len;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case BOP_WRITE:
|
case BOP_WRITE:
|
||||||
if (bc->rdonly) {
|
if (bc->rdonly) {
|
||||||
err = EROFS;
|
err = EROFS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (buf == NULL) {
|
|
||||||
len = pwritev(bc->fd, br->iov, br->iovcnt,
|
|
||||||
br->offset + bc->sub_file_start_lba);
|
|
||||||
if (len < 0)
|
|
||||||
err = errno;
|
|
||||||
else {
|
|
||||||
br->resid -= len;
|
|
||||||
err = blockif_flush_cache(bc);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
off = voff = 0;
|
|
||||||
while (br->resid > 0) {
|
|
||||||
len = MIN(br->resid, MAXPHYS);
|
|
||||||
boff = 0;
|
|
||||||
do {
|
|
||||||
clen = MIN(len - boff, br->iov[i].iov_len -
|
|
||||||
voff);
|
|
||||||
memcpy(buf + boff,
|
|
||||||
br->iov[i].iov_base + voff, clen);
|
|
||||||
if (clen < br->iov[i].iov_len - voff)
|
|
||||||
voff += clen;
|
|
||||||
else {
|
|
||||||
i++;
|
|
||||||
voff = 0;
|
|
||||||
}
|
|
||||||
boff += clen;
|
|
||||||
} while (boff < len);
|
|
||||||
if (pwrite(bc->fd, buf, len, br->offset +
|
|
||||||
off + bc->sub_file_start_lba) < 0) {
|
|
||||||
err = errno;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
off += len;
|
|
||||||
br->resid -= len;
|
|
||||||
}
|
|
||||||
err = blockif_flush_cache(bc);
|
|
||||||
|
|
||||||
|
len = pwritev(bc->fd, br->iov, br->iovcnt,
|
||||||
|
br->offset + bc->sub_file_start_lba);
|
||||||
|
if (len < 0)
|
||||||
|
err = errno;
|
||||||
|
else {
|
||||||
|
br->resid -= len;
|
||||||
|
err = blockif_flush_cache(bc);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BOP_FLUSH:
|
case BOP_FLUSH:
|
||||||
if (fsync(bc->fd))
|
if (fsync(bc->fd))
|
||||||
@ -364,20 +302,16 @@ blockif_thr(void *arg)
|
|||||||
struct blockif_ctxt *bc;
|
struct blockif_ctxt *bc;
|
||||||
struct blockif_elem *be;
|
struct blockif_elem *be;
|
||||||
pthread_t t;
|
pthread_t t;
|
||||||
uint8_t *buf;
|
|
||||||
|
|
||||||
bc = arg;
|
bc = arg;
|
||||||
if (bc->isgeom)
|
|
||||||
buf = malloc(MAXPHYS);
|
|
||||||
else
|
|
||||||
buf = NULL;
|
|
||||||
t = pthread_self();
|
t = pthread_self();
|
||||||
|
|
||||||
pthread_mutex_lock(&bc->mtx);
|
pthread_mutex_lock(&bc->mtx);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (blockif_dequeue(bc, t, &be)) {
|
while (blockif_dequeue(bc, t, &be)) {
|
||||||
pthread_mutex_unlock(&bc->mtx);
|
pthread_mutex_unlock(&bc->mtx);
|
||||||
blockif_proc(bc, be, buf);
|
blockif_proc(bc, be);
|
||||||
pthread_mutex_lock(&bc->mtx);
|
pthread_mutex_lock(&bc->mtx);
|
||||||
blockif_complete(bc, be);
|
blockif_complete(bc, be);
|
||||||
}
|
}
|
||||||
@ -386,10 +320,8 @@ blockif_thr(void *arg)
|
|||||||
break;
|
break;
|
||||||
pthread_cond_wait(&bc->cond, &bc->mtx);
|
pthread_cond_wait(&bc->cond, &bc->mtx);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&bc->mtx);
|
|
||||||
|
|
||||||
if (buf)
|
pthread_mutex_unlock(&bc->mtx);
|
||||||
free(buf);
|
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -486,7 +418,7 @@ blockif_open(const char *optstr, const char *ident)
|
|||||||
/* struct diocgattr_arg arg; */
|
/* struct diocgattr_arg arg; */
|
||||||
off_t size, psectsz, psectoff;
|
off_t size, psectsz, psectoff;
|
||||||
int fd, i, sectsz;
|
int fd, i, sectsz;
|
||||||
int writeback, ro, candelete, geom, ssopt, pssopt;
|
int writeback, ro, candelete, ssopt, pssopt;
|
||||||
long sz;
|
long sz;
|
||||||
long long b;
|
long long b;
|
||||||
int err_code = -1;
|
int err_code = -1;
|
||||||
@ -565,7 +497,7 @@ blockif_open(const char *optstr, const char *ident)
|
|||||||
size = sbuf.st_size;
|
size = sbuf.st_size;
|
||||||
sectsz = DEV_BSIZE;
|
sectsz = DEV_BSIZE;
|
||||||
psectsz = psectoff = 0;
|
psectsz = psectoff = 0;
|
||||||
candelete = geom = 0;
|
candelete = 0;
|
||||||
|
|
||||||
if (S_ISBLK(sbuf.st_mode)) {
|
if (S_ISBLK(sbuf.st_mode)) {
|
||||||
/* get size */
|
/* get size */
|
||||||
@ -660,7 +592,6 @@ blockif_open(const char *optstr, const char *ident)
|
|||||||
bc->magic = BLOCKIF_SIG;
|
bc->magic = BLOCKIF_SIG;
|
||||||
bc->fd = fd;
|
bc->fd = fd;
|
||||||
bc->isblk = S_ISBLK(sbuf.st_mode);
|
bc->isblk = S_ISBLK(sbuf.st_mode);
|
||||||
bc->isgeom = geom;
|
|
||||||
bc->candelete = candelete;
|
bc->candelete = candelete;
|
||||||
bc->rdonly = ro;
|
bc->rdonly = ro;
|
||||||
bc->size = size;
|
bc->size = size;
|
||||||
|
Loading…
Reference in New Issue
Block a user