From a59695355f73fa15706626f0d05b7da344c2a413 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 17 Dec 1999 16:23:23 +0000 Subject: [PATCH] doc/obd-howto.sgml: completed OBD tutorial section snap/snap.c: in eliminate_obj() turn off S_IFDIR flag on object before passing to underlying obdext2 driver, so it doesn't decrement the dir count for the group Configure: removed questions for PCMCIA specific features class/obdcontrol: disconnect session when changing devices --- lustre/obdclass/obdcontrol | 39 +++++++++++++++++++++------- lustre/obdfs/namei.c | 2 -- lustre/obdfs/rw.c | 4 +-- lustre/patches/patch-2.2.10 | 26 +++++++++---------- lustre/patches/patch-2.3.21 | 62 ++++++++++++++++++++++----------------------- 5 files changed, 75 insertions(+), 58 deletions(-) diff --git a/lustre/obdclass/obdcontrol b/lustre/obdclass/obdcontrol index 6c5510e..69a863d 100755 --- a/lustre/obdclass/obdcontrol +++ b/lustre/obdclass/obdcontrol @@ -65,7 +65,6 @@ eval 'sub OBD_SNAP_SETTABLE () { &_IOC(3, ord(\'f\'), 40, 4);}' unless defined(&OBD_SNAP_SETTABLE); eval 'sub OBD_SNAP_PRINTTABLE () { &_IOC(3, ord(\'f\'), 41, 4);}' unless defined(&OBD_SNAP_PRINTTABLE); - eval 'sub OBD_SNAP_DELETE() { &_IOC(3, ord(\'f\'), 42, 4);}' unless defined(&OBD_SNAP_DELETE); eval 'sub OBD_SNAP_RESTORE() { &_IOC(3, ord(\'f\'), 43, 4);}' unless @@ -107,24 +106,22 @@ my %commands = 'create' => {func => "Create", doc => "create: creates a new inode"}, 'attach' => {func => "Attach", doc => "attach type [adapter bus tid lun]"}, 'detach' => {func => "Detach", doc => "detach this device"}, - 'snapattach' => {func => "SnapAttach", doc => "snapattach snapno table"}, + 'testext2iterator' => {func => "TestExt2Iterator", doc => ""}, + 'snapattach' => {func => "SnapAttach", doc => "snapattach snapdev snapidx tableno"}, 'snapset' => {func => "SnapSetTable", doc => "snapset tableno file" }, 'snapprint' => {func => "SnapPrint", doc => "snapprint tableno"}, - - 'testext2iterator' => {func => "TestExt2Iterator", doc => ""}, 'snapdelete' => {func => "SnapDelete", doc => "snapdelete: delete connected snap obd"}, 'snaprestore' => {func => "SnapRestore", doc => "snaprestore: restore connected old snap to current"}, - 'snaptable' => {func => "SnapShotTable", doc => "snaptable: build a snapshot table (interactive)"}, 'copy' => {func => "Copy", doc => "copy srcid tgtid"}, 'migrate' => {func => "Migrate", doc => "migrate srcid tgtid"}, 'format' => {func => "Format", doc => "format type adapter bus tid lun size"}, 'partition' => {func => "Partition", doc => "partition type adapter bus tid lun partition size"}, - 'setup' => {func => "Setup", doc => "setup: link the ext2 partition (default /dev/loop0) to this obddev"}, + 'setup' => {func => "Setup", doc => "setup [type]: link this OBD device to the underlying device (default type ext2_obd, filesystem /dev/loop0)"}, 'connect' => {func => "Connect", doc => "connect: allocates client ID for this session"}, 'disconnect' => {func => "Disconnect", doc => "disconnect [id]: frees client resources"}, 'sync' => {func => "Sync", doc => "sync: flushes buffers to disk"}, - 'destroy' => {func => "Destroy", doc => "setup: destroys an inode"}, + 'destroy' => {func => "Destroy", doc => "destroy : destroys an inode"}, 'cleanup' => {func => "Cleanup", doc => "cleanup the minor obd device"}, 'dec_use_count' => {func => "Decusecount", doc => "decreases the module use count so that the module can be removed following an oops"}, 'read' => {func => "Read", doc => "read [offset]"}, @@ -247,12 +244,17 @@ sub Filesystem { if (!defined($::st = stat($filesystem))) { die "Unable to stat $filesystem.\n"; } + print "Filesystem now $filesystem\n"; } # select the OBD device we talk to sub Device { my $device = shift; + if ($::client_id) { + print "Disconnecting active session ($::client_id)..."; + Disconnect($::client_id); + } if (! $device ) { $device = "/dev/obd0"; } @@ -308,6 +310,11 @@ sub Detach { sub TestExt2Iterator { + if (!defined($::client_id)) { + print "You must first ``connect''.\n"; + return; + } + my $err = 0; my $type = "ext2_obd"; @@ -333,6 +340,11 @@ sub TestExt2Iterator { sub SnapDelete { + if (!defined($::client_id)) { + print "You must first ``connect''.\n"; + return; + } + my $err = 0; my $type = "snap_obd"; @@ -357,7 +369,16 @@ sub SnapDelete { } +# FIXME the parameter to snaprestore SHOULD be the snapshot number of the +# snapshot to be restored, and this routine should handle all of the +# removal of intervening snapshots and changing the snaptable to have +# the "restored" snapshot as current and move the previous current. sub SnapRestore { + if (!defined($::client_id)) { + print "You must first ``connect''.\n"; + return; + } + my $err = 0; my $type = "snap_obd"; my $prevcurrent = shift; @@ -461,13 +482,13 @@ sub SnapAttach { my $err = 0; my $type = "snap_obd"; my $snapdev = shift; - my $snapno = shift; + my $snapidx = shift; my $tableno = shift; my $snapcount; my $data; my $datalen = 0; - $data = pack("iii", $snapdev, $snapno, $tableno); + $data = pack("iii", $snapdev, $snapidx, $tableno); $datalen = 3 * 4; my $len = length($type); diff --git a/lustre/obdfs/namei.c b/lustre/obdfs/namei.c index 4c074a4b..a0a66c5 100644 --- a/lustre/obdfs/namei.c +++ b/lustre/obdfs/namei.c @@ -884,14 +884,12 @@ int obdfs_symlink (struct inode * dir, struct dentry *dentry, const char * symna while (i < inode->i_sb->s_blocksize - 1 && (c = *(symname++))) link[i++] = c; link[i] = 0; - /* if (name_page) { */ iops(inode)->o_brw(WRITE, iid(inode), inode, name_page, 1); PDEBUG(name_page, "symlink"); UnlockPage(name_page); page_cache_release(name_page); /* } */ - inode->i_size = i; mark_inode_dirty(inode); diff --git a/lustre/obdfs/rw.c b/lustre/obdfs/rw.c index 9c69f05..cb302ce 100644 --- a/lustre/obdfs/rw.c +++ b/lustre/obdfs/rw.c @@ -174,9 +174,7 @@ struct page *obdfs_getpage(struct inode *inode, unsigned long offset, int create if (! page) { printk("get_page_map says no dice ...\n"); return 0; - } - - + } rc = iops(inode)->o_brw(READ, iid(inode), inode, page, create); if ( rc != PAGE_SIZE ) { diff --git a/lustre/patches/patch-2.2.10 b/lustre/patches/patch-2.2.10 index d4b9492..62cd23c 100644 --- a/lustre/patches/patch-2.2.10 +++ b/lustre/patches/patch-2.2.10 @@ -30,22 +30,22 @@ { struct super_block *s; ---- linux-2.2.10/kernel/ksyms.c Tue Aug 3 15:11:56 1999 -+++ linux-2.2.10/kernel/ksyms.c.org Tue Aug 3 15:10:55 1999 -@@ -78,16 +78,6 @@ +--- linux-2.2.10/kernel/ksyms.c.org Tue Aug 3 15:10:55 1999 ++++ linux-2.2.10/kernel/ksyms.c Tue Aug 3 15:11:56 1999 +@@ -78,6 +78,16 @@ #endif EXPORT_SYMBOL(get_options); --/* obd stuff */ -- -- -- --EXPORT_SYMBOL(get_empty_super); --EXPORT_SYMBOL(remove_vfsmnt); -- -- -- -- ++/* obd stuff */ ++ ++ ++ ++EXPORT_SYMBOL(get_empty_super); ++EXPORT_SYMBOL(remove_vfsmnt); ++ ++ ++ ++ /* process memory management */ EXPORT_SYMBOL(do_mmap); EXPORT_SYMBOL(do_munmap); diff --git a/lustre/patches/patch-2.3.21 b/lustre/patches/patch-2.3.21 index b0c4712..2914b2d 100644 --- a/lustre/patches/patch-2.3.21 +++ b/lustre/patches/patch-2.3.21 @@ -1,3 +1,34 @@ +--- linux/include/linux/fs.h.org Tue Oct 12 10:39:59 1999 ++++ linux/include/linux/fs.h Tue Oct 12 11:32:46 1999 +@@ -934,6 +934,8 @@ + + + extern struct super_block *get_super(kdev_t); ++struct super_block *get_empty_super(void); ++void remove_vfsmnt(kdev_t dev); + extern void put_super(kdev_t); + unsigned long generate_cluster(kdev_t, int b[], int); + unsigned long generate_cluster_swab32(kdev_t, int b[], int); +--- linux/fs/super.c.org Tue Oct 12 10:39:05 1999 ++++ linux/fs/super.c Tue Oct 12 11:18:14 1999 +@@ -135,7 +135,7 @@ + return lptr; + } + +-static void remove_vfsmnt(kdev_t dev) ++void remove_vfsmnt(kdev_t dev) + { + struct vfsmount *lptr, *tofree; + +@@ -508,7 +508,7 @@ + /* + * Find a super_block with no device assigned. + */ +-static struct super_block *get_empty_super(void) ++struct super_block *get_empty_super(void) + { + struct super_block *s; + --- linux/kernel/ksyms.c.or Tue Oct 12 10:40:21 1999 +++ linux/kernel/ksyms.c Tue Oct 12 11:22:45 1999 @@ -36,6 +36,7 @@ @@ -27,34 +58,3 @@ EXPORT_SYMBOL(get_empty_filp); EXPORT_SYMBOL(init_private_file); EXPORT_SYMBOL(filp_open); ---- linux/fs/super.c.or Tue Oct 12 10:39:05 1999 -+++ linux/fs/super.c Tue Oct 12 11:18:14 1999 -@@ -135,7 +135,7 @@ - return lptr; - } - --static void remove_vfsmnt(kdev_t dev) -+void remove_vfsmnt(kdev_t dev) - { - struct vfsmount *lptr, *tofree; - -@@ -508,7 +508,7 @@ - /* - * Find a super_block with no device assigned. - */ --static struct super_block *get_empty_super(void) -+struct super_block *get_empty_super(void) - { - struct super_block *s; - ---- linux/include/linux/fs.h.or Tue Oct 12 10:39:59 1999 -+++ linux/include/linux/fs.h Tue Oct 12 11:32:46 1999 -@@ -934,6 +934,8 @@ - - - extern struct super_block *get_super(kdev_t); -+struct super_block *get_empty_super(void); -+void remove_vfsmnt(kdev_t dev); - extern void put_super(kdev_t); - unsigned long generate_cluster(kdev_t, int b[], int); - unsigned long generate_cluster_swab32(kdev_t, int b[], int); -- 1.8.3.1