Hi Daniel, <br><br><div class="gmail_quote">On Fri, Jan 16, 2009 at 12:44 PM, Daniel Phillips <span dir="ltr"><<a href="mailto:phillips@phunq.net">phillips@phunq.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
<br>
diff --git a/fs/hackfs/hackfs.c b/fs/hackfs/hackfs.c<br>
new file mode 100644<br>
index 0000000..afaac69<br>
--- /dev/null<br>
+++ b/fs/hackfs/hackfs.c<br>
@@ -0,0 +1,412 @@<br>
+/*<br>
+int fork_buffer(struct buffer_head *buffer)<br>
+{<br>
+ struct page *oldpage = buffer->b_page;<br>
+ struct address_space *mapping = oldpage->mapping;<br>
+// struct inode *inode = mapping->host;<br>
+// struct sb *sb = tux_sb(inode->i_sb);<br>
+// tuxnode_t *tuxnode = tux_inode(inode);<br>
+ unsigned newdelta = 1 & DELTA_MASK;<br>
+// struct list_head *inode_dirty_list = &tuxnode->dirty;<br>
+ static struct list_head *inode_dirty_list;<br>
+ unsigned blocksize = 1 << 10;<br>
+<br>
+ // Use read_mapping_page to bring the full page uptodate<br>
+ // Take the page lock (protects the buffer list)<br>
+ lock_page(oldpage);<br>
+ while (!PageUptodate(oldpage)) {<br>
+ unlock_page(oldpage);<br>
+ oldpage = read_mapping_page(mapping, oldpage->index, NULL);<br>
+ lock_page(oldpage);<br>
+ }<br>
+<br>
+ // The fork happened while waiting for the page lock?<br>
+ if (bufdelta(buffer) == newdelta) {<br>
+ unlock_page(oldpage);<br>
+ return 0;<br>
+ }<br>
+<br>
+ // Allocate a new page and put buffers on it<br>
+ struct page *newpage = alloc_pages(0, GFP_KERNEL);<br>
+ create_empty_buffers(newpage, blocksize, 0);</blockquote><div><br>I think here is a BUG: <br> create_empty_buffers(newpage, blocksize, 0) -><br> ...<br> spin_lock(&newpage->mapping->private_lock);<br>
...<br> But newpage->mapping == NULL!<br><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
+<br>
+ // Copy page data<br>
+ memcpy(page_address(newpage), page_address(oldpage), PAGE_CACHE_SIZE);<br></blockquote><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
_______________________________________________<br>
Tux3 mailing list<br>
<a href="mailto:Tux3@tux3.org">Tux3@tux3.org</a><br>
<a href="http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3" target="_blank">http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3</a><br>
</blockquote></div><br>