linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Kleikamp <shaggy@austin.ibm.com>
To: linux-mm <linux-mm@kvack.org>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>,
	Dave McCracken <dmccr@us.ibm.com>,
	Badari Pulavarty <pbadari@us.ibm.com>
Subject: [RFC:PATCH 008/008] Handle file tails in mm/filemap.c
Date: Mon, 17 Jul 2006 22:09:13 -0600	[thread overview]
Message-ID: <20060718040911.11926.36638.sendpatchset@kleikamp.austin.ibm.com> (raw)
In-Reply-To: <20060718040804.11926.76333.sendpatchset@kleikamp.austin.ibm.com>

Handle file tails in mm/filemap.c

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
---
diff -Nurp linux007/mm/filemap.c linux008/mm/filemap.c
--- linux007/mm/filemap.c	2006-06-17 20:49:35.000000000 -0500
+++ linux008/mm/filemap.c	2006-07-17 23:04:38.000000000 -0500
@@ -30,6 +30,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/cpuset.h>
+#include <linux/file_tail.h>
 #include "filemap.h"
 #include "internal.h"
 
@@ -117,6 +118,12 @@ void __remove_from_page_cache(struct pag
 {
 	struct address_space *mapping = page->mapping;
 
+#ifdef CONFIG_FILE_TAILS
+	if (PageTail(page)) {
+		kfree(mapping->tail);
+		mapping->tail = NULL;
+	}
+#endif
 	radix_tree_delete(&mapping->page_tree, page->index);
 	page->mapping = NULL;
 	mapping->nrpages--;
@@ -885,6 +892,11 @@ page_ok:
 		index += offset >> PAGE_CACHE_SHIFT;
 		offset &= ~PAGE_CACHE_MASK;
 
+#ifdef CONFIG_FILE_TAILS
+		if (!mapping->tail && page->index == FILE_TAIL_INDEX(mapping) &&
+		    !PageDirty(page))
+			pack_file_tail(page);
+#endif
 		page_cache_release(page);
 		if (ret == nr && desc->count)
 			continue;
@@ -2030,6 +2042,16 @@ generic_file_buffered_write(struct kiocb
 			break;
 		}
 
+#ifdef CONFIG_FILE_TAILS
+		if (PageTail(page)) {
+			/* Can't unpack the tail while holding the tail page */
+			unlock_page(page);
+			page_cache_release(page);
+			unpack_file_tail(mapping);
+			continue;
+		}
+#endif
+
 		status = a_ops->prepare_write(file, page, offset, offset+bytes);
 		if (unlikely(status)) {
 			loff_t isize = i_size_read(inode);

-- 
David Kleikamp
IBM Linux Technology Center

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      parent reply	other threads:[~2006-07-18  4:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18  4:08 [RFC:PATCH 000/008] Tail Packing in the the Page Cache Dave Kleikamp
2006-07-18  4:08 ` [RFC:PATCH 001/008] Changes to common header files Dave Kleikamp
2006-07-18  4:08 ` [RFC:PATCH 002/008] Base file tail function Dave Kleikamp
2006-07-18  4:08 ` [RFC:PATCH 003/008] Handle tail pages in kmap & kmap_atomic Dave Kleikamp
2006-07-18  4:08 ` [RFC:PATCH 004/008] Wrap i_size_write Dave Kleikamp
2006-07-18  4:08 ` [RFC:PATCH 005/008] unpack tail page to avoid memory mapping Dave Kleikamp
2006-07-18  4:08 ` [RFC:PATCH 006/008] Don't need to zero past end-of-file in file tail Dave Kleikamp
2006-07-18  4:09 ` [RFC:PATCH 007/008] Make sure tail page is freed correctly Dave Kleikamp
2006-07-18  4:09 ` Dave Kleikamp [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060718040911.11926.36638.sendpatchset@kleikamp.austin.ibm.com \
    --to=shaggy@austin.ibm.com \
    --cc=dmccr@us.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=pbadari@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox