]> err.no Git - linux-2.6/commitdiff
[GFS2] Remove unused function from inode.c
authorSteven Whitehouse <swhiteho@redhat.com>
Thu, 16 Nov 2006 16:08:16 +0000 (11:08 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Thu, 30 Nov 2006 15:35:57 +0000 (10:35 -0500)
The gfs2_glock_nq_m_atime function is unused in so far as its only
ever called with num_gh = 1, and this falls through to the
gfs2_glock_nq_atime function, so we might as well call that directly.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/inode.c
fs/gfs2/inode.h
fs/gfs2/ops_address.c
fs/gfs2/ops_file.c

index ea9ca239c8784ebc4610261e30d1c967fc83cc3c..ce7f83306909a1cca4e1cecdb43ad156960ffe6f 100644 (file)
@@ -1234,92 +1234,6 @@ fail:
        return error;
 }
 
-/**
- * glock_compare_atime - Compare two struct gfs2_glock structures for sort
- * @arg_a: the first structure
- * @arg_b: the second structure
- *
- * Returns: 1 if A > B
- *         -1 if A < B
- *          0 if A == B
- */
-
-static int glock_compare_atime(const void *arg_a, const void *arg_b)
-{
-       const struct gfs2_holder *gh_a = *(const struct gfs2_holder **)arg_a;
-       const struct gfs2_holder *gh_b = *(const struct gfs2_holder **)arg_b;
-       const struct lm_lockname *a = &gh_a->gh_gl->gl_name;
-       const struct lm_lockname *b = &gh_b->gh_gl->gl_name;
-
-       if (a->ln_number > b->ln_number)
-               return 1;
-       if (a->ln_number < b->ln_number)
-               return -1;
-       if (gh_a->gh_state == LM_ST_SHARED && gh_b->gh_state == LM_ST_EXCLUSIVE)
-               return 1;
-       if (gh_a->gh_state == LM_ST_SHARED && (gh_b->gh_flags & GL_ATIME))
-               return 1;
-
-       return 0;
-}
-
-/**
- * gfs2_glock_nq_m_atime - acquire multiple glocks where one may need an
- *      atime update
- * @num_gh: the number of structures
- * @ghs: an array of struct gfs2_holder structures
- *
- * Returns: 0 on success (all glocks acquired),
- *          errno on failure (no glocks acquired)
- */
-
-int gfs2_glock_nq_m_atime(unsigned int num_gh, struct gfs2_holder *ghs)
-{
-       struct gfs2_holder **p;
-       unsigned int x;
-       int error = 0;
-
-       if (!num_gh)
-               return 0;
-
-       if (num_gh == 1) {
-               ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
-               if (ghs->gh_flags & GL_ATIME)
-                       error = gfs2_glock_nq_atime(ghs);
-               else
-                       error = gfs2_glock_nq(ghs);
-               return error;
-       }
-
-       p = kcalloc(num_gh, sizeof(struct gfs2_holder *), GFP_KERNEL);
-       if (!p)
-               return -ENOMEM;
-
-       for (x = 0; x < num_gh; x++)
-               p[x] = &ghs[x];
-
-       sort(p, num_gh, sizeof(struct gfs2_holder *), glock_compare_atime,NULL);
-
-       for (x = 0; x < num_gh; x++) {
-               p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
-
-               if (p[x]->gh_flags & GL_ATIME)
-                       error = gfs2_glock_nq_atime(p[x]);
-               else
-                       error = gfs2_glock_nq(p[x]);
-
-               if (error) {
-                       while (x--)
-                               gfs2_glock_dq(p[x]);
-                       break;
-               }
-       }
-
-       kfree(p);
-       return error;
-}
-
-
 static int
 __gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
 {
index 46917edfdd6c15f5d412d5332376b6ab437cb647..b57f448b15bc42e09c18c2889fe866bdc2efacc6 100644 (file)
@@ -50,12 +50,8 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
                   struct gfs2_inode *ip);
 int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to);
 int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len);
-
 int gfs2_glock_nq_atime(struct gfs2_holder *gh);
-int gfs2_glock_nq_m_atime(unsigned int num_gh, struct gfs2_holder *ghs);
-
 int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
-
 struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
 
 #endif /* __INODE_DOT_H__ */
index 2f7ef980d029b871c8263681fe09dda6e716dab4..8676c39d0d73de7bd13ddbd5d76c587379e9bbf7 100644 (file)
@@ -217,7 +217,7 @@ static int gfs2_readpage(struct file *file, struct page *page)
                }
                gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh);
                do_unlock = 1;
-               error = gfs2_glock_nq_m_atime(1, &gh);
+               error = gfs2_glock_nq_atime(&gh);
                if (unlikely(error))
                        goto out_unlock;
        }
@@ -282,7 +282,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,
                gfs2_holder_init(ip->i_gl, LM_ST_SHARED,
                                 LM_FLAG_TRY_1CB|GL_ATIME, &gh);
                do_unlock = 1;
-               ret = gfs2_glock_nq_m_atime(1, &gh);
+               ret = gfs2_glock_nq_atime(&gh);
                if (ret == GLR_TRYFAILED)
                        goto out_noerror;
                if (unlikely(ret))
@@ -354,7 +354,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
 
 
        gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|LM_FLAG_TRY_1CB, &ip->i_gh);
-       error = gfs2_glock_nq_m_atime(1, &ip->i_gh);
+       error = gfs2_glock_nq_atime(&ip->i_gh);
        if (unlikely(error)) {
                if (error == GLR_TRYFAILED)
                        error = AOP_TRUNCATED_PAGE;
@@ -609,7 +609,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
         * on this path. All we need change is atime.
         */
        gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
-       rv = gfs2_glock_nq_m_atime(1, &gh);
+       rv = gfs2_glock_nq_atime(&gh);
        if (rv)
                goto out;
 
index eabf6c61a96ac40ebffeca5f8c19ddd08dcd72f6..c2be216eb92888c0c70a85c6880540d80b015e62 100644 (file)
@@ -253,7 +253,7 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
        u32 fsflags;
 
        gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
-       error = gfs2_glock_nq_m_atime(1, &gh);
+       error = gfs2_glock_nq_atime(&gh);
        if (error)
                return error;