Re: [osd-dev] [PATCH] open-osd: osdblk User Mode utility

From: Boaz Harrosh
Date: Mon Jun 22 2009 - 08:15:51 EST


On 06/18/2009 03:55 PM, Boaz Harrosh wrote:
> A minimal user-mode application to Create / Remove / Resize
> OSD objects from a device, for use with the osdblk.ko block
> device driver.
>
> See inside patch for Usage instructions.
>
> Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
> ---

This version had a bug which, if the partition did not exist
it would fail to create the object.

I have squashed the below patch into this one, on the open-osd
git tree

---
Subject: [PATCH] {SQUASHME} open-osd: usr/osdblk: Need to also create the partition

A fall out of the usr/osdblk application

Boaz
---
usr/osdblk.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/usr/osdblk.c b/usr/osdblk.c
index f7df257..b9982c0 100644
--- a/usr/osdblk.c
+++ b/usr/osdblk.c
@@ -74,7 +74,7 @@ static void usage(void)
" pid_no is the partition 64bit number of the object in question\n"
" Both 0xabc hex or decimal anotation can be used\n"
"\n"
- "--obj=obj_no | -o obj_no\n"
+ "--oid=obj_no | -o obj_no\n"
" obj_no is the object 64bit number of the object in question\n"
" Both 0xabc hex or decimal anotation can be used\n"
"\n"
@@ -198,6 +198,19 @@ static int do_create(struct osd_dev *od, struct osd_obj_id *obj, u64 size)
return -ENOMEM;

osdblk_make_credential(creds, obj, osd_req_is_ver1(or));
+
+ /* Create partition OK to fail (all ready exist) */
+ osd_req_create_partition(or, obj->partition);
+ ret = osdblk_exec(or, creds);
+ osd_end_request(or);
+
+ if (ret)
+ OSDBLK_INFO("pid=0x%llx exists\n", _LLU(obj->partition));
+
+ or = osd_start_request(od, GFP_KERNEL);
+ if (unlikely(!or))
+ return -ENOMEM;
+
osd_req_create_object(or, obj);
ret = osdblk_exec(or, creds);
osd_end_request(or);
@@ -280,7 +293,7 @@ int main(int argc, char *argv[])
{.name = "resize", .has_arg = 0, .flag = NULL, .val = 's'} ,
{.name = "pid", .has_arg = 1, .flag = NULL, .val = 'p'} ,
{.name = "oid", .has_arg = 1, .flag = NULL, .val = 'o'} ,
- {.name = "size", .has_arg = 1, .flag = NULL, .val = 'l'} ,
+ {.name = "length", .has_arg = 1, .flag = NULL, .val = 'l'} ,

{.name = 0, .has_arg = 0, .flag = 0, .val = 0} ,
};
--
1.6.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/