aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/shmem_fs.h
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2011-08-03 19:21:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-08-03 20:25:24 -0400
commit69f07ec938712b58755add82dd3d0b35f01317cc (patch)
tree7a0a704ed4bc79dbba50454093469d0ce31ef1a4 /include/linux/shmem_fs.h
parent6922c0c7abd387374255801f7739624867e8acad (diff)
tmpfs: use kmemdup for short symlinks
But we've not yet removed the old swp_entry_t i_direct[16] from shmem_inode_info. That's because it was still being shared with the inline symlink. Remove it now (saving 64 or 128 bytes from shmem inode size), and use kmemdup() for short symlinks, say, those up to 128 bytes. I wonder why mpol_free_shared_policy() is done in shmem_destroy_inode() rather than shmem_evict_inode(), where we usually do such freeing? I guess it doesn't matter, and I'm not into NUMA mpol testing right now. Signed-off-by: Hugh Dickins <hughd@google.com> Acked-by: Rik van Riel <riel@redhat.com> Reviewed-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/shmem_fs.h')
-rw-r--r--include/linux/shmem_fs.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 0c8e952df594..9291ac3cc627 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -8,20 +8,15 @@
8 8
9/* inode in-kernel data */ 9/* inode in-kernel data */
10 10
11#define SHMEM_NR_DIRECT 16
12
13#define SHMEM_SYMLINK_INLINE_LEN (SHMEM_NR_DIRECT * sizeof(swp_entry_t))
14
15struct shmem_inode_info { 11struct shmem_inode_info {
16 spinlock_t lock; 12 spinlock_t lock;
17 unsigned long flags; 13 unsigned long flags;
18 unsigned long alloced; /* data pages alloced to file */ 14 unsigned long alloced; /* data pages alloced to file */
19 unsigned long swapped; /* subtotal assigned to swap */
20 struct shared_policy policy; /* NUMA memory alloc policy */
21 union { 15 union {
22 swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ 16 unsigned long swapped; /* subtotal assigned to swap */
23 char inline_symlink[SHMEM_SYMLINK_INLINE_LEN]; 17 char *symlink; /* unswappable short symlink */
24 }; 18 };
19 struct shared_policy policy; /* NUMA memory alloc policy */
25 struct list_head swaplist; /* chain of maybes on swap */ 20 struct list_head swaplist; /* chain of maybes on swap */
26 struct list_head xattr_list; /* list of shmem_xattr */ 21 struct list_head xattr_list; /* list of shmem_xattr */
27 struct inode vfs_inode; 22 struct inode vfs_inode;