]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] rename block_symlink() to page_symlink()
authorAndrew Morton <akpm@zip.com.au>
Sun, 2 Jun 2002 10:23:07 +0000 (03:23 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 2 Jun 2002 10:23:07 +0000 (03:23 -0700)
block_symlink() is not a "block" function at all.  It is a pure
pagecache/address_space function.  Seeing driverfs calling it was
the last straw.

The patch renames it to `page_symlink()' and moves it into fs/namei.c

14 files changed:
fs/buffer.c
fs/driverfs/inode.c
fs/ext2/namei.c
fs/ext3/inode.c
fs/ext3/namei.c
fs/minix/namei.c
fs/namei.c
fs/ramfs/inode.c
fs/sysv/namei.c
fs/ufs/namei.c
fs/umsdos/namei.c
include/linux/buffer_head.h
include/linux/fs.h
kernel/ksyms.c

index 66ace03446ad786d947aa7177a0cc81a53f58454..80b01a96ee351a579c52e31c8440819aa33d5710 100644 (file)
@@ -2327,46 +2327,6 @@ int brw_page(int rw, struct page *page,
        return 0;
 }
 
-int block_symlink(struct inode *inode, const char *symname, int len)
-{
-       struct address_space *mapping = inode->i_mapping;
-       struct page *page = grab_cache_page(mapping, 0);
-       int err = -ENOMEM;
-       char *kaddr;
-
-       if (!page)
-               goto fail;
-       err = mapping->a_ops->prepare_write(NULL, page, 0, len-1);
-       if (err)
-               goto fail_map;
-       kaddr = page_address(page);
-       memcpy(kaddr, symname, len-1);
-       mapping->a_ops->commit_write(NULL, page, 0, len-1);
-       /*
-        * Notice that we are _not_ going to block here - end of page is
-        * unmapped, so this will only try to map the rest of page, see
-        * that it is unmapped (typically even will not look into inode -
-        * ->i_size will be enough for everything) and zero it out.
-        * OTOH it's obviously correct and should make the page up-to-date.
-        */
-       if (!PageUptodate(page)) {
-               err = mapping->a_ops->readpage(NULL, page);
-               wait_on_page_locked(page);
-       } else {
-               unlock_page(page);
-       }
-       page_cache_release(page);
-       if (err < 0)
-               goto fail;
-       mark_inode_dirty(inode);
-       return 0;
-fail_map:
-       unlock_page(page);
-       page_cache_release(page);
-fail:
-       return err;
-}
-
 /*
  * Sanity checks for try_to_free_buffers.
  */
index c0461118ce00fd14787ee24c472560d18774bcbd..044443f73e6cd1ab44f20b20e290e74641353f98 100644 (file)
@@ -171,7 +171,7 @@ static int driverfs_symlink(struct inode * dir, struct dentry *dentry, const cha
        inode = driverfs_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);
        if (inode) {
                int l = strlen(symname)+1;
-               error = block_symlink(inode, symname, l);
+               error = page_symlink(inode, symname, l);
                if (!error) {
                        d_instantiate(dentry, inode);
                        dget(dentry);
index e1cfa4aedfb4a8fd26817a5cb2f19b6aa333bc84..0b15a2f878e7bd6a55e9a12a823509baf57b3cd2 100644 (file)
@@ -31,7 +31,6 @@
 
 #include "ext2.h"
 #include <linux/pagemap.h>
-#include <linux/buffer_head.h>         /* for block_symlink() */
 
 /*
  * Couple of helper functions - make the code slightly cleaner.
@@ -165,7 +164,7 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry,
                /* slow symlink */
                inode->i_op = &page_symlink_inode_operations;
                inode->i_mapping->a_ops = &ext2_aops;
-               err = block_symlink(inode, symname, l);
+               err = page_symlink(inode, symname, l);
                if (err)
                        goto out_fail;
        } else {
index 52f744db686c5765b17879fc42c9a2a86b244c77..7e3e8aed1ba44a8544897383f6f39e7633f9191f 100644 (file)
@@ -1092,7 +1092,7 @@ static int commit_write_fn(handle_t *handle, struct buffer_head *bh)
 
 /*
  * We need to pick up the new inode size which generic_commit_write gave us
- * `file' can be NULL - eg, when called from block_symlink().
+ * `file' can be NULL - eg, when called from page_symlink().
  *
  * ext3 never places buffers on inode->i_mapping->private_list.  metadata
  * buffers are managed internally.
index 5480619fd80075e56e31416ba6b23a857fe4d750..a5a4ff23ece9bd00f3c56143a748bfc740fe3bbb 100644 (file)
@@ -987,11 +987,11 @@ static int ext3_symlink (struct inode * dir,
                inode->i_op = &page_symlink_inode_operations;
                inode->i_mapping->a_ops = &ext3_aops;
                /*
-                * block_symlink() calls back into ext3_prepare/commit_write.
+                * page_symlink() calls into ext3_prepare/commit_write.
                 * We have a transaction open.  All is sweetness.  It also sets
                 * i_size in generic_commit_write().
                 */
-               err = block_symlink(inode, symname, l);
+               err = page_symlink(inode, symname, l);
                if (err)
                        goto out_no_entry;
        } else {
index 490d638aeb6644994962cf761f8304f887d1bf44..94cbe91bb9fff968ac08eb69f3b708912f17fd12 100644 (file)
@@ -4,7 +4,6 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#include <linux/buffer_head.h> /* for block_symlink() */
 #include "minix.h"
 
 static inline void inc_count(struct inode *inode)
@@ -111,7 +110,7 @@ static int minix_symlink(struct inode * dir, struct dentry *dentry,
 
        inode->i_mode = S_IFLNK | 0777;
        minix_set_inode(inode, 0);
-       err = block_symlink(inode, symname, i);
+       err = page_symlink(inode, symname, i);
        if (err)
                goto out_fail;
 
index d4cea0318dc4c77c370bfdeb985208b909227d16..506f8b5eee6bb61c469a2c20bbe865d72ae2adbb 100644 (file)
@@ -2136,6 +2136,46 @@ int page_follow_link(struct dentry *dentry, struct nameidata *nd)
        return res;
 }
 
+int page_symlink(struct inode *inode, const char *symname, int len)
+{
+       struct address_space *mapping = inode->i_mapping;
+       struct page *page = grab_cache_page(mapping, 0);
+       int err = -ENOMEM;
+       char *kaddr;
+
+       if (!page)
+               goto fail;
+       err = mapping->a_ops->prepare_write(NULL, page, 0, len-1);
+       if (err)
+               goto fail_map;
+       kaddr = page_address(page);
+       memcpy(kaddr, symname, len-1);
+       mapping->a_ops->commit_write(NULL, page, 0, len-1);
+       /*
+        * Notice that we are _not_ going to block here - end of page is
+        * unmapped, so this will only try to map the rest of page, see
+        * that it is unmapped (typically even will not look into inode -
+        * ->i_size will be enough for everything) and zero it out.
+        * OTOH it's obviously correct and should make the page up-to-date.
+        */
+       if (!PageUptodate(page)) {
+               err = mapping->a_ops->readpage(NULL, page);
+               wait_on_page_locked(page);
+       } else {
+               unlock_page(page);
+       }
+       page_cache_release(page);
+       if (err < 0)
+               goto fail;
+       mark_inode_dirty(inode);
+       return 0;
+fail_map:
+       unlock_page(page);
+       page_cache_release(page);
+fail:
+       return err;
+}
+
 struct inode_operations page_symlink_inode_operations = {
        readlink:       page_readlink,
        follow_link:    page_follow_link,
index b5e8ec09d4315f158e65b11e951a9532013539f8..4d7bb011fbf680360e1fc433fb9ca5ac679df867 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/init.h>
 #include <linux/string.h>
 #include <linux/smp_lock.h>
-#include <linux/buffer_head.h>         /* for block_symlink() */
 
 #include <asm/uaccess.h>
 
@@ -235,7 +234,7 @@ static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char *
        inode = ramfs_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);
        if (inode) {
                int l = strlen(symname)+1;
-               error = block_symlink(inode, symname, l);
+               error = page_symlink(inode, symname, l);
                if (!error) {
                        d_instantiate(dentry, inode);
                        dget(dentry);
index 34cbff4f7c5f0e3dfbb1a83bf17087a486d93007..e3681629a89d198b1dae1b4684cbc8e796c3f950 100644 (file)
@@ -117,7 +117,7 @@ static int sysv_symlink(struct inode * dir, struct dentry * dentry,
                goto out;
        
        sysv_set_inode(inode, 0);
-       err = block_symlink(inode, symname, l);
+       err = page_symlink(inode, symname, l);
        if (err)
                goto out_fail;
 
index 643dd7b3780c311555646d8a6d1852d5d37f5e5d..faea20eb2069955d7476410af135d9268903a2bf 100644 (file)
@@ -143,7 +143,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
                /* slow symlink */
                inode->i_op = &page_symlink_inode_operations;
                inode->i_mapping->a_ops = &ufs_aops;
-               err = block_symlink(inode, symname, l);
+               err = page_symlink(inode, symname, l);
                if (err)
                        goto out_fail;
        } else {
index f7640dbda2105d349414b0d1ae3bf4a4af468f9b..9dbcc659408af1f6ea1f43973bb51acadb543b22 100644 (file)
@@ -499,7 +499,7 @@ static int umsdos_symlink_x (struct inode *dir, struct dentry *dentry,
        }
 
        len = strlen (symname) + 1;
-       ret = block_symlink(dentry->d_inode, symname, len);
+       ret = page_symlink(dentry->d_inode, symname, len);
        if (ret < 0)
                goto out_unlink;
 out:
index 9bcb2b34df845901e2348b8eee45f1e097e5ed01..38e533d62fa947b274720159b42549ee14096529 100644 (file)
@@ -192,7 +192,6 @@ void FASTCALL(unlock_buffer(struct buffer_head *bh));
  */
 int try_to_release_page(struct page * page, int gfp_mask);
 int block_flushpage(struct page *page, unsigned long offset);
-int block_symlink(struct inode *, const char *, int);
 int block_write_full_page(struct page*, get_block_t*);
 int block_read_full_page(struct page*, get_block_t*);
 int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
index 1b01db32cc355dbdf98e850906f8392c2310cad9..f4ae9af76b6950b748b54d5e86c6ae6c4192f8aa 100644 (file)
@@ -1244,6 +1244,7 @@ extern int vfs_readlink(struct dentry *, char *, int, const char *);
 extern int vfs_follow_link(struct nameidata *, const char *);
 extern int page_readlink(struct dentry *, char *, int);
 extern int page_follow_link(struct dentry *, struct nameidata *);
+extern int page_symlink(struct inode *inode, const char *symname, int len);
 extern struct inode_operations page_symlink_inode_operations;
 extern void generic_fillattr(struct inode *, struct kstat *);
 
index 0f17b56ac17a59eebefff5e85a6b4396947ab267..19f60908e8785a7a2eece16c8987124d4be575e9 100644 (file)
@@ -277,7 +277,7 @@ EXPORT_SYMBOL(vfs_follow_link);
 EXPORT_SYMBOL(page_readlink);
 EXPORT_SYMBOL(page_follow_link);
 EXPORT_SYMBOL(page_symlink_inode_operations);
-EXPORT_SYMBOL(block_symlink);
+EXPORT_SYMBOL(page_symlink);
 EXPORT_SYMBOL(vfs_readdir);
 EXPORT_SYMBOL(__get_lease);
 EXPORT_SYMBOL(lease_get_mtime);