From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 05/27] GFS2: Update gfs2_get_block_type() to use rbm
Date: Wed, 26 Sep 2012 09:25:26 +0100 [thread overview]
Message-ID: <1348647948-3219-6-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1348647948-3219-1-git-send-email-swhiteho@redhat.com>
Use the new gfs2_rbm_from_block() function to replace an open
coded version of the same code.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index bd3b926..0c1be38 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1824,27 +1824,14 @@ void gfs2_inplace_release(struct gfs2_inode *ip)
static unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block)
{
- struct gfs2_bitmap *bi = NULL;
- u32 length, rgrp_block, buf_block;
- unsigned int buf;
- unsigned char type;
-
- length = rgd->rd_length;
- rgrp_block = block - rgd->rd_data0;
-
- for (buf = 0; buf < length; buf++) {
- bi = rgd->rd_bits + buf;
- if (rgrp_block < (bi->bi_start + bi->bi_len) * GFS2_NBBY)
- break;
- }
-
- gfs2_assert(rgd->rd_sbd, buf < length);
- buf_block = rgrp_block - bi->bi_start * GFS2_NBBY;
+ struct gfs2_rbm rbm = { .rgd = rgd, };
+ int ret;
- type = gfs2_testbit(rgd, bi->bi_bh->b_data + bi->bi_offset,
- bi->bi_len, buf_block);
+ ret = gfs2_rbm_from_block(&rbm, block);
+ WARN_ON_ONCE(ret != 0);
- return type;
+ return gfs2_testbit(rgd, rbm.bi->bi_bh->b_data + rbm.bi->bi_offset,
+ rbm.bi->bi_len, rbm.offset);
}
--
1.7.4
next prev parent reply other threads:[~2012-09-26 8:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 8:25 [Cluster-devel] GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 01/27] GFS2: Merge two nearly identical xattr functions Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 02/27] GFS2: Remove rs_requested field from reservations Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 03/27] GFS2: Add structure to contain rgrp, bitmap, offset tuple Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 04/27] GFS2: Replace rgblk_search with gfs2_rbm_find Steven Whitehouse
2012-09-26 8:25 ` Steven Whitehouse [this message]
2012-09-26 8:25 ` [Cluster-devel] [PATCH 06/27] GFS2: Update rgblk_free() to use rbm Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 07/27] GFS2: Use RB_CLEAR_NODE() rather than rb_init_node() Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 08/27] GFS2: Fix case where reservation finished at end of rgrp Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 09/27] GFS2: rbm code cleanup Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 10/27] GFS2: change function gfs2_direct_IO to use a normal gfs2_glock_dq Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 11/27] GFS2: inline __gfs2_glock_schedule_for_reclaim Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 12/27] GFS2: Combine functions gfs2_glock_wait and wait_on_holder Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 13/27] GFS2: Combine functions gfs2_glock_dq_wait and wait_on_demote Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 14/27] GFS2: Eliminate redundant calls to may_grant Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 15/27] GFS2: Eliminate unnecessary check for state > 3 in bitfit Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 16/27] GFS2: Use rbm for gfs2_testbit() Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 17/27] GFS2: Use rbm for gfs2_setbit() Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 18/27] GFS2: Fix ->show_options() for statfs slow Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 19/27] GFS2: Fall back to ignoring reservations, if there are no other blocks left Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 20/27] GFS2: Improve block reservation tracing Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 21/27] GFS2: Fix unclaimed_blocks() wrapping bug and clean up Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 22/27] GFS2: Stop block extents at the end of bitmaps Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 23/27] GFS2: Get rid of I_MUTEX_QUOTA usage Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 24/27] GFS2: Consolidate free block searching functions Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 25/27] GFS2: Fix infinite loop in rbm_find Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 26/27] GFS2: fix s_writers.counter imbalance in gfs2_ail_empty_gl Steven Whitehouse
2012-09-26 8:25 ` [Cluster-devel] [PATCH 27/27] GFS2: Write out dirty inode metadata in delayed deletes Steven Whitehouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348647948-3219-6-git-send-email-swhiteho@redhat.com \
--to=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).