aboutsummaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-22 15:51:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-22 15:51:21 -0400
commit052b398a43a7de8c68c13e7fa05d6b3d16ce6801 (patch)
tree8b7ee72d0617daf55083bc9cbc904ee22cb953db /mm/shmem.c
parentb953c0d234bc72e8489d3bf51a276c5c4ec85345 (diff)
parentb853a16176cf3e02c57e215743015614152c2428 (diff)
Merge branch 'for-linus-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "In this pile: pathname resolution rewrite. - recursion in link_path_walk() is gone. - nesting limits on symlinks are gone (the only limit remaining is that the total amount of symlinks is no more than 40, no matter how nested). - "fast" (inline) symlinks are handled without leaving rcuwalk mode. - stack footprint (independent of the nesting) is below kilobyte now, about on par with what it used to be with one level of nested symlinks and ~2.8 times lower than it used to be in the worst case. - struct nameidata is entirely private to fs/namei.c now (not even opaque pointers are being passed around). - ->follow_link() and ->put_link() calling conventions had been changed; all in-tree filesystems converted, out-of-tree should be able to follow reasonably easily. For out-of-tree conversions, see Documentation/filesystems/porting for details (and in-tree filesystems for examples of conversion). That has sat in -next since mid-May, seems to survive all testing without regressions and merges clean with v4.1" * 'for-linus-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (131 commits) turn user_{path_at,path,lpath,path_dir}() into static inlines namei: move saved_nd pointer into struct nameidata inline user_path_create() inline user_path_parent() namei: trim do_last() arguments namei: stash dfd and name into nameidata namei: fold path_cleanup() into terminate_walk() namei: saner calling conventions for filename_parentat() namei: saner calling conventions for filename_create() namei: shift nameidata down into filename_parentat() namei: make filename_lookup() reject ERR_PTR() passed as name namei: shift nameidata inside filename_lookup() namei: move putname() call into filename_lookup() namei: pass the struct path to store the result down into path_lookupat() namei: uninline set_root{,_rcu}() namei: be careful with mountpoint crossings in follow_dotdot_rcu() Documentation: remove outdated information from automount-support.txt get rid of assorted nameidata-related debris lustre: kill unused helper lustre: kill unused macro (LOOKUP_CONTINUE) ...
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 47d536e59fc0..3759099d8ce4 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2451,6 +2451,7 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
2451 return -ENOMEM; 2451 return -ENOMEM;
2452 } 2452 }
2453 inode->i_op = &shmem_short_symlink_operations; 2453 inode->i_op = &shmem_short_symlink_operations;
2454 inode->i_link = info->symlink;
2454 } else { 2455 } else {
2455 error = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL); 2456 error = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL);
2456 if (error) { 2457 if (error) {
@@ -2474,30 +2475,23 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
2474 return 0; 2475 return 0;
2475} 2476}
2476 2477
2477static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd) 2478static const char *shmem_follow_link(struct dentry *dentry, void **cookie)
2478{
2479 nd_set_link(nd, SHMEM_I(d_inode(dentry))->symlink);
2480 return NULL;
2481}
2482
2483static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd)
2484{ 2479{
2485 struct page *page = NULL; 2480 struct page *page = NULL;
2486 int error = shmem_getpage(d_inode(dentry), 0, &page, SGP_READ, NULL); 2481 int error = shmem_getpage(d_inode(dentry), 0, &page, SGP_READ, NULL);
2487 nd_set_link(nd, error ? ERR_PTR(error) : kmap(page)); 2482 if (error)
2488 if (page) 2483 return ERR_PTR(error);
2489 unlock_page(page); 2484 unlock_page(page);
2490 return page; 2485 *cookie = page;
2486 return kmap(page);
2491} 2487}
2492 2488
2493static void shmem_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) 2489static void shmem_put_link(struct inode *unused, void *cookie)
2494{ 2490{
2495 if (!IS_ERR(nd_get_link(nd))) { 2491 struct page *page = cookie;
2496 struct page *page = cookie; 2492 kunmap(page);
2497 kunmap(page); 2493 mark_page_accessed(page);
2498 mark_page_accessed(page); 2494 page_cache_release(page);
2499 page_cache_release(page);
2500 }
2501} 2495}
2502 2496
2503#ifdef CONFIG_TMPFS_XATTR 2497#ifdef CONFIG_TMPFS_XATTR
@@ -2642,7 +2636,7 @@ static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size)
2642 2636
2643static const struct inode_operations shmem_short_symlink_operations = { 2637static const struct inode_operations shmem_short_symlink_operations = {
2644 .readlink = generic_readlink, 2638 .readlink = generic_readlink,
2645 .follow_link = shmem_follow_short_symlink, 2639 .follow_link = simple_follow_link,
2646#ifdef CONFIG_TMPFS_XATTR 2640#ifdef CONFIG_TMPFS_XATTR
2647 .setxattr = shmem_setxattr, 2641 .setxattr = shmem_setxattr,
2648 .getxattr = shmem_getxattr, 2642 .getxattr = shmem_getxattr,