Mercurial > nomad > experimental
changeset 624:6cc439510275
objstore: return vol uuid list on vdev import
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 19 Jan 2019 21:36:44 -0500 |
parents | a7132fb142ae |
children | e4a5e1ee05c0 |
files | src/objstore/include/nomad/objstore_backend.h src/objstore/posix/main.c src/objstore/vdev.c |
diffstat | 3 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/include/nomad/objstore_backend.h Sun Dec 02 10:40:03 2018 -0500 +++ b/src/objstore/include/nomad/objstore_backend.h Sat Jan 19 21:36:44 2019 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2015-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -160,7 +160,8 @@ int (*create_vdev)(struct objstore_vdev *vdev); int (*create_vol)(struct objstore *vol); - int (*import_vdev)(struct objstore_vdev *vdev); + int (*import_vdev)(struct objstore_vdev *vdev, + struct xuuid **vols); }; extern struct objver *obj_add_version(struct obj *obj,
--- a/src/objstore/posix/main.c Sun Dec 02 10:40:03 2018 -0500 +++ b/src/objstore/posix/main.c Sat Jan 19 21:36:44 2019 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2018-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -379,7 +379,8 @@ return ret; } -static int posix_import_vdev(struct objstore_vdev *vdev) +static int posix_import_vdev(struct objstore_vdev *vdev, + struct xuuid **vols) { struct posix_vdev *pvdev; int ret;
--- a/src/objstore/vdev.c Sun Dec 02 10:40:03 2018 -0500 +++ b/src/objstore/vdev.c Sat Jan 19 21:36:44 2019 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2015-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -118,18 +118,21 @@ { struct objstore_vdev *vdev; struct objstore_vdev *prev; + struct xuuid *vols; int ret; vdev = vdev_alloc(type, path); if (IS_ERR(vdev)) return vdev; + vols = NULL; + if (create) { xuuid_generate(&vdev->uuid); ret = vdev->def->create_vdev(vdev); } else { xuuid_clear(&vdev->uuid); - ret = vdev->def->import_vdev(vdev); + ret = vdev->def->import_vdev(vdev, &vols); } if (ret) @@ -144,11 +147,15 @@ vdev_putref(vdev); /* the ref we tried to put in the tree */ vdev_putref(vdev); /* the original ref */ + free(vols); + return ERR_PTR(-EEXIST); } /* TODO: load all vols */ + free(vols); + MXLOCK(&vdev->lock); vdev->state = VDEV_ONLINE; MXUNLOCK(&vdev->lock);