[prev in list] [next in list] [prev in thread] [next in thread] 

List:       intermezzo-cvs
Subject:    CVS: intermezzo/presto24 file.c,1.11,1.12 journal.c,1.20,1.21 journal_ext2.c,1.6,1.7 journal_ext3.c,
From:       Phil Schwan <pschwan () users ! sourceforge ! net>
Date:       2001-09-20 15:43:22
[Download RAW message or body]

Update of /cvsroot/intermezzo/intermezzo/presto24
In directory usw-pr-cvs1:/tmp/cvs-serv17996

Modified Files:
	file.c journal.c journal_ext2.c journal_ext3.c 
	journal_reiserfs.c journal_xfs.c presto.c upcall.c vfs.c 
Log Message:
Summary:
Changes related to data-on-demand.  Adds a flag to the fileset to indicate
whether DOD is enabled; if so, when opening a sparse file, trigger an
open_file upcall.

file.c:
- presto_open_upcall: added fset_name to the upcall arguments
- presto_file_open: trigger the upcall for sparse files when in DOD mode

journal_ext2.c:
- added a stub for presto_e2_has_all_data; this function can probably be
exactly the same as presto_e3_has_all_data

journal_ext3.c:
- added presto_e3_has_all_data, which takes into account indirect blocks

journal_reiserfs.c:
journal_xfs.c:
- added has_all_data stubs

presto.c:
- removed broken presto_has_all_data

upcall.c:
- lento_open: added fsetname,fsetnamelen to the list of upcall arguments

intermezzo_fs.h:
- added tr_all_data to journal_ops
- removed presto_has_all_data prototype
- added FSET_DATA_ON_DEMAND flag

intermezzo_upcall.h:
- fixed up structures for aforementioned upcall argument changes


Index: file.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/file.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -U2 -r1.11 -r1.12
--- file.c	2001/09/07 23:21:03	1.11
+++ file.c	2001/09/20 15:43:20	1.12
@@ -53,10 +53,9 @@
                        struct presto_file_set **);
 
-
-#if 0
 static int presto_open_upcall(int minor, struct dentry *de)
 {
         int rc;
         char *path, *buffer;
+        struct presto_file_set *fset;
         int pathlen;
 
@@ -66,12 +65,12 @@
                 return ENOMEM;
         }
-        path = presto_path(de, buffer, PAGE_SIZE);
+        fset = presto_fset(de);
+        path = presto_path(de, fset->fset_mtpt, buffer, PAGE_SIZE);
         pathlen = MYPATHLEN(buffer, path);
-        rc = lento_open(minor, pathlen, path);
+        rc = lento_open(minor, pathlen, strlen(fset->fset_name),
+                        path, fset->fset_name);
         PRESTO_FREE(buffer, PAGE_SIZE);
         return rc;
 }
-#endif
-
 
 static int presto_file_open(struct inode *inode, struct file *file)
@@ -80,4 +79,5 @@
         struct file_operations *fops;
         struct presto_cache *cache;
+        struct presto_file_set *fset;
         struct presto_file_data *fdata;
         int writable = (file->f_flags & (O_RDWR | O_WRONLY));
@@ -87,7 +87,5 @@
         ENTRY;
 
-        cache = presto_get_cache(inode);
-        if ( !cache ) {
-                printk("PRESTO: BAD, BAD: cannot find cache\n");
+        if (presto_prep(file->f_dentry, &cache, &fset) < 0) {
                 EXIT;
                 return -EBADF;
@@ -114,12 +112,11 @@
         /* XXX name space synchronization here for data/streaming on demand?*/
         /* XXX Lento can make us wait here for backfetches to complete */
-#if 0
-        if ( !presto_chk(file->f_dentry, PRESTO_DATA) ||
-             !presto_has_all_data(file->f_dentry->d_inode) ) {
+        if ( fset->fset_flags & FSET_DATA_ON_DEMAND &&
+             (!presto_chk(file->f_dentry, PRESTO_DATA) ||
+              !cache->cache_filter->o_trops->tr_all_data(file->f_dentry->d_inode)) ) {
                 CDEBUG(D_CACHE, "presto_file_open: presto_open_upcall\n");
                 rc = presto_open_upcall(minor, file->f_dentry);
         }
 
-#endif
         rc = 0;
  cache:
@@ -161,4 +158,5 @@
         }
 
+	EXIT;
         return 0;
 }

Index: journal.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/journal.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -U2 -r1.20 -r1.21
--- journal.c	2001/09/11 18:25:54	1.20
+++ journal.c	2001/09/20 15:43:20	1.21
@@ -478,4 +478,10 @@
                 EXIT;
                 return 0; 
+#if 0
+        } else if ( kml_recno < fset->fset_lento_recno + 100) {
+                write_unlock(&fd->fd_lock);
+                EXIT;
+                return 0;
+#endif
         }
         CDEBUG(D_PIOCTL, "fset: %s\n", fset->fset_name);

Index: journal_ext2.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/journal_ext2.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -U2 -r1.6 -r1.7
--- journal_ext2.c	2001/08/08 00:27:25	1.6
+++ journal_ext2.c	2001/09/20 15:43:20	1.7
@@ -58,8 +58,15 @@
 static void presto_e2_trans_commit(struct presto_file_set *fset, void *handle)
 {
-  do {} while (0);
+        do {} while (0);
 }
 
+static int presto_e2_has_all_data(struct inode *inode)
+{
+        BUG();
+        return 0;
+}
+
 struct journal_ops presto_ext2_journal_ops = {
+        tr_all_data: presto_e2_has_all_data,
         tr_avail: presto_e2_freespace,
         tr_start: presto_e2_trans_start,

Index: journal_ext3.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/journal_ext3.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -U2 -r1.6 -r1.7
--- journal_ext3.c	2001/08/08 00:27:25	1.6
+++ journal_ext3.c	2001/09/20 15:43:20	1.7
@@ -176,5 +176,5 @@
 }
 
-void presto_e3_trans_commit(struct presto_file_set *fset, void *handle)
+static void presto_e3_trans_commit(struct presto_file_set *fset, void *handle)
 {
         if ( presto_no_journal(fset) || !handle)
@@ -187,5 +187,5 @@
 }
 
-void presto_e3_journal_file_data(struct inode *inode)
+static void presto_e3_journal_file_data(struct inode *inode)
 {
 #ifdef EXT3_JOURNAL_DATA_FL
@@ -196,5 +196,50 @@
 }
 
+/* The logic here is a slightly modified version of ext3/inode.c:block_to_path
+ */
+static int presto_e3_has_all_data(struct inode *inode)
+{
+        int ptrs = EXT3_ADDR_PER_BLOCK(inode->i_sb);
+        int ptrs_bits = EXT3_ADDR_PER_BLOCK_BITS(inode->i_sb);
+        const long direct_blocks = EXT3_NDIR_BLOCKS,
+                indirect_blocks = ptrs,
+                double_blocks = (1 << (ptrs_bits * 2));
+        long block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
+                inode->i_sb->s_blocksize_bits;
+
+        ENTRY;
+
+        if (inode->i_size == 0) {
+                EXIT;
+                return 1;
+        }
+
+        if (block < direct_blocks) {
+                /* No indirect blocks, no problem. */
+        } else if (block < indirect_blocks + direct_blocks) {
+                block++;
+        } else if (block < double_blocks + indirect_blocks + direct_blocks) {
+                block += 2;
+        } else if (((block - double_blocks - indirect_blocks - direct_blocks)
+                    >> (ptrs_bits * 2)) < ptrs) {
+                block += 3;
+        }
+
+        block *= (inode->i_sb->s_blocksize / 512);
+
+        CDEBUG(D_CACHE, "Need %ld blocks, have %ld.\n",
+               block, inode->i_blocks);
+
+        if (block > inode->i_blocks) {
+                EXIT;
+                return 0;
+        }
+
+        EXIT;
+        return 1;
+}
+
 struct journal_ops presto_ext3_journal_ops = {
+        tr_all_data: presto_e3_has_all_data,
         tr_avail: presto_e3_freespace,
         tr_start:  presto_e3_trans_start,

Index: journal_reiserfs.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/journal_reiserfs.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -U2 -r1.9 -r1.10
--- journal_reiserfs.c	2001/09/13 20:05:00	1.9
+++ journal_reiserfs.c	2001/09/20 15:43:20	1.10
@@ -89,5 +89,6 @@
 }
 
-void presto_reiserfs_trans_commit(struct presto_file_set *fset, void *handle)
+static void presto_reiserfs_trans_commit(struct presto_file_set *fset,
+                                         void *handle)
 {
 	int jblocks;
@@ -100,5 +101,5 @@
 }
 
-void presto_reiserfs_journal_file_data(struct inode *inode)
+static void presto_reiserfs_journal_file_data(struct inode *inode)
 {
 #ifdef EXT3_JOURNAL_DATA_FL
@@ -109,5 +110,12 @@
 }
 
+static int presto_reiserfs_has_all_data(struct inode *inode)
+{
+        BUG();
+        return 0;
+}
+
 struct journal_ops presto_reiserfs_journal_ops = {
+        tr_all_data: presto_reiserfs_has_all_data,
         tr_avail: presto_reiserfs_freespace,
         tr_start:  presto_reiserfs_trans_start,

Index: journal_xfs.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/journal_xfs.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -U2 -r1.5 -r1.6
--- journal_xfs.c	2001/08/08 00:27:25	1.5
+++ journal_xfs.c	2001/09/20 15:43:20	1.6
@@ -121,10 +121,17 @@
 }
 
-void presto_xfs_journal_file_data(struct inode *inode)
+static void presto_xfs_journal_file_data(struct inode *inode)
 {
         return; 
 }
 
+static int presto_xfs_has_all_data(struct inode *inode)
+{
+        BUG();
+        return 0;
+}
+
 struct journal_ops presto_xfs_journal_ops = {
+        tr_all_data: presto_xfs_has_all_data,
         tr_avail: presto_xfs_freespace,
         tr_start:  presto_xfs_trans_start,

Index: presto.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/presto.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -U2 -r1.6 -r1.7
--- presto.c	2001/09/17 19:59:08	1.6
+++ presto.c	2001/09/20 15:43:20	1.7
@@ -94,18 +94,4 @@
 }
 
-int presto_has_all_data(struct inode *inode)
-{
-        ENTRY;
-
-        if ( (inode->i_size >> inode->i_sb->s_blocksize_bits) >
-             inode->i_blocks) {
-                EXIT;
-                return 0;
-        }
-        EXIT;
-        return 1;
-
-}
-
 /* find the fileset dentry for this dentry */
 struct presto_file_set *presto_fset(struct dentry *de)

Index: upcall.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/upcall.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -U2 -r1.6 -r1.7
--- upcall.c	2001/08/08 00:27:25	1.6
+++ upcall.c	2001/09/20 15:43:20	1.7
@@ -175,5 +175,6 @@
 }
 
-int lento_open(int minor, int pathlen, char *path)
+int lento_open(int minor, int pathlen, int fsetnamelen,
+               char *path, char *fsetname)
 {
         union up_args *inp;
@@ -182,9 +183,14 @@
 
 	ENTRY;
-	insize = SIZE(open) + pathlen + 1;
-	UPARG(LENTO_OPEN);
-	inp->lento_open.pathlen = pathlen;
-	memcpy(inp->lento_open.path, path, pathlen);
-	inp->lento_open.path[pathlen] = '\0';
+        insize = SIZE(open) + pathlen + 1 + fsetnamelen + 1;
+        UPARG(LENTO_OPEN);
+        inp->lento_open.pathlen = pathlen;
+        inp->lento_open.fsetnamelen = fsetnamelen;
+
+        memcpy(inp->lento_open.path, path, pathlen);
+        inp->lento_open.path[pathlen] = '\0';
+
+	memcpy(&(inp->lento_open.path[pathlen+1]), fsetname, fsetnamelen); 
+        inp->lento_open.path[fsetnamelen + 1 + pathlen] = '\0';
 
 	CDEBUG(D_UPCALL, "path %s\n", inp->lento_open.path);

Index: vfs.c
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/presto24/vfs.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -U2 -r1.32 -r1.33
--- vfs.c	2001/09/11 18:25:54	1.32
+++ vfs.c	2001/09/20 15:43:20	1.33
@@ -221,5 +221,5 @@
         struct presto_version old_ver, new_ver;
         void *handle;
-	off_t old_size=inode->i_size;
+	loff_t old_size=inode->i_size;
 
         ENTRY;


_______________________________________________
intermezzo-commit mailing list
intermezzo-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/intermezzo-commit

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic