projects/linux·commit 2017bd19

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client

2017bd19 · Linus Torvalds <[email protected]> · 2010-10-21 12:38:28 -07:00

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (22 commits)
  ceph: do not carry i_lock for readdir from dcache
  fs/ceph/xattr.c: Use kmemdup
  rbd: passing wrong variable to bvec_kunmap_irq()
  rbd: null vs ERR_PTR
  ceph: fix num_pages_free accounting in pagelist
  ceph: add CEPH_MDS_OP_SETDIRLAYOUT and associated ioctl.
  ceph: don't crash when passed bad mount options
  ceph: fix debugfs warnings
  block: rbd: removing unnecessary test
  block: rbd: fixed may leaks
  ceph: switch from BKL to lock_flocks()
  ceph: preallocate flock state without locks held
  ceph: add pagelist_reserve, pagelist_truncate, pagelist_set_cursor
  ceph: use mapping->nrpages to determine if mapping is empty
  ceph: only invalidate on check_caps if we actually have pages
  ceph: do not hide .snap in root directory
  rbd: introduce rados block device (rbd), based on libceph
  ceph: factor out libceph from Ceph file system
  ceph-rbd: osdc support for osd call and rollback operations
  ceph: messenger and osdc changes for rbd
  ...
Commit
2017bd19454ea7cdae19922d15b6930f6c8088a2
Parents
9f1ad094 · efa4c120

Merge commit. Changes below are compared with the first parent: 9f1ad094.

Changes

78 files changed · +5329 −1995

FileStatusAddDelContent
MAINTAINERSmodified+11−0View file
drivers/block/Kconfigmodified+17−0View file
drivers/block/Makefilemodified+1−0View file
drivers/block/rbd.cadded+1841−0View file
drivers/block/rbd_types.hadded+73−0View file
fs/ceph/Kconfigmodified+2−12View file
fs/ceph/Makefilemodified+2−9View file
fs/ceph/READMEdeleted+0−20View before deletion
fs/ceph/addr.cmodified+34−31View file
fs/ceph/caps.cmodified+20−30View file
fs/ceph/ceph_frag.cmodified+2−1View file
fs/ceph/debugfs.cmodified+94−312View file
fs/ceph/dir.cmodified+44−53View file
fs/ceph/export.cmodified+3−2View file
fs/ceph/file.cmodified+26−181View file
fs/ceph/inode.cmodified+10−9View file
fs/ceph/ioctl.cmodified+73−4View file
fs/ceph/ioctl.hmodified+3−1View file
fs/ceph/locks.cmodified+18−5View file
fs/ceph/mds_client.cmodified+81−48View file
fs/ceph/mds_client.hmodified+7−13View file
fs/ceph/mdsmap.cmodified+6−5View file
fs/ceph/snap.cmodified+6−4View file
fs/ceph/ceph_strings.c → fs/ceph/strings.crenamed+3−79View file
fs/ceph/super.cmodified+472−682View file
fs/ceph/super.hmodified+145−255View file
fs/ceph/xattr.cmodified+10−8View file
fs/ceph/auth.h → include/linux/ceph/auth.hrenamed+2−2View file
fs/ceph/buffer.h → include/linux/ceph/buffer.hrenamed+0−0View file
fs/ceph/ceph_debug.h → include/linux/ceph/ceph_debug.hrenamed+3−2View file
fs/ceph/ceph_frag.h → include/linux/ceph/ceph_frag.hrenamed+0−0View file
fs/ceph/ceph_fs.h → include/linux/ceph/ceph_fs.hrenamed+1−0View file
fs/ceph/ceph_hash.h → include/linux/ceph/ceph_hash.hrenamed+0−0View file
include/linux/ceph/debugfs.hadded+33−0View file
fs/ceph/decode.h → include/linux/ceph/decode.hrenamed+5−0View file
include/linux/ceph/libceph.hadded+249−0View file
fs/ceph/mdsmap.h → include/linux/ceph/mdsmap.hrenamed+0−0View file
fs/ceph/messenger.h → include/linux/ceph/messenger.hrenamed+10−2View file
fs/ceph/mon_client.h → include/linux/ceph/mon_client.hrenamed+1−0View file
fs/ceph/msgpool.h → include/linux/ceph/msgpool.hrenamed+0−0View file
fs/ceph/msgr.h → include/linux/ceph/msgr.hrenamed+0−0View file
fs/ceph/osd_client.h → include/linux/ceph/osd_client.hrenamed+67−0View file
fs/ceph/osdmap.h → include/linux/ceph/osdmap.hrenamed+3−1View file
fs/ceph/pagelist.h → include/linux/ceph/pagelist.hrenamed+22−1View file
fs/ceph/rados.h → include/linux/ceph/rados.hrenamed+0−0View file
fs/ceph/types.h → include/linux/ceph/types.hrenamed+0−0View file
fs/ceph/crush/crush.h → include/linux/crush/crush.hrenamed+0−0View file
fs/ceph/crush/hash.h → include/linux/crush/hash.hrenamed+0−0View file
fs/ceph/crush/mapper.h → include/linux/crush/mapper.hrenamed+0−0View file
net/Kconfigmodified+1−0View file
net/Makefilemodified+1−0View file
net/ceph/Kconfigadded+28−0View file
net/ceph/Makefileadded+37−0View file
fs/ceph/armor.c → net/ceph/armor.crenamed+0−0View file
fs/ceph/auth.c → net/ceph/auth.crenamed+5−5View file
fs/ceph/auth_none.c → net/ceph/auth_none.crenamed+4−3View file
fs/ceph/auth_none.h → net/ceph/auth_none.hrenamed+1−2View file
fs/ceph/auth_x.c → net/ceph/auth_x.crenamed+5−4View file
fs/ceph/auth_x.h → net/ceph/auth_x.hrenamed+2−1View file
fs/ceph/auth_x_protocol.h → net/ceph/auth_x_protocol.hrenamed+0−0View file
fs/ceph/buffer.c → net/ceph/buffer.crenamed+6−3View file
net/ceph/ceph_common.cadded+529−0View file
fs/ceph/ceph_fs.c → net/ceph/ceph_fs.crenamed+4−1View file
fs/ceph/ceph_hash.c → net/ceph/ceph_hash.crenamed+1−1View file
net/ceph/ceph_strings.cadded+84−0View file
fs/ceph/crush/crush.c → net/ceph/crush/crush.crenamed+1−1View file
fs/ceph/crush/hash.c → net/ceph/crush/hash.crenamed+1−1View file
fs/ceph/crush/mapper.c → net/ceph/crush/mapper.crenamed+2−2View file
fs/ceph/crypto.c → net/ceph/crypto.crenamed+2−2View file
fs/ceph/crypto.h → net/ceph/crypto.hrenamed+2−2View file
net/ceph/debugfs.cadded+267−0View file
fs/ceph/messenger.c → net/ceph/messenger.crenamed+236−60View file
fs/ceph/mon_client.c → net/ceph/mon_client.crenamed+41−32View file
fs/ceph/msgpool.c → net/ceph/msgpool.crenamed+2−2View file
fs/ceph/osd_client.c → net/ceph/osd_client.crenamed+317−83View file
fs/ceph/osdmap.c → net/ceph/osdmap.crenamed+24−6View file
fs/ceph/pagelist.c → net/ceph/pagelist.crenamed+103−12View file
net/ceph/pagevec.cadded+223−0View file

Only the first 600 diff lines are shown. Download the complete patch.

MAINTAINERS

View file
diff --git a/MAINTAINERS b/MAINTAINERS
index f2a2b8e..3d4179f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1527,6 +1527,8 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
S: Supported
F: Documentation/filesystems/ceph.txt
F: fs/ceph
+F: net/ceph
+F: include/linux/ceph
CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM:
M: David Vrabel <[email protected]>
@@ -4805,6 +4807,15 @@ F: fs/qnx4/
F: include/linux/qnx4_fs.h
F: include/linux/qnxtypes.h
+RADOS BLOCK DEVICE (RBD)
+F: include/linux/qnxtypes.h
+M: Yehuda Sadeh <[email protected]>
+M: Sage Weil <[email protected]>
+S: Supported
+F: drivers/block/rbd.c
+F: drivers/block/rbd_types.h
+
RADEON FRAMEBUFFER DISPLAY DRIVER
M: Benjamin Herrenschmidt <[email protected]>

drivers/block/Kconfig

View file
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index de27768..4b9359a 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -488,4 +488,21 @@ config BLK_DEV_HD
If unsure, say N.
+config BLK_DEV_RBD
+ tristate "Rados block device (RBD)"
+ depends on INET && EXPERIMENTAL && BLOCK
+ select CEPH_LIB
+ select LIBCRC32C
+ select CRYPTO_AES
+ select CRYPTO
+ default n
+ help
+ Say Y here if you want include the Rados block device, which stripes
+ a block device over objects stored in the Ceph distributed object
+ store.
+
+ More information at http://ceph.newdream.net/.
+
+ If unsure, say N.
+
endif # BLK_DEV

drivers/block/Makefile

View file
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index aff5ac9..d7f463d 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -37,5 +37,6 @@ obj-$(CONFIG_BLK_DEV_HD) += hd.o
obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
+obj-$(CONFIG_BLK_DEV_RBD) += rbd.o
swim_mod-objs := swim.o swim_asm.o

drivers/block/rbd.c

View file
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
new file mode 100644
index 0000000..6ec9d53
--- /dev/null
+++ b/drivers/block/rbd.c
@@ -0,0 +1,1841 @@
+/*
+ rbd.c -- Export ceph rados objects as a Linux block device
+
+
+ based on drivers/block/osdblk.c:
+
+ Copyright 2009 Red Hat, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+
+ Instructions for use
+ --------------------
+
+ 1) Map a Linux block device to an existing rbd image.
+
+ Usage: <mon ip addr> <options> <pool name> <rbd image name> [snap name]
+
+ $ echo "192.168.0.1 name=admin rbd foo" > /sys/class/rbd/add
+
+ The snapshot name can be "-" or omitted to map the image read/write.
+
+ 2) List all active blkdev<->object mappings.
+
+ In this example, we have performed step #1 twice, creating two blkdevs,
+ mapped to two separate rados objects in the rados rbd pool
+
+ $ cat /sys/class/rbd/list
+ #id major client_name pool name snap KB
+ 0 254 client4143 rbd foo - 1024000
+
+ The columns, in order, are:
+ - blkdev unique id
+ - blkdev assigned major
+ - rados client id
+ - rados pool name
+ - rados block device name
+ - mapped snapshot ("-" if none)
+ - device size in KB
+
+
+ 3) Create a snapshot.
+
+ Usage: <blkdev id> <snapname>
+
+ $ echo "0 mysnap" > /sys/class/rbd/snap_create
+
+
+ 4) Listing a snapshot.
+
+ $ cat /sys/class/rbd/snaps_list
+ #id snap KB
+ 0 - 1024000 (*)
+ 0 foo 1024000
+
+ The columns, in order, are:
+ - blkdev unique id
+ - snapshot name, '-' means none (active read/write version)
+ - size of device at time of snapshot
+ - the (*) indicates this is the active version
+
+ 5) Rollback to snapshot.
+
+ Usage: <blkdev id> <snapname>
+
+ $ echo "0 mysnap" > /sys/class/rbd/snap_rollback
+
+
+ 6) Mapping an image using snapshot.
+
+ A snapshot mapping is read-only. This is being done by passing
+ snap=<snapname> to the options when adding a device.
+
+ $ echo "192.168.0.1 name=admin,snap=mysnap rbd foo" > /sys/class/rbd/add
+
+
+ 7) Remove an active blkdev<->rbd image mapping.
+
+ In this example, we remove the mapping with blkdev unique id 1.
+
+ $ echo 1 > /sys/class/rbd/remove
+
+
+ NOTE: The actual creation and deletion of rados objects is outside the scope
+ of this driver.
+
+ */
+
+#include <linux/ceph/libceph.h>
+#include <linux/ceph/osd_client.h>
+#include <linux/ceph/mon_client.h>
+#include <linux/ceph/decode.h>
+
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/blkdev.h>
+
+#include "rbd_types.h"
+
+#define DRV_NAME "rbd"
+#define DRV_NAME_LONG "rbd (rados block device)"
+
+#define RBD_MINORS_PER_MAJOR 256 /* max minors per blkdev */
+
+#define RBD_MAX_MD_NAME_LEN (96 + sizeof(RBD_SUFFIX))
+#define RBD_MAX_POOL_NAME_LEN 64
+#define RBD_MAX_SNAP_NAME_LEN 32
+#define RBD_MAX_OPT_LEN 1024
+
+#define RBD_SNAP_HEAD_NAME "-"
+
+#define DEV_NAME_LEN 32
+
+/*
+ * block device image metadata (in-memory version)
+ */
+struct rbd_image_header {
+ u64 image_size;
+ char block_name[32];
+ __u8 obj_order;
+ __u8 crypt_type;
+ __u8 comp_type;
+ struct rw_semaphore snap_rwsem;
+ struct ceph_snap_context *snapc;
+ size_t snap_names_len;
+ u64 snap_seq;
+ u32 total_snaps;
+
+ char *snap_names;
+ u64 *snap_sizes;
+};
+
+/*
+ * an instance of the client. multiple devices may share a client.
+ */
+struct rbd_client {
+ struct ceph_client *client;
+ struct kref kref;
+ struct list_head node;
+};
+
+/*
+ * a single io request
+ */
+struct rbd_request {
+ struct request *rq; /* blk layer request */
+ struct bio *bio; /* cloned bio */
+ struct page **pages; /* list of used pages */
+ u64 len;
+};
+
+/*
+ * a single device
+ */
+struct rbd_device {
+ int id; /* blkdev unique id */
+
+ int major; /* blkdev assigned major */
+ struct gendisk *disk; /* blkdev's gendisk and rq */
+ struct request_queue *q;
+
+ struct ceph_client *client;
+ struct rbd_client *rbd_client;
+
+ char name[DEV_NAME_LEN]; /* blkdev name, e.g. rbd3 */
+
+ spinlock_t lock; /* queue lock */
+
+ struct rbd_image_header header;
+ char obj[RBD_MAX_OBJ_NAME_LEN]; /* rbd image name */
+ int obj_len;
+ char obj_md_name[RBD_MAX_MD_NAME_LEN]; /* hdr nm. */
+ char pool_name[RBD_MAX_POOL_NAME_LEN];
+ int poolid;
+
+ char snap_name[RBD_MAX_SNAP_NAME_LEN];
+ u32 cur_snap; /* index+1 of current snapshot within snap context
+ 0 - for the head */
+ int read_only;
+
+ struct list_head node;
+};
+
+static spinlock_t node_lock; /* protects client get/put */
+
+static struct class *class_rbd; /* /sys/class/rbd */
+static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */
+static LIST_HEAD(rbd_dev_list); /* devices */
+static LIST_HEAD(rbd_client_list); /* clients */
+
+
+static int rbd_open(struct block_device *bdev, fmode_t mode)
+{
+ struct gendisk *disk = bdev->bd_disk;
+ struct rbd_device *rbd_dev = disk->private_data;
+
+ set_device_ro(bdev, rbd_dev->read_only);
+
+ if ((mode & FMODE_WRITE) && rbd_dev->read_only)
+ return -EROFS;
+
+ return 0;
+}
+
+static const struct block_device_operations rbd_bd_ops = {
+ .owner = THIS_MODULE,
+ .open = rbd_open,
+};
+
+/*
+ * Initialize an rbd client instance.
+ * We own *opt.
+ */
+static struct rbd_client *rbd_client_create(struct ceph_options *opt)
+{
+ struct rbd_client *rbdc;
+ int ret = -ENOMEM;
+
+ dout("rbd_client_create\n");
+ rbdc = kmalloc(sizeof(struct rbd_client), GFP_KERNEL);
+ if (!rbdc)
+ goto out_opt;
+
+ kref_init(&rbdc->kref);
+ INIT_LIST_HEAD(&rbdc->node);
+
+ rbdc->client = ceph_create_client(opt, rbdc);
+ if (IS_ERR(rbdc->client))
+ goto out_rbdc;
+ opt = NULL; /* Now rbdc->client is responsible for opt */
+
+ ret = ceph_open_session(rbdc->client);
+ if (ret < 0)
+ goto out_err;
+
+ spin_lock(&node_lock);
+ list_add_tail(&rbdc->node, &rbd_client_list);
+ spin_unlock(&node_lock);
+
+ dout("rbd_client_create created %p\n", rbdc);
+ return rbdc;
+
+out_err:
+ ceph_destroy_client(rbdc->client);
+out_rbdc:
+ kfree(rbdc);
+out_opt:
+ if (opt)
+ ceph_destroy_options(opt);
+ return ERR_PTR(ret);
+}
+
+/*
+ * Find a ceph client with specific addr and configuration.
+ */
+static struct rbd_client *__rbd_client_find(struct ceph_options *opt)
+{
+ struct rbd_client *client_node;
+
+ if (opt->flags & CEPH_OPT_NOSHARE)
+ return NULL;
+
+ list_for_each_entry(client_node, &rbd_client_list, node)
+ if (ceph_compare_options(opt, client_node->client) == 0)
+ return client_node;
+ return NULL;
+}
+
+/*
+ * Get a ceph client with specific addr and configuration, if one does
+ * not exist create it.
+ */
+static int rbd_get_client(struct rbd_device *rbd_dev, const char *mon_addr,
+ char *options)
+{
+ struct rbd_client *rbdc;
+ struct ceph_options *opt;
+ int ret;
+
+ ret = ceph_parse_options(&opt, options, mon_addr,
+ mon_addr + strlen(mon_addr), NULL, NULL);
+ if (ret < 0)
+ return ret;
+
+ spin_lock(&node_lock);
+ rbdc = __rbd_client_find(opt);
+ if (rbdc) {
+ ceph_destroy_options(opt);
+
+ /* using an existing client */
+ kref_get(&rbdc->kref);
+ rbd_dev->rbd_client = rbdc;
+ rbd_dev->client = rbdc->client;
+ spin_unlock(&node_lock);
+ return 0;
+ }
+ spin_unlock(&node_lock);
+
+ rbdc = rbd_client_create(opt);
+ if (IS_ERR(rbdc))
+ return PTR_ERR(rbdc);
+
+ rbd_dev->rbd_client = rbdc;
+ rbd_dev->client = rbdc->client;
+ return 0;
+}
+
+/*
+ * Destroy ceph client
+ */
+static void rbd_client_release(struct kref *kref)
+{
+ struct rbd_client *rbdc = container_of(kref, struct rbd_client, kref);
+
+ dout("rbd_release_client %p\n", rbdc);
+ spin_lock(&node_lock);
+ list_del(&rbdc->node);
+ spin_unlock(&node_lock);
+
+ ceph_destroy_client(rbdc->client);
+ kfree(rbdc);
+}
+
+/*
+ * Drop reference to ceph client node. If it's not referenced anymore, release
+ * it.
+ */
+static void rbd_put_client(struct rbd_device *rbd_dev)
+{
+ kref_put(&rbd_dev->rbd_client->kref, rbd_client_release);
+ rbd_dev->rbd_client = NULL;
+ rbd_dev->client = NULL;
+}
+
+
+/*
+ * Create a new header structure, translate header format from the on-disk
+ * header.
+ */
+static int rbd_header_from_disk(struct rbd_image_header *header,
+ struct rbd_image_header_ondisk *ondisk,
+ int allocated_snaps,
+ gfp_t gfp_flags)
+{
+ int i;
+ u32 snap_count = le32_to_cpu(ondisk->snap_count);
+ int ret = -ENOMEM;
+
+ init_rwsem(&header->snap_rwsem);
+
+ header->snap_names_len = le64_to_cpu(ondisk->snap_names_len);
+ header->snapc = kmalloc(sizeof(struct ceph_snap_context) +
+ snap_count *
+ sizeof(struct rbd_image_snap_ondisk),
+ gfp_flags);
+ if (!header->snapc)
+ return -ENOMEM;
+ if (snap_count) {
+ header->snap_names = kmalloc(header->snap_names_len,
+ GFP_KERNEL);
+ if (!header->snap_names)
+ goto err_snapc;
+ header->snap_sizes = kmalloc(snap_count * sizeof(u64),
+ GFP_KERNEL);
+ if (!header->snap_sizes)
+ goto err_names;
+ } else {
+ header->snap_names = NULL;
+ header->snap_sizes = NULL;
+ }
+ memcpy(header->block_name, ondisk->block_name,
+ sizeof(ondisk->block_name));
+
+ header->image_size = le64_to_cpu(ondisk->image_size);
+ header->obj_order = ondisk->options.order;
+ header->crypt_type = ondisk->options.crypt_type;
+ header->comp_type = ondisk->options.comp_type;
+
+ atomic_set(&header->snapc->nref, 1);
+ header->snap_seq = le64_to_cpu(ondisk->snap_seq);
+ header->snapc->num_snaps = snap_count;
+ header->total_snaps = snap_count;
+
+ if (snap_count &&
+ allocated_snaps == snap_count) {
+ for (i = 0; i < snap_count; i++) {
+ header->snapc->snaps[i] =
+ le64_to_cpu(ondisk->snaps[i].id);
+ header->snap_sizes[i] =
+ le64_to_cpu(ondisk->snaps[i].image_size);
+ }
+
+ /* copy snapshot names */
+ memcpy(header->snap_names, &ondisk->snaps[i],
+ header->snap_names_len);
+ }
+
+ return 0;
+
+err_names:
+ kfree(header->snap_names);
+err_snapc:
+ kfree(header->snapc);
+ return ret;
+}
+
+static int snap_index(struct rbd_image_header *header, int snap_num)
+{
+ return header->total_snaps - snap_num;
+}
+
+static u64 cur_snap_id(struct rbd_device *rbd_dev)
+{
+ struct rbd_image_header *header = &rbd_dev->header;
+
+ if (!rbd_dev->cur_snap)
+ return 0;
+
+ return header->snapc->snaps[snap_index(header, rbd_dev->cur_snap)];
+}
+
+static int snap_by_name(struct rbd_image_header *header, const char *snap_name,
+ u64 *seq, u64 *size)
+{
+ int i;
+ char *p = header->snap_names;
+
+ for (i = 0; i < header->total_snaps; i++, p += strlen(p) + 1) {
+ if (strcmp(snap_name, p) == 0)
+ break;
+ }
+ if (i == header->total_snaps)
+ return -ENOENT;
+ if (seq)
+ *seq = header->snapc->snaps[i];
+
+ if (size)
+ *size = header->snap_sizes[i];
+
+ return i;
+}
+
+static int rbd_header_set_snap(struct rbd_device *dev,
+ const char *snap_name,
+ u64 *size)
+{
+ struct rbd_image_header *header = &dev->header;
+ struct ceph_snap_context *snapc = header->snapc;
+ int ret = -ENOENT;
+
+ down_write(&header->snap_rwsem);
+
+ if (!snap_name ||
+ !*snap_name ||
+ strcmp(snap_name, "-") == 0 ||
+ strcmp(snap_name, RBD_SNAP_HEAD_NAME) == 0) {
+ if (header->total_snaps)
+ snapc->seq = header->snap_seq;
+ else
+ snapc->seq = 0;
+ dev->cur_snap = 0;
+ dev->read_only = 0;
+ if (size)
+ *size = header->image_size;
+ } else {
+ ret = snap_by_name(header, snap_name, &snapc->seq, size);
+ if (ret < 0)
+ goto done;
+
+ dev->cur_snap = header->total_snaps - ret;
+ dev->read_only = 1;
+ }
+
+ ret = 0;
+done:
+ up_write(&header->snap_rwsem);
+ return ret;
+}
+
+static void rbd_header_free(struct rbd_image_header *header)
+{
+ kfree(header->snapc);
+ kfree(header->snap_names);
+ kfree(header->snap_sizes);
+}
+
+/*
+ * get the actual striped segment name, offset and length
+ */
+static u64 rbd_get_segment(struct rbd_image_header *header,
+ const char *block_name,
+ u64 ofs, u64 len,
+ char *seg_name, u64 *segofs)
+{
+ u64 seg = ofs >> header->obj_order;
+
+ if (seg_name)
+ snprintf(seg_name, RBD_MAX_SEG_NAME_LEN,
+ "%s.%012llx", block_name, seg);
+
+ ofs = ofs & ((1 << header->obj_order) - 1);
+ len = min_t(u64, len, (1 << header->obj_order) - ofs);
+
+ if (segofs)
+ *segofs = ofs;
+
+ return len;
+}
+
+/*
+ * bio helpers
+ */
+
+static void bio_chain_put(struct bio *chain)

This diff is incomplete. Download the complete patch.

drivers/block/rbd_types.h

View file

This diff is incomplete. Download the complete patch.

fs/ceph/Kconfig

View file

This diff is incomplete. Download the complete patch.

fs/ceph/Makefile

View file

This diff is incomplete. Download the complete patch.

fs/ceph/README

View before deletion

This diff is incomplete. Download the complete patch.

fs/ceph/addr.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/caps.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/ceph_frag.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/debugfs.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/export.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/file.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/ioctl.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/ioctl.h

View file

This diff is incomplete. Download the complete patch.

fs/ceph/locks.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/mds_client.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/mds_client.h

View file

This diff is incomplete. Download the complete patch.

fs/ceph/mdsmap.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/snap.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/strings.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/super.c

View file

This diff is incomplete. Download the complete patch.

fs/ceph/super.h

View file

This diff is incomplete. Download the complete patch.

fs/ceph/xattr.c

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/auth.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/buffer.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/ceph_debug.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/ceph_frag.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/ceph_fs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/ceph_hash.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/debugfs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/decode.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/libceph.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/mdsmap.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/messenger.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/mon_client.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/msgpool.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/msgr.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/osd_client.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/osdmap.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/pagelist.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/rados.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ceph/types.h

View file

This diff is incomplete. Download the complete patch.

include/linux/crush/crush.h

View file

This diff is incomplete. Download the complete patch.

include/linux/crush/hash.h

View file

This diff is incomplete. Download the complete patch.

include/linux/crush/mapper.h

View file

This diff is incomplete. Download the complete patch.

net/Kconfig

View file

This diff is incomplete. Download the complete patch.

net/Makefile

View file

This diff is incomplete. Download the complete patch.

net/ceph/Kconfig

View file

This diff is incomplete. Download the complete patch.

net/ceph/Makefile

View file

This diff is incomplete. Download the complete patch.

net/ceph/armor.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/auth.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/auth_none.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/auth_none.h

View file

This diff is incomplete. Download the complete patch.

net/ceph/auth_x.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/auth_x.h

View file

This diff is incomplete. Download the complete patch.

net/ceph/auth_x_protocol.h

View file

This diff is incomplete. Download the complete patch.

net/ceph/buffer.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/ceph_common.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/ceph_fs.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/ceph_hash.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/ceph_strings.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/crush/crush.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/crush/hash.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/crush/mapper.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/crypto.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/crypto.h

View file

This diff is incomplete. Download the complete patch.

net/ceph/debugfs.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/messenger.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/mon_client.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/msgpool.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/osd_client.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/osdmap.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/pagelist.c

View file

This diff is incomplete. Download the complete patch.

net/ceph/pagevec.c

View file

This diff is incomplete. Download the complete patch.