Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7035cdf3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ceph updates from Sage Weil:
 "The bulk of this pull is a series from Alex that refactors and cleans
  up the RBD code to lay the groundwork for supporting the new image
  format and evolving feature set.  There are also some cleanups in
  libceph, and for ceph there's fixed validation of file striping
  layouts and a bugfix in the code handling a shrinking MDS cluster."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (71 commits)
  ceph: avoid 32-bit page index overflow
  ceph: return EIO on invalid layout on GET_DATALOC ioctl
  rbd: BUG on invalid layout
  ceph: propagate layout error on osd request creation
  libceph: check for invalid mapping
  ceph: convert to use le32_add_cpu()
  ceph: Fix oops when handling mdsmap that decreases max_mds
  rbd: update remaining header fields for v2
  rbd: get snapshot name for a v2 image
  rbd: get the snapshot context for a v2 image
  rbd: get image features for a v2 image
  rbd: get the object prefix for a v2 rbd image
  rbd: add code to get the size of a v2 rbd image
  rbd: lay out header probe infrastructure
  rbd: encapsulate code that gets snapshot info
  rbd: add an rbd features field
  rbd: don't use index in __rbd_add_snap_dev()
  rbd: kill create_snap sysfs entry
  rbd: define rbd_dev_image_id()
  rbd: define some new format constants
  ...
parents 6432f212 6285bc23
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@ client_id

	The ceph unique client id that was assigned for this specific session.

features

	A hexadecimal encoding of the feature bits for this image.

major

	The block device major number.
@@ -33,6 +37,11 @@ name

	The name of the rbd image.

image_id

	The unique id for the rbd image.  (For rbd image format 1
	this is empty.)

pool

	The name of the storage pool where this rbd image resides.
@@ -57,12 +66,6 @@ current_snap

	The current snapshot for which the device is mapped.

create_snap

	Create a snapshot:

	 $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_create

snap_*

	A directory per each snapshot
@@ -79,4 +82,7 @@ snap_size

	The size of the image when this snapshot was taken.

snap_features

	A hexadecimal encoding of the feature bits for this snapshot.
+1169 −621

File changed.

Preview size limit exceeded, changes collapsed.

+21 −6
Original line number Diff line number Diff line
@@ -15,15 +15,30 @@

#include <linux/types.h>

/* For format version 2, rbd image 'foo' consists of objects
 *   rbd_id.foo		- id of image
 *   rbd_header.<id>	- image metadata
 *   rbd_data.<id>.0000000000000000
 *   rbd_data.<id>.0000000000000001
 *   ...		- data
 * Clients do not access header data directly in rbd format 2.
 */

#define RBD_HEADER_PREFIX      "rbd_header."
#define RBD_DATA_PREFIX        "rbd_data."
#define RBD_ID_PREFIX          "rbd_id."

/*
 * rbd image 'foo' consists of objects
 * For format version 1, rbd image 'foo' consists of objects
 *   foo.rbd		- image metadata
 *   foo.00000000
 *   foo.00000001
 *   rb.<idhi>.<idlo>.00000000
 *   rb.<idhi>.<idlo>.00000001
 *   ...		- data
 * There is no notion of a persistent image id in rbd format 1.
 */

#define RBD_SUFFIX		".rbd"

#define RBD_DIRECTORY           "rbd_directory"
#define RBD_INFO                "rbd_info"

@@ -47,7 +62,7 @@ struct rbd_image_snap_ondisk {

struct rbd_image_header_ondisk {
	char text[40];
	char block_name[24];
	char object_prefix[24];
	char signature[4];
	char version[8];
	struct {
+9 −10
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ static int readpage_nounlock(struct file *filp, struct page *page)
	dout("readpage inode %p file %p page %p index %lu\n",
	     inode, filp, page, page->index);
	err = ceph_osdc_readpages(osdc, ceph_vino(inode), &ci->i_layout,
				  page->index << PAGE_CACHE_SHIFT, &len,
				  (u64) page_offset(page), &len,
				  ci->i_truncate_seq, ci->i_truncate_size,
				  &page, 1, 0);
	if (err == -ENOENT)
@@ -286,7 +286,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
	int nr_pages = 0;
	int ret;

	off = page->index << PAGE_CACHE_SHIFT;
	off = (u64) page_offset(page);

	/* count pages */
	next_index = page->index;
@@ -308,8 +308,8 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
				    NULL, 0,
				    ci->i_truncate_seq, ci->i_truncate_size,
				    NULL, false, 1, 0);
	if (!req)
		return -ENOMEM;
	if (IS_ERR(req))
		return PTR_ERR(req);

	/* build page vector */
	nr_pages = len >> PAGE_CACHE_SHIFT;
@@ -426,7 +426,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
	struct ceph_inode_info *ci;
	struct ceph_fs_client *fsc;
	struct ceph_osd_client *osdc;
	loff_t page_off = page->index << PAGE_CACHE_SHIFT;
	loff_t page_off = page_offset(page);
	int len = PAGE_CACHE_SIZE;
	loff_t i_size;
	int err = 0;
@@ -817,8 +817,7 @@ static int ceph_writepages_start(struct address_space *mapping,
			/* ok */
			if (locked_pages == 0) {
				/* prepare async write request */
				offset = (unsigned long long)page->index
					<< PAGE_CACHE_SHIFT;
				offset = (u64) page_offset(page);
				len = wsize;
				req = ceph_osdc_new_request(&fsc->client->osdc,
					    &ci->i_layout,
@@ -832,8 +831,8 @@ static int ceph_writepages_start(struct address_space *mapping,
					    ci->i_truncate_size,
					    &inode->i_mtime, true, 1, 0);

				if (!req) {
					rc = -ENOMEM;
				if (IS_ERR(req)) {
					rc = PTR_ERR(req);
					unlock_page(page);
					break;
				}
@@ -1180,7 +1179,7 @@ static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
	struct inode *inode = vma->vm_file->f_dentry->d_inode;
	struct page *page = vmf->page;
	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
	loff_t off = page->index << PAGE_CACHE_SHIFT;
	loff_t off = page_offset(page);
	loff_t size, len;
	int ret;

+1 −1
Original line number Diff line number Diff line
@@ -1005,7 +1005,7 @@ static void __queue_cap_release(struct ceph_mds_session *session,

	BUG_ON(msg->front.iov_len + sizeof(*item) > PAGE_CACHE_SIZE);
	head = msg->front.iov_base;
	head->num = cpu_to_le32(le32_to_cpu(head->num) + 1);
	le32_add_cpu(&head->num, 1);
	item = msg->front.iov_base + msg->front.iov_len;
	item->ino = cpu_to_le64(ino);
	item->cap_id = cpu_to_le64(cap_id);
Loading