-Downloaded from: svn://svn.berlios.de/iscsitarget/trunk
-Current Version: 1.4.20.1
+Downloaded from: http://sourceforge.net/projects/iscsitarget/files/
+Current Version: 1.4.20.2
/* see Documentation/ABI/testing/sysfs-block */
unsigned bsz = bdev_logical_block_size(bio_data->bdev);
if (!volume->blk_shift)
- volume->blk_shift = ilog2(bsz);
- else if (volume->blk_shift < ilog2(bsz)) {
+ volume->blk_shift = blksize_bits(bsz);
+ else if (volume->blk_shift < blksize_bits(bsz)) {
eprintk("Specified block size (%u) smaller than "
"device %s logical block size (%u)\n",
(1 << volume->blk_shift), bio_data->path, bsz);
--- /dev/null
+/*
+ * Kernel compatibility routines
+ *
+ * Copyright (C) 2008 Ross Walker <rswwalker at gmail dot com>
+ *
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#ifndef __IET_COMPAT_H__
+#define __IET_COMPAT_H__
+
+#include <linux/version.h>
+
+#ifndef DECLARE_COMPLETION_ONSTACK
+#define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
+#endif
+
+#ifndef is_power_of_2
+#define is_power_of_2(n) (n != 0 && ((n & (n - 1)) == 0))
+#endif
+
+#ifndef log2
+#define log2(n) ((sizeof(n) <= 4) ? (fls(n) - 1) : (fls64(n) - 1))
+#endif
+
+#ifndef roundup_pow_of_two
+#define roundup_pow_of_two(n) (1UL << fls_long(n - 1))
+#endif
+
+#endif /* __IET_COMPAT_H__ */
}
if (!lu->blk_shift)
- lu->blk_shift = ilog2(IET_DEF_BLOCK_SIZE);
+ lu->blk_shift = blksize_bits(IET_DEF_BLOCK_SIZE);
lu->blk_cnt = inode->i_size >> lu->blk_shift;
#ifndef _IET_U_H
#define _IET_U_H
-#define IET_VERSION_STRING "1.4.20.1"
+#define IET_VERSION_STRING "1.4.20.2"
/* The maximum length of 223 bytes in the RFC. */
#define ISCSI_NAME_LEN 256
#include "iscsi_hdr.h"
#include "iet_u.h"
+#include "compat.h"
#define IET_SENSE_BUF_SIZE 18
}
if (!lu->blk_shift)
- lu->blk_shift = ilog2(IET_DEF_BLOCK_SIZE);
+ lu->blk_shift = blksize_bits(IET_DEF_BLOCK_SIZE);
/* defaults to 64 GiB */
if (!lu->blk_cnt)
u8 asc, u8 ascq)
{
struct list_head *l = &sess->ua_hash[ua_hashfn(lun)];
- struct ua_entry *ua = kmem_cache_alloc(ua_cache, GFP_KERNEL);
+ struct ua_entry *ua = kmem_cache_alloc(ua_cache, GFP_ATOMIC);
struct ua_entry *e;
if (!ua) {
#include <linux/types.h>
#include <linux/parser.h>
-#include <linux/log2.h>
#include "iscsi.h"
#include "iscsi_dbg.h"
blk_sz = simple_strtoull(argp, NULL, 10);
if (is_power_of_2(blk_sz) &&
512 <= blk_sz && blk_sz <= IET_MAX_BLOCK_SIZE)
- volume->blk_shift = ilog2(blk_sz);
+ volume->blk_shift = blksize_bits(blk_sz);
else {
eprintk("invalid BlockSize=%u\n", blk_sz);
err = -EINVAL;