From: Christoph Hellwig <hch@lst.de>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] Re: [PATCH] use sb_getblk
Date: Mon Jun 14 08:03:10 2004 [thread overview]
Message-ID: <20040614130303.GA29918@lst.de> (raw)
In-Reply-To: <20040606081146.GB28366@lst.de>
On Sun, Jun 06, 2004 at 10:11:46AM +0200, Christoph Hellwig wrote:
> It's both in 2.6 and recent 2.6 (for RH ASS2.1 you'll probably need to
> copy the latest 2.4 defintion, but I don't care for obsolete junk).
rediffed for current f-c branch and fixed some more OCFS_GET_BLOCKDEV
crap.
Index: src/super.c
===================================================================
--- src/super.c (revision 1091)
+++ src/super.c (working copy)
@@ -840,19 +840,6 @@
OCFS_CLEAR_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_MEM_LISTS_INITIALIZED);
} /* ocfs_free_mem_lists */
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static inline int ocfs_hardsect_size(struct block_device *bdev)
-{
- return bdev_hardsect_size(bdev);
-}
-#else
-static inline int ocfs_hardsect_size(dev_t dev)
-{
- return get_hardsect_size(dev);
-}
-#endif /* 2.6.0 */
-
static int ocfs2_sb_probe(struct super_block *sb,
struct buffer_head **bh,
int *sector_size)
@@ -865,7 +852,7 @@
*bh = NULL;
/* may be > 512 */
- *sector_size = ocfs_hardsect_size(OCFS_GET_BLOCKDEV(sb));
+ *sector_size = bdev_hardsect_size(sb->s_bdev);
if (*sector_size > 4096) {
LOG_ERROR_ARGS("Hardware sector size too large: %d (max=4096)\n", *sector_size);
status = -EINVAL;
@@ -947,7 +934,7 @@
return status;
}
- *bh = getblk (OCFS_GET_BLOCKDEV(sb), block, sect_size);
+ *bh = sb_getblk(sb, block);
if (!*bh) {
LOG_ERROR_STATUS(-EIO);
return -EIO;
Index: src/ocfs_compat.h
===================================================================
--- src/ocfs_compat.h (revision 1091)
+++ src/ocfs_compat.h (working copy)
@@ -63,6 +63,7 @@
#define io_schedule schedule
#define io_schedule_timeout schedule_timeout
+#define bdev_hardsect_size(b) get_hardsect_size((b)->bd_dev);
#ifdef HAVE_NPTL
static inline void dequeue_signal_lock(struct task_struct *task,
Index: src/journal.c
===================================================================
--- src/journal.c (revision 1091)
+++ src/journal.c (working copy)
@@ -540,9 +540,9 @@
* turned off later. */
LOG_ERROR_ARGS("block %lu was modified but never "
"dirtied!\n", co->blocknr);
- bh = getblk(OCFS_GET_BLOCKDEV(osb->sb), co->blocknr,
- osb->sb->s_blocksize);
+ bh = sb_getblk(osb->sb, co->blocknr);
if (bh == NULL)
+#warning bingo, oops on oom
BUG();
dirtied = 0;
Index: src/volcfg.c
===================================================================
--- src/volcfg.c (revision 1091)
+++ src/volcfg.c (working copy)
@@ -489,7 +489,7 @@
sb = osb->sb;
blocknum = lock_off >> sb->s_blocksize_bits;
- bh = getblk(OCFS_GET_BLOCKDEV(sb), blocknum, sb->s_blocksize);
+ bh = sb_getblk(sb, blocknum);
if (bh == NULL) {
LOG_ERROR_STATUS (status = -EIO);
goto finally;
@@ -636,7 +636,7 @@
/* Write the node details */
blocknum = osb->autoconfig_blkno + OCFS_VOLCFG_HDR_SECTORS + node_num;
- bh = getblk(OCFS_GET_BLOCKDEV(sb), blocknum, sb->s_blocksize);
+ bh = sb_getblk(sb, blocknum);
if (bh == NULL) {
status = -EIO;
LOG_ERROR_STATUS(status);
Index: src/namei.c
===================================================================
--- src/namei.c (revision 1091)
+++ src/namei.c (working copy)
@@ -405,9 +405,7 @@
goto leave;
}
- *new_fe_bh = getblk(OCFS_GET_BLOCKDEV(osb->sb),
- disk_off >> osb->sb->s_blocksize_bits,
- osb->sb->s_blocksize);
+ *new_fe_bh = sb_getblk(osb->sb, disk_off >> osb->sb->s_blocksize_bits);
if (!*new_fe_bh) {
status = -EIO;
LOG_ERROR_STATUS(status);
Index: src/inode.c
===================================================================
--- src/inode.c (revision 1091)
+++ src/inode.c (working copy)
@@ -1064,9 +1064,7 @@
goto fail;
if (new) {
- bh = getblk(OCFS_GET_BLOCKDEV(osb->sb),
- lbo >> osb->sb->s_blocksize_bits,
- osb->sb->s_blocksize);
+ bh = sb_getblk(osb->sb, lbo >> osb->sb->s_blocksize_bits);
if (!bh) {
tmperr = -EIO;
goto fail;
Index: src/ocfs.h
===================================================================
--- src/ocfs.h (revision 1091)
+++ src/ocfs.h (working copy)
@@ -393,21 +393,16 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-typedef struct block_device * ocfs_blockdev;
typedef dev_t ocfs_dev;
#define OCFS_NODEV 0
-#define OCFS_GET_BLOCKDEV(sb) ((sb)->s_bdev)
#else /* 2.4 kernel */
-typedef kdev_t ocfs_blockdev;
typedef int ocfs_dev;
#define OCFS_NODEV NODEV
-#define OCFS_GET_BLOCKDEV(sb) ((sb)->s_dev)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
/* No longer exists in 2.5 */
#define fsync_inode_buffers(inode) sync_mapping_buffers(inode->i_mapping)
-#define getblk(dev, blk, sz) __getblk(dev, blk, sz)
#endif /* >= 2.6.0 */
#define OCFS_SB(sb) ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
@@ -452,11 +447,7 @@
struct semaphore s_sem;
struct list_head s_list;
unsigned long s_blocknr;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
dev_t s_dev;
-#else
- kdev_t s_dev;
-#endif
atomic_t s_refcnt;
struct buffer_head *s_bh;
wait_queue_head_t s_wait;
Index: src/file.c
===================================================================
--- src/file.c (revision 1091)
+++ src/file.c (working copy)
@@ -1228,7 +1228,8 @@
block < (unsigned long)((actualDiskOffset+actualLength) >> sb->s_blocksize_bits);
block++) {
LOG_TRACE_ARGS("setting block %lu as new!\n", block);
- alloc_bh = getblk(OCFS_GET_BLOCKDEV(sb), block, sb->s_blocksize);
+ alloc_bh = sb_getblk(sb, block);
+#warning unchecked allocation here
alloc_bh->b_state |= (1UL << BH_New);
brelse(alloc_bh);
}
Index: src/buffer_head_io.c
===================================================================
--- src/buffer_head_io.c (revision 1091)
+++ src/buffer_head_io.c (working copy)
@@ -71,7 +71,6 @@
int status = 0;
int i;
struct super_block *sb;
- ocfs_blockdev dev;
struct buffer_head *bh;
#ifdef OCFS_DBG_TIMING
@@ -96,7 +95,6 @@
LOG_TRACE_ARGS ("Getting write for %d blocks\n", nr);
sb = osb->sb;
- dev = OCFS_GET_BLOCKDEV(sb);
/* we don't ever want cached writes -- those should go to the
* journal so we can control when they actually hit disk and
@@ -211,7 +209,6 @@
struct super_block *sb;
int nr, i, ignore_cache = 0;
__u64 blocknum;
- ocfs_blockdev dev;
struct buffer_head *bh;
#ifdef OCFS_DBG_TIMING
@@ -248,7 +245,6 @@
}
sb = osb->sb;
- dev = OCFS_GET_BLOCKDEV(sb);
blocknum = off >> sb->s_blocksize_bits;
nr = (len + 511) >> 9;
@@ -263,7 +259,7 @@
for (i = 0 ; i < nr ; i++) {
if (bhs[i] == NULL) {
- bhs[i] = getblk (dev, blocknum++, sb->s_blocksize);
+ bhs[i] = sb_getblk(sb, blocknum++);
if (bhs[i] == NULL) {
LOG_TRACE_STR("bh == NULL");
status = -EIO;
Index: src/alloc.c
===================================================================
--- src/alloc.c (revision 1091)
+++ src/alloc.c (working copy)
@@ -934,9 +934,7 @@
phys_blkno = physicalOffset >> osb->sb->s_blocksize_bits;
for (i = 0; i < numbhs; i++) {
- bhs[i] = getblk(OCFS_GET_BLOCKDEV(osb->sb),
- phys_blkno + i,
- osb->sb->s_blocksize);
+ bhs[i] = sb_getblk(osb->sb, phys_blkno + i);
if (bhs[i] == NULL) {
status = -EIO;
LOG_ERROR_STATUS(status);
prev parent reply other threads:[~2004-06-14 8:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-06 3:11 [Ocfs2-devel] [PATCH] use sb_getblk Christoph Hellwig
2004-06-14 8:03 ` Christoph Hellwig [this message]
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=20040614130303.GA29918@lst.de \
--to=hch@lst.de \
--cc=ocfs2-devel@oss.oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.