From 6291ca59e9c23d2ea00ea8a6c387fe764743737c Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 12 Nov 2002 18:50:09 +0000 Subject: [PATCH] Widesweeping change to support different-sized LOV MD data (b=307,345, and partially 314). The goal is to remove all knowledge of MD data from llite and the MDS, and keep it solely inside OSC and LOV. The change is not entirely complete (for enh 314) in that we still pass "struct lov_stripe_md" and "struct lov_mds_md" structs around, but that was mostly for sanity to avoid getting the two screwed up during this large amount of change. OSC passes runtests, and LOV has a _huge_ bug in it that dies after a single file copy+cleanup, so that's why it's on a branch. This adds two new OBD API methods (I'm not totally stuck on the names yet): - o_packmd to alloc/pack/free data for wire transport and storage on disk - o_unpackmd to alloc/pack/free data for in-memory and storage on disk There are helper functions obd_{alloc,size,free}_{mem,wire}md() which call the above two OBD API methods with the correct parameters to just allocate or size or free an MD. This totally isolates anything outside LOV/OSC from knowing anything of the internals of the MD data struct, and lays the groundwork for LOV stacking in the future. The user-space LOV striping setup has also changed slightly to use the "MDS/wire/disk" MD format for communication instead of the in-memory MD format, and the lovstripe.c test, utils/lfind.c and new utils/lstripe.c program (formerly makestripe.c from Kevin Harlan) have been updated to use this new interface. The lstripe.c utility allows easy creation of files with a specific striping pattern. --- lustre/tests/lovstripe.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lustre/tests/lovstripe.c b/lustre/tests/lovstripe.c index 14aa2cf..29769f1 100644 --- a/lustre/tests/lovstripe.c +++ b/lustre/tests/lovstripe.c @@ -9,10 +9,11 @@ /****************** Custom includes ********************/ #include +#include /****************** Functions ******************/ -int write_file(char *name, struct lov_user_md *striping, int bufsize, +int write_file(char *name, struct lov_mds_md *striping, int bufsize, char *buf1, char *buf2); @@ -22,7 +23,7 @@ int write_file(char *name, struct lov_user_md *striping, int bufsize, int main(int argc, char *argv[]) { - struct lov_user_md a_striping; + struct lov_mds_md a_striping; long bufsize = sizeof(long) * STRIPE_SIZE; char *rbuf, *wbuf; int data, *dp; @@ -40,13 +41,14 @@ int main(int argc, char *argv[]) *dp = data; /* Init defaults on striping info */ - a_striping.lum_stripe_size = STRIPE_SIZE; - a_striping.lum_stripe_pattern = 0; + a_striping.lmm_magic = LOV_MAGIC; + a_striping.lmm_stripe_size = STRIPE_SIZE; + a_striping.lmm_stripe_pattern = 0; /* Write file for OST1 only */ /* Start at OST 0, and use only 1 OST */ - a_striping.lum_stripe_offset = 0; - a_striping.lum_stripe_count = 1; + a_striping.lmm_stripe_offset = 0; + a_striping.lmm_stripe_count = 1; result = write_file("/mnt/lustre/ost1", &a_striping, bufsize, wbuf, rbuf); @@ -56,8 +58,8 @@ int main(int argc, char *argv[]) /* Write file for OST2 only */ /* Start at OST 1, and use only 1 OST */ - a_striping.lum_stripe_offset = 1; - a_striping.lum_stripe_count = 1; + a_striping.lmm_stripe_offset = 1; + a_striping.lmm_stripe_count = 1; result = write_file("/mnt/lustre/ost2", &a_striping, bufsize, wbuf, rbuf); @@ -67,8 +69,8 @@ int main(int argc, char *argv[]) /* Write file across both OST1 and OST2 */ /* Start at OST 0, and use only 2 OSTs */ - a_striping.lum_stripe_offset = 0; - a_striping.lum_stripe_count = 2; + a_striping.lmm_stripe_offset = 0; + a_striping.lmm_stripe_count = 2; result = write_file("/mnt/lustre/ost1and2", &a_striping, bufsize, wbuf, rbuf); @@ -83,7 +85,7 @@ out: } -int write_file(char *name, struct lov_user_md *striping, int bufsize, +int write_file(char *name, struct lov_mds_md *striping, int bufsize, char *wbuf, char *rbuf) { int fd, result; -- 1.8.3.1