Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jul 2009 19:21:31 GMT
From:      Aditya Sarawgi <truncs@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 165574 for review
Message-ID:  <200907031921.n63JLVY1028825@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=165574

Change 165574 by truncs@aditya on 2009/07/03 19:20:53

	Introducing ext2_hashalloc and ext2_alloccg to find a new block. Currently preallocation is not implemented and preallocation.

Affected files ...

.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#25 edit

Differences ...

==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#25 (text+ko) ====

@@ -107,7 +107,7 @@
 {
 	struct m_ext2fs *fs;
 	int32_t bno;
-	
+	int cg;	
 	*bnp = 0;
 	fs = ip->i_e2fs;
 #ifdef DIAGNOSTIC
@@ -126,7 +126,21 @@
 		goto nospace;
 	if (bpref >= fs->e2fs->e2fs_bcount)
 		bpref = 0;
-	/* call the Linux code */
+	 if (bpref == 0)
+                cg = ino_to_cg(fs, ip->i_number);
+        else
+                cg = dtog(fs, bpref);
+        bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize,
+                                                 ext2_alloccg);
+        if (bno > 0) {
+                ip->i_blocks += btodb(fs->e2fs_bsize);
+                ip->i_flag |= IN_CHANGE | IN_UPDATE;
+                *bnp = bno;
+                return (0);
+        }
+
+
+#ifdef notused
 #ifdef EXT2_PREALLOCATE
 	/* To have a preallocation hit, we must
 	 * - have at least one block preallocated
@@ -171,6 +185,7 @@
 		*bnp = bno;
 		return (0);
 	}
+#endif
 nospace:
 	ext2_fserr(fs, cred->cr_uid, "file system full");
 	uprintf("\n%s: write failed, file system is full\n", fs->e2fs_fsmnt);
@@ -727,7 +742,6 @@
 
 	bno = ext2_mapsearch(fs, bbp, bpref);
 	if (bno < 0){
-		unlock_super(DEVVP(ip));
 		return (0);
 	}
 gotit:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907031921.n63JLVY1028825>