Merge tag 'gfs2-4.7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 20 May 2016 22:11:26 +0000 (15:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 20 May 2016 22:11:26 +0000 (15:11 -0700)
Pull GFS2 updates from Bob Peterson:
 "We've got nine patches this time:

   - Abhi Das has two patches that fix a GFS2 splice issue (and an
     adjustment).

   - Ben Marzinski has a patch which allows the proper unmount of a GFS2
     file system after hitting a withdraw error.

   - I have a patch to fix a problem where GFS2 would dereference an
     error value, plus three cosmetic / refactoring patches.

   - Daniel DeFreez has a patch to fix two glock reference count
     problems, where GFS2 was not properly "uninitializing" its glock
     holder on error paths.

   - Denys Vlasenko has a patch to change a function to not be inlined,
     thus reducing the memory footprint of the GFS2 module"

* tag 'gfs2-4.7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  GFS2: Refactor gfs2_remove_from_journal
  GFS2: Remove allocation parms from gfs2_rbm_find
  gfs2: use inode_lock/unlock instead of accessing i_mutex directly
  GFS2: Add calls to gfs2_holder_uninit in two error handlers
  GFS2: Don't dereference inode in gfs2_inode_lookup until it's valid
  GFS2: fs/gfs2/glock.c: Deinline do_error, save 1856 bytes
  gfs2: Use gfs2 wrapper to sync inode before calling generic_file_splice_read()
  GFS2: Get rid of dead code in inode_go_demote_ok
  GFS2: ignore unlock failures after withdraw

1  2 
fs/gfs2/aops.c
fs/gfs2/file.c
fs/gfs2/glock.c
fs/gfs2/inode.c
fs/gfs2/meta_io.c
fs/gfs2/rgrp.c

diff --combined fs/gfs2/aops.c
index 8524c0e322fcbad28e7fd6df3b9aa7aefd00a9f1,e21a931ced532d6dbe031ee74028eddcec55a383..37b7bc14c8da578a89282bc4fab2cadd93ed441c
@@@ -101,7 -101,7 +101,7 @@@ static int gfs2_writepage_common(struc
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        loff_t i_size = i_size_read(inode);
 -      pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
 +      pgoff_t end_index = i_size >> PAGE_SHIFT;
        unsigned offset;
  
        if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl)))
        if (current->journal_info)
                goto redirty;
        /* Is the page fully outside i_size? (truncate in progress) */
 -      offset = i_size & (PAGE_CACHE_SIZE-1);
 +      offset = i_size & (PAGE_SIZE-1);
        if (page->index > end_index || (page->index == end_index && !offset)) {
 -              page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE);
 +              page->mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
                goto out;
        }
        return 1;
@@@ -238,7 -238,7 +238,7 @@@ static int gfs2_write_jdata_pagevec(str
  {
        struct inode *inode = mapping->host;
        struct gfs2_sbd *sdp = GFS2_SB(inode);
 -      unsigned nrblocks = nr_pages * (PAGE_CACHE_SIZE/inode->i_sb->s_blocksize);
 +      unsigned nrblocks = nr_pages * (PAGE_SIZE/inode->i_sb->s_blocksize);
        int i;
        int ret;
  
@@@ -366,8 -366,8 +366,8 @@@ static int gfs2_write_cache_jdata(struc
                        cycled = 0;
                end = -1;
        } else {
 -              index = wbc->range_start >> PAGE_CACHE_SHIFT;
 -              end = wbc->range_end >> PAGE_CACHE_SHIFT;
 +              index = wbc->range_start >> PAGE_SHIFT;
 +              end = wbc->range_end >> PAGE_SHIFT;
                if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
                        range_whole = 1;
                cycled = 1; /* ignore range_cyclic tests */
@@@ -458,7 -458,7 +458,7 @@@ static int stuffed_readpage(struct gfs2
         * so we need to supply one here. It doesn't happen often.
         */
        if (unlikely(page->index)) {
 -              zero_user(page, 0, PAGE_CACHE_SIZE);
 +              zero_user(page, 0, PAGE_SIZE);
                SetPageUptodate(page);
                return 0;
        }
        if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode)))
                dsize = (dibh->b_size - sizeof(struct gfs2_dinode));
        memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize);
 -      memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize);
 +      memset(kaddr + dsize, 0, PAGE_SIZE - dsize);
        kunmap_atomic(kaddr);
        flush_dcache_page(page);
        brelse(dibh);
@@@ -560,8 -560,8 +560,8 @@@ int gfs2_internal_read(struct gfs2_inod
                         unsigned size)
  {
        struct address_space *mapping = ip->i_inode.i_mapping;
 -      unsigned long index = *pos / PAGE_CACHE_SIZE;
 -      unsigned offset = *pos & (PAGE_CACHE_SIZE - 1);
 +      unsigned long index = *pos / PAGE_SIZE;
 +      unsigned offset = *pos & (PAGE_SIZE - 1);
        unsigned copied = 0;
        unsigned amt;
        struct page *page;
  
        do {
                amt = size - copied;
 -              if (offset + size > PAGE_CACHE_SIZE)
 -                      amt = PAGE_CACHE_SIZE - offset;
 +              if (offset + size > PAGE_SIZE)
 +                      amt = PAGE_SIZE - offset;
                page = read_cache_page(mapping, index, __gfs2_readpage, NULL);
                if (IS_ERR(page))
                        return PTR_ERR(page);
                p = kmap_atomic(page);
                memcpy(buf + copied, p + offset, amt);
                kunmap_atomic(p);
 -              page_cache_release(page);
 +              put_page(page);
                copied += amt;
                index++;
                offset = 0;
@@@ -651,8 -651,8 +651,8 @@@ static int gfs2_write_begin(struct fil
        unsigned requested = 0;
        int alloc_required;
        int error = 0;
 -      pgoff_t index = pos >> PAGE_CACHE_SHIFT;
 -      unsigned from = pos & (PAGE_CACHE_SIZE - 1);
 +      pgoff_t index = pos >> PAGE_SHIFT;
 +      unsigned from = pos & (PAGE_SIZE - 1);
        struct page *page;
  
        gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);
                rblocks += gfs2_rg_blocks(ip, requested);
  
        error = gfs2_trans_begin(sdp, rblocks,
 -                               PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);
 +                               PAGE_SIZE/sdp->sd_sb.sb_bsize);
        if (error)
                goto out_trans_fail;
  
@@@ -727,7 -727,7 +727,7 @@@ out
                return 0;
  
        unlock_page(page);
 -      page_cache_release(page);
 +      put_page(page);
  
        gfs2_trans_end(sdp);
        if (pos + len > ip->i_inode.i_size)
@@@ -827,7 -827,7 +827,7 @@@ static int gfs2_stuffed_write_end(struc
        if (!PageUptodate(page))
                SetPageUptodate(page);
        unlock_page(page);
 -      page_cache_release(page);
 +      put_page(page);
  
        if (copied) {
                if (inode->i_size < to)
@@@ -877,7 -877,7 +877,7 @@@ static int gfs2_write_end(struct file *
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
        struct buffer_head *dibh;
 -      unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
 +      unsigned int from = pos & (PAGE_SIZE - 1);
        unsigned int to = from + len;
        int ret;
        struct gfs2_trans *tr = current->journal_info;
        ret = gfs2_meta_inode_buffer(ip, &dibh);
        if (unlikely(ret)) {
                unlock_page(page);
 -              page_cache_release(page);
 +              put_page(page);
                goto failed;
        }
  
@@@ -977,7 -977,7 +977,7 @@@ static void gfs2_discard(struct gfs2_sb
                if (!list_empty(&bd->bd_list) && !buffer_pinned(bh))
                        list_del_init(&bd->bd_list);
                else
-                       gfs2_remove_from_journal(bh, current->journal_info, 0);
+                       gfs2_remove_from_journal(bh, REMOVE_JDATA);
        }
        bh->b_bdev = NULL;
        clear_buffer_mapped(bh);
@@@ -992,7 -992,7 +992,7 @@@ static void gfs2_invalidatepage(struct 
  {
        struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host);
        unsigned int stop = offset + length;
 -      int partial_page = (offset || length < PAGE_CACHE_SIZE);
 +      int partial_page = (offset || length < PAGE_SIZE);
        struct buffer_head *bh, *head;
        unsigned long pos = 0;
  
@@@ -1042,13 -1042,13 +1042,13 @@@ static int gfs2_ok_for_dio(struct gfs2_
  
  
  
 -static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 -                            loff_t offset)
 +static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
  {
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_mapping->host;
        struct address_space *mapping = inode->i_mapping;
        struct gfs2_inode *ip = GFS2_I(inode);
 +      loff_t offset = iocb->ki_pos;
        struct gfs2_holder gh;
        int rv;
  
        gfs2_holder_init(ip->i_gl, LM_ST_DEFERRED, 0, &gh);
        rv = gfs2_glock_nq(&gh);
        if (rv)
-               return rv;
+               goto out_uninit;
        rv = gfs2_ok_for_dio(ip, offset);
        if (rv != 1)
                goto out; /* dio not valid, fall back to buffered i/o */
         * the first place, mapping->nr_pages will always be zero.
         */
        if (mapping->nrpages) {
 -              loff_t lstart = offset & ~(PAGE_CACHE_SIZE - 1);
 +              loff_t lstart = offset & ~(PAGE_SIZE - 1);
                loff_t len = iov_iter_count(iter);
                loff_t end = PAGE_ALIGN(offset + len) - 1;
  
        }
  
        rv = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
 -                                offset, gfs2_get_block_direct, NULL, NULL, 0);
 +                                gfs2_get_block_direct, NULL, NULL, 0);
  out:
        gfs2_glock_dq(&gh);
+ out_uninit:
        gfs2_holder_uninit(&gh);
        return rv;
  }
diff --combined fs/gfs2/file.c
index e53b723abd3b828f991f5138515742d869627908,374dd532710137ad9225858ecf1c4f8456200caf..e0f98e483aec1a1aa20ff3fe7c416cd017adf6c7
@@@ -160,7 -160,7 +160,7 @@@ static int gfs2_get_flags(struct file *
        gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
        error = gfs2_glock_nq(&gh);
        if (error)
-               return error;
+               goto out_uninit;
  
        fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_diskflags);
        if (!S_ISDIR(inode->i_mode) && ip->i_diskflags & GFS2_DIF_JDATA)
                error = -EFAULT;
  
        gfs2_glock_dq(&gh);
+ out_uninit:
        gfs2_holder_uninit(&gh);
        return error;
  }
@@@ -354,8 -355,8 +355,8 @@@ static int gfs2_allocate_page_backing(s
  {
        struct inode *inode = page->mapping->host;
        struct buffer_head bh;
 -      unsigned long size = PAGE_CACHE_SIZE;
 -      u64 lblock = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
 +      unsigned long size = PAGE_SIZE;
 +      u64 lblock = page->index << (PAGE_SHIFT - inode->i_blkbits);
  
        do {
                bh.b_state = 0;
@@@ -386,7 -387,7 +387,7 @@@ static int gfs2_page_mkwrite(struct vm_
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct gfs2_alloc_parms ap = { .aflags = 0, };
        unsigned long last_index;
 -      u64 pos = page->index << PAGE_CACHE_SHIFT;
 +      u64 pos = page->index << PAGE_SHIFT;
        unsigned int data_blocks, ind_blocks, rblocks;
        struct gfs2_holder gh;
        loff_t size;
        if (ret)
                goto out;
  
 -      gfs2_size_hint(vma->vm_file, pos, PAGE_CACHE_SIZE);
 +      gfs2_size_hint(vma->vm_file, pos, PAGE_SIZE);
  
        gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
        ret = gfs2_glock_nq(&gh);
        set_bit(GLF_DIRTY, &ip->i_gl->gl_flags);
        set_bit(GIF_SW_PAGED, &ip->i_flags);
  
 -      if (!gfs2_write_alloc_required(ip, pos, PAGE_CACHE_SIZE)) {
 +      if (!gfs2_write_alloc_required(ip, pos, PAGE_SIZE)) {
                lock_page(page);
                if (!PageUptodate(page) || page->mapping != inode->i_mapping) {
                        ret = -EAGAIN;
        if (ret)
                goto out_unlock;
  
 -      gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks);
 +      gfs2_write_calc_reserv(ip, PAGE_SIZE, &data_blocks, &ind_blocks);
        ap.target = data_blocks + ind_blocks;
        ret = gfs2_quota_lock_check(ip, &ap);
        if (ret)
        lock_page(page);
        ret = -EINVAL;
        size = i_size_read(inode);
 -      last_index = (size - 1) >> PAGE_CACHE_SHIFT;
 +      last_index = (size - 1) >> PAGE_SHIFT;
        /* Check page index against inode size */
        if (size == 0 || (page->index > last_index))
                goto out_trans_end;
@@@ -873,7 -874,7 +874,7 @@@ static long __gfs2_fallocate(struct fil
                        rblocks += data_blocks ? data_blocks : 1;
  
                error = gfs2_trans_begin(sdp, rblocks,
 -                                       PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);
 +                                       PAGE_SIZE/sdp->sd_sb.sb_bsize);
                if (error)
                        goto out_trans_fail;
  
                mark_inode_dirty(inode);
        }
  
 -      return generic_write_sync(file, pos, count);
 +      if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host))
 +              return vfs_fsync_range(file, pos, pos + count - 1,
 +                             (file->f_flags & __O_SYNC) ? 0 : 1);
 +      return 0;
  
  out_trans_fail:
        gfs2_inplace_release(ip);
@@@ -953,6 -951,30 +954,30 @@@ out_uninit
        return ret;
  }
  
+ static ssize_t gfs2_file_splice_read(struct file *in, loff_t *ppos,
+                                    struct pipe_inode_info *pipe, size_t len,
+                                    unsigned int flags)
+ {
+       struct inode *inode = in->f_mapping->host;
+       struct gfs2_inode *ip = GFS2_I(inode);
+       struct gfs2_holder gh;
+       int ret;
+       inode_lock(inode);
+       ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
+       if (ret) {
+               inode_unlock(inode);
+               return ret;
+       }
+       gfs2_glock_dq_uninit(&gh);
+       inode_unlock(inode);
+       return generic_file_splice_read(in, ppos, pipe, len, flags);
+ }
  static ssize_t gfs2_file_splice_write(struct pipe_inode_info *pipe,
                                      struct file *out, loff_t *ppos,
                                      size_t len, unsigned int flags)
@@@ -1115,14 -1137,14 +1140,14 @@@ const struct file_operations gfs2_file_
        .fsync          = gfs2_fsync,
        .lock           = gfs2_lock,
        .flock          = gfs2_flock,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = gfs2_file_splice_read,
        .splice_write   = gfs2_file_splice_write,
        .setlease       = simple_nosetlease,
        .fallocate      = gfs2_fallocate,
  };
  
  const struct file_operations gfs2_dir_fops = {
 -      .iterate        = gfs2_readdir,
 +      .iterate_shared = gfs2_readdir,
        .unlocked_ioctl = gfs2_ioctl,
        .open           = gfs2_open,
        .release        = gfs2_release,
@@@ -1143,14 -1165,14 +1168,14 @@@ const struct file_operations gfs2_file_
        .open           = gfs2_open,
        .release        = gfs2_release,
        .fsync          = gfs2_fsync,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = gfs2_file_splice_read,
        .splice_write   = gfs2_file_splice_write,
        .setlease       = generic_setlease,
        .fallocate      = gfs2_fallocate,
  };
  
  const struct file_operations gfs2_dir_fops_nolock = {
 -      .iterate        = gfs2_readdir,
 +      .iterate_shared = gfs2_readdir,
        .unlocked_ioctl = gfs2_ioctl,
        .open           = gfs2_open,
        .release        = gfs2_release,
diff --combined fs/gfs2/glock.c
index 4b73bd101bdcd0b4dd4650acb8a42a420d2a74a2,3910cea1aa5155682fda3799d593ecbc105a5aae..706fd9352f368818391ad79f4481feffe0809b60
@@@ -218,7 -218,7 +218,7 @@@ static void gfs2_holder_wake(struct gfs
   *
   */
  
- static inline void do_error(struct gfs2_glock *gl, const int ret)
+ static void do_error(struct gfs2_glock *gl, const int ret)
  {
        struct gfs2_holder *gh, *tmp;
  
@@@ -475,7 -475,14 +475,14 @@@ __acquires(&gl->gl_lockref.lock
        if (sdp->sd_lockstruct.ls_ops->lm_lock) {
                /* lock_dlm */
                ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
-               if (ret) {
+               if (ret == -EINVAL && gl->gl_target == LM_ST_UNLOCKED &&
+                   target == LM_ST_UNLOCKED &&
+                   test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags)) {
+                       finish_xmote(gl, target);
+                       if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
+                               gfs2_glock_put(gl);
+               }
+               else if (ret) {
                        pr_err("lm_lock ret %d\n", ret);
                        GLOCK_BUG_ON(gl, 1);
                }
@@@ -1913,7 -1920,7 +1920,7 @@@ static int gfs2_glocks_open(struct inod
                if (seq->buf)
                        seq->size = GFS2_SEQ_GOODSIZE;
                gi->gl = NULL;
 -              ret = rhashtable_walk_init(&gl_hash_table, &gi->hti);
 +              ret = rhashtable_walk_init(&gl_hash_table, &gi->hti, GFP_KERNEL);
        }
        return ret;
  }
@@@ -1941,7 -1948,7 +1948,7 @@@ static int gfs2_glstats_open(struct ino
                if (seq->buf)
                        seq->size = GFS2_SEQ_GOODSIZE;
                gi->gl = NULL;
 -              ret = rhashtable_walk_init(&gl_hash_table, &gi->hti);
 +              ret = rhashtable_walk_init(&gl_hash_table, &gi->hti, GFP_KERNEL);
        }
        return ret;
  }
diff --combined fs/gfs2/inode.c
index 72e9c64ae37166d45361bfd1252b3fa85ac2159d,aea002ea94a693aaa6f371dd435da4b0aeceb9c9..21dc784f66c2268d2e857314104847b600cc09de
@@@ -93,12 -93,12 +93,12 @@@ struct inode *gfs2_inode_lookup(struct 
        int error;
  
        inode = iget_locked(sb, (unsigned long)no_addr);
-       ip = GFS2_I(inode);
-       ip->i_no_addr = no_addr;
        if (!inode)
                return ERR_PTR(-ENOMEM);
  
+       ip = GFS2_I(inode);
+       ip->i_no_addr = no_addr;
        if (inode->i_state & I_NEW) {
                struct gfs2_sbd *sdp = GFS2_SB(inode);
                ip->i_no_formal_ino = no_formal_ino;
@@@ -692,12 -692,12 +692,12 @@@ static int gfs2_create_inode(struct ino
                               considered free. Any failures need to undo
                               the gfs2 structures. */
        if (default_acl) {
 -              error = gfs2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
 +              error = __gfs2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
                posix_acl_release(default_acl);
        }
        if (acl) {
                if (!error)
 -                      error = gfs2_set_acl(inode, acl, ACL_TYPE_ACCESS);
 +                      error = __gfs2_set_acl(inode, acl, ACL_TYPE_ACCESS);
                posix_acl_release(acl);
        }
  
@@@ -1948,6 -1948,67 +1948,6 @@@ static int gfs2_getattr(struct vfsmoun
        return 0;
  }
  
 -static int gfs2_setxattr(struct dentry *dentry, const char *name,
 -                       const void *data, size_t size, int flags)
 -{
 -      struct inode *inode = d_inode(dentry);
 -      struct gfs2_inode *ip = GFS2_I(inode);
 -      struct gfs2_holder gh;
 -      int ret;
 -
 -      gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
 -      ret = gfs2_glock_nq(&gh);
 -      if (ret == 0) {
 -              ret = gfs2_rsqa_alloc(ip);
 -              if (ret == 0)
 -                      ret = generic_setxattr(dentry, name, data, size, flags);
 -              gfs2_glock_dq(&gh);
 -      }
 -      gfs2_holder_uninit(&gh);
 -      return ret;
 -}
 -
 -static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
 -                           void *data, size_t size)
 -{
 -      struct inode *inode = d_inode(dentry);
 -      struct gfs2_inode *ip = GFS2_I(inode);
 -      struct gfs2_holder gh;
 -      int ret;
 -
 -      /* For selinux during lookup */
 -      if (gfs2_glock_is_locked_by_me(ip->i_gl))
 -              return generic_getxattr(dentry, name, data, size);
 -
 -      gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
 -      ret = gfs2_glock_nq(&gh);
 -      if (ret == 0) {
 -              ret = generic_getxattr(dentry, name, data, size);
 -              gfs2_glock_dq(&gh);
 -      }
 -      gfs2_holder_uninit(&gh);
 -      return ret;
 -}
 -
 -static int gfs2_removexattr(struct dentry *dentry, const char *name)
 -{
 -      struct inode *inode = d_inode(dentry);
 -      struct gfs2_inode *ip = GFS2_I(inode);
 -      struct gfs2_holder gh;
 -      int ret;
 -
 -      gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
 -      ret = gfs2_glock_nq(&gh);
 -      if (ret == 0) {
 -              ret = gfs2_rsqa_alloc(ip);
 -              if (ret == 0)
 -                      ret = generic_removexattr(dentry, name);
 -              gfs2_glock_dq(&gh);
 -      }
 -      gfs2_holder_uninit(&gh);
 -      return ret;
 -}
 -
  static int gfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                       u64 start, u64 len)
  {
@@@ -1994,10 -2055,10 +1994,10 @@@ const struct inode_operations gfs2_file
        .permission = gfs2_permission,
        .setattr = gfs2_setattr,
        .getattr = gfs2_getattr,
 -      .setxattr = gfs2_setxattr,
 -      .getxattr = gfs2_getxattr,
 +      .setxattr = generic_setxattr,
 +      .getxattr = generic_getxattr,
        .listxattr = gfs2_listxattr,
 -      .removexattr = gfs2_removexattr,
 +      .removexattr = generic_removexattr,
        .fiemap = gfs2_fiemap,
        .get_acl = gfs2_get_acl,
        .set_acl = gfs2_set_acl,
@@@ -2016,10 -2077,10 +2016,10 @@@ const struct inode_operations gfs2_dir_
        .permission = gfs2_permission,
        .setattr = gfs2_setattr,
        .getattr = gfs2_getattr,
 -      .setxattr = gfs2_setxattr,
 -      .getxattr = gfs2_getxattr,
 +      .setxattr = generic_setxattr,
 +      .getxattr = generic_getxattr,
        .listxattr = gfs2_listxattr,
 -      .removexattr = gfs2_removexattr,
 +      .removexattr = generic_removexattr,
        .fiemap = gfs2_fiemap,
        .get_acl = gfs2_get_acl,
        .set_acl = gfs2_set_acl,
@@@ -2032,10 -2093,10 +2032,10 @@@ const struct inode_operations gfs2_syml
        .permission = gfs2_permission,
        .setattr = gfs2_setattr,
        .getattr = gfs2_getattr,
 -      .setxattr = gfs2_setxattr,
 -      .getxattr = gfs2_getxattr,
 +      .setxattr = generic_setxattr,
 +      .getxattr = generic_getxattr,
        .listxattr = gfs2_listxattr,
 -      .removexattr = gfs2_removexattr,
 +      .removexattr = generic_removexattr,
        .fiemap = gfs2_fiemap,
  };
  
diff --combined fs/gfs2/meta_io.c
index 0448524c11bcfca005a874861235066de2a7242e,8f3f1b863687c4f78d8601ffdb20a4da64d544e9..8eaadabbc77100bea1906de90b70e201cb4c57cd
@@@ -124,7 -124,7 +124,7 @@@ struct buffer_head *gfs2_getbuf(struct 
        if (mapping == NULL)
                mapping = &sdp->sd_aspace;
  
 -      shift = PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift;
 +      shift = PAGE_SHIFT - sdp->sd_sb.sb_bsize_shift;
        index = blkno >> shift;             /* convert block to page */
        bufnum = blkno - (index << shift);  /* block buf index within page */
  
                map_bh(bh, sdp->sd_vfs, blkno);
  
        unlock_page(page);
 -      page_cache_release(page);
 +      put_page(page);
  
        return bh;
  }
@@@ -325,18 -325,19 +325,19 @@@ int gfs2_meta_wait(struct gfs2_sbd *sdp
        return 0;
  }
  
- void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta)
+ void gfs2_remove_from_journal(struct buffer_head *bh, int meta)
  {
        struct address_space *mapping = bh->b_page->mapping;
        struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
        struct gfs2_bufdata *bd = bh->b_private;
+       struct gfs2_trans *tr = current->journal_info;
        int was_pinned = 0;
  
        if (test_clear_buffer_pinned(bh)) {
                trace_gfs2_pin(bd, 0);
                atomic_dec(&sdp->sd_log_pinned);
                list_del_init(&bd->bd_list);
-               if (meta)
+               if (meta == REMOVE_META)
                        tr->tr_num_buf_rm++;
                else
                        tr->tr_num_databuf_rm++;
@@@ -376,7 -377,7 +377,7 @@@ void gfs2_meta_wipe(struct gfs2_inode *
                if (bh) {
                        lock_buffer(bh);
                        gfs2_log_lock(sdp);
-                       gfs2_remove_from_journal(bh, current->journal_info, 1);
+                       gfs2_remove_from_journal(bh, REMOVE_META);
                        gfs2_log_unlock(sdp);
                        unlock_buffer(bh);
                        brelse(bh);
diff --combined fs/gfs2/rgrp.c
index 99a0bdac8796b11046f29c5981f32261338d8297,8b580e535ad4bdb0310f2fa6b11d48e7de6e15c9..5bd216901e89334186d74751f62ff36ef876ff71
@@@ -73,8 -73,7 +73,7 @@@ static const char valid_change[16] = 
  };
  
  static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
-                        const struct gfs2_inode *ip, bool nowrap,
-                        const struct gfs2_alloc_parms *ap);
+                        const struct gfs2_inode *ip, bool nowrap);
  
  
  /**
@@@ -918,8 -917,9 +917,8 @@@ static int read_rindex_entry(struct gfs
                goto fail;
  
        rgd->rd_gl->gl_object = rgd;
 -      rgd->rd_gl->gl_vm.start = (rgd->rd_addr * bsize) & PAGE_CACHE_MASK;
 -      rgd->rd_gl->gl_vm.end = PAGE_CACHE_ALIGN((rgd->rd_addr +
 -                                                rgd->rd_length) * bsize) - 1;
 +      rgd->rd_gl->gl_vm.start = (rgd->rd_addr * bsize) & PAGE_MASK;
 +      rgd->rd_gl->gl_vm.end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
        rgd->rd_rgl = (struct gfs2_rgrp_lvb *)rgd->rd_gl->gl_lksb.sb_lvbptr;
        rgd->rd_flags &= ~(GFS2_RDF_UPTODATE | GFS2_RDF_PREFERRED);
        if (rgd->rd_data > sdp->sd_max_rg_data)
@@@ -1511,7 -1511,7 +1510,7 @@@ static void rg_mblk_search(struct gfs2_
        if (WARN_ON(gfs2_rbm_from_block(&rbm, goal)))
                return;
  
-       ret = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &extlen, ip, true, ap);
+       ret = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &extlen, ip, true);
        if (ret == 0) {
                rs->rs_rbm = rbm;
                rs->rs_free = extlen;
@@@ -1638,7 -1638,6 +1637,6 @@@ fail
   * @ip: If set, check for reservations
   * @nowrap: Stop looking at the end of the rgrp, rather than wrapping
   *          around until we've reached the starting point.
-  * @ap: the allocation parameters
   *
   * Side effects:
   * - If looking for free blocks, we set GBF_FULL on each bitmap which
   */
  
  static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
-                        const struct gfs2_inode *ip, bool nowrap,
-                        const struct gfs2_alloc_parms *ap)
+                        const struct gfs2_inode *ip, bool nowrap)
  {
        struct buffer_head *bh;
        int initial_bii;
@@@ -1772,7 -1770,7 +1769,7 @@@ static void try_rgrp_unlink(struct gfs2
        while (1) {
                down_write(&sdp->sd_log_flush_lock);
                error = gfs2_rbm_find(&rbm, GFS2_BLKST_UNLINKED, NULL, NULL,
-                                     true, NULL);
+                                     true);
                up_write(&sdp->sd_log_flush_lock);
                if (error == -ENOSPC)
                        break;
@@@ -2329,12 -2327,11 +2326,11 @@@ int gfs2_alloc_blocks(struct gfs2_inod
        int error;
  
        gfs2_set_alloc_start(&rbm, ip, dinode);
-       error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, NULL, ip, false, NULL);
+       error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, NULL, ip, false);
  
        if (error == -ENOSPC) {
                gfs2_set_alloc_start(&rbm, ip, dinode);
-               error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, NULL, NULL, false,
-                                     NULL);
+               error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, NULL, NULL, false);
        }
  
        /* Since all blocks are reserved in advance, this shouldn't happen */