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

Commit 6cccc7d3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ceph updates from Sage Weil:
 "This includes both the first pile of Ceph patches (which I sent to
  torvalds@vger, sigh) and a few new patches that add support for
  fscache for Ceph.  That includes a few fscache core fixes that David
  Howells asked go through the Ceph tree.  (Thanks go to Milosz Tanski
  for putting this feature together)

  This first batch of patches (included here) had (has) several
  important RBD bug fixes, hole punch support, several different
  cleanups in the page cache interactions, improvements in the truncate
  code (new truncate mutex to avoid shenanigans with i_mutex), and a
  series of fixes in the synchronous striping read/write code.

  On top of that is a random collection of small fixes all across the
  tree (error code checks and error path cleanup, obsolete wq flags,
  etc)"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (43 commits)
  ceph: use d_invalidate() to invalidate aliases
  ceph: remove ceph_lookup_inode()
  ceph: trivial buildbot warnings fix
  ceph: Do not do invalidate if the filesystem is mounted nofsc
  ceph: page still marked private_2
  ceph: ceph_readpage_to_fscache didn't check if marked
  ceph: clean PgPrivate2 on returning from readpages
  ceph: use fscache as a local presisent cache
  fscache: Netfs function for cleanup post readpages
  FS-Cache: Fix heading in documentation
  CacheFiles: Implement interface to check cache consistency
  FS-Cache: Add interface to check consistency of a cached object
  rbd: fix null dereference in dout
  rbd: fix buffer size for writes to images with snapshots
  libceph: use pg_num_mask instead of pgp_num_mask for pg.seed calc
  rbd: fix I/O error propagation for reads
  ceph: use vfs __set_page_dirty_nobuffers interface instead of doing it inside filesystem
  ceph: allow sync_read/write return partial successed size of read/write.
  ceph: fix bugs about handling short-read for sync read mode.
  ceph: remove useless variable revoked_rdcache
  ...
parents 255ae3fb a8d436f0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -299,6 +299,15 @@ performed on the denizens of the cache. These are held in a structure of type:
     enough space in the cache to permit this.


 (*) Check coherency state of an object [mandatory]:

	int (*check_consistency)(struct fscache_object *object)

     This method is called to have the cache check the saved auxiliary data of
     the object against the netfs's idea of the state.  0 should be returned
     if they're consistent and -ESTALE otherwise.  -ENOMEM and -ERESTARTSYS
     may also be returned.

 (*) Update object [mandatory]:

	int (*update_object)(struct fscache_object *object)
+31 −6
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ This document contains the following sections:
	 (9) Setting the data file size
	(10) Page alloc/read/write
	(11) Page uncaching
	(12) Index and data file update
	(12) Index and data file consistency
	(13) Miscellaneous cookie operations
	(14) Cookie unregistration
	(15) Index invalidation
@@ -433,7 +433,7 @@ to the caller. The attribute adjustment excludes read and write operations.


=====================
PAGE READ/ALLOC/WRITE
PAGE ALLOC/READ/WRITE
=====================

And the sixth step is to store and retrieve pages in the cache.  There are
@@ -499,7 +499,7 @@ Else if there's a copy of the page resident in the cache:
     (*) An argument that's 0 on success or negative for an error code.

     If an error occurs, it should be assumed that the page contains no usable
     data.
     data.  fscache_readpages_cancel() may need to be called.

     end_io_func() will be called in process context if the read is results in
     an error, but it might be called in interrupt context if the read is
@@ -623,6 +623,22 @@ some of the pages being read and some being allocated. Those pages will have
been marked appropriately and will need uncaching.


CANCELLATION OF UNREAD PAGES
----------------------------

If one or more pages are passed to fscache_read_or_alloc_pages() but not then
read from the cache and also not read from the underlying filesystem then
those pages will need to have any marks and reservations removed.  This can be
done by calling:

	void fscache_readpages_cancel(struct fscache_cookie *cookie,
				      struct list_head *pages);

prior to returning to the caller.  The cookie argument should be as passed to
fscache_read_or_alloc_pages().  Every page in the pages list will be examined
and any that have PG_fscache set will be uncached.


==============
PAGE UNCACHING
==============
@@ -690,9 +706,18 @@ written to the cache and for the cache to finish with the page generally. No
error is returned.


==========================
INDEX AND DATA FILE UPDATE
==========================
===============================
INDEX AND DATA FILE CONSISTENCY
===============================

To find out whether auxiliary data for an object is up to data within the
cache, the following function can be called:

	int fscache_check_consistency(struct fscache_cookie *cookie)

This will call back to the netfs to check whether the auxiliary data associated
with a cookie is correct.  It returns 0 if it is and -ESTALE if it isn't; it
may also return -ENOMEM and -ERESTARTSYS.

To request an update of the index data for an index or other object, the
following function should be called:
+19 −17
Original line number Diff line number Diff line
@@ -1561,11 +1561,12 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
		obj_request, obj_request->img_request, obj_request->result,
		xferred, length);
	/*
	 * ENOENT means a hole in the image.  We zero-fill the
	 * entire length of the request.  A short read also implies
	 * zero-fill to the end of the request.  Either way we
	 * update the xferred count to indicate the whole request
	 * was satisfied.
	 * ENOENT means a hole in the image.  We zero-fill the entire
	 * length of the request.  A short read also implies zero-fill
	 * to the end of the request.  An error requires the whole
	 * length of the request to be reported finished with an error
	 * to the block layer.  In each case we update the xferred
	 * count to indicate the whole request was satisfied.
	 */
	rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
	if (obj_request->result == -ENOENT) {
@@ -1574,14 +1575,13 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
		else
			zero_pages(obj_request->pages, 0, length);
		obj_request->result = 0;
		obj_request->xferred = length;
	} else if (xferred < length && !obj_request->result) {
		if (obj_request->type == OBJ_REQUEST_BIO)
			zero_bio_chain(obj_request->bio_list, xferred);
		else
			zero_pages(obj_request->pages, xferred, length);
		obj_request->xferred = length;
	}
	obj_request->xferred = length;
	obj_request_done_set(obj_request);
}

@@ -2167,9 +2167,9 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
	struct rbd_obj_request *obj_request = NULL;
	struct rbd_obj_request *next_obj_request;
	bool write_request = img_request_write_test(img_request);
	struct bio *bio_list = 0;
	struct bio *bio_list = NULL;
	unsigned int bio_offset = 0;
	struct page **pages = 0;
	struct page **pages = NULL;
	u64 img_offset;
	u64 resid;
	u16 opcode;
@@ -2207,6 +2207,11 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
		rbd_segment_name_free(object_name);
		if (!obj_request)
			goto out_unwind;
		/*
		 * set obj_request->img_request before creating the
		 * osd_request so that it gets the right snapc
		 */
		rbd_img_obj_request_add(img_request, obj_request);

		if (type == OBJ_REQUEST_BIO) {
			unsigned int clone_size;
@@ -2248,11 +2253,6 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
					obj_request->pages, length,
					offset & ~PAGE_MASK, false, false);

		/*
		 * set obj_request->img_request before formatting
		 * the osd_request so that it gets the right snapc
		 */
		rbd_img_obj_request_add(img_request, obj_request);
		if (write_request)
			rbd_osd_req_format_write(obj_request);
		else
@@ -3706,12 +3706,14 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id,
	if (ret < sizeof (size_buf))
		return -ERANGE;

	if (order)
	if (order) {
		*order = size_buf.order;
		dout("  order %u", (unsigned int)*order);
	}
	*snap_size = le64_to_cpu(size_buf.size);

	dout("  snap_id 0x%016llx order = %u, snap_size = %llu\n",
		(unsigned long long)snap_id, (unsigned int)*order,
	dout("  snap_id 0x%016llx snap_size = %llu\n",
		(unsigned long long)snap_id,
		(unsigned long long)*snap_size);

	return 0;
+26 −0
Original line number Diff line number Diff line
@@ -377,6 +377,31 @@ static void cachefiles_sync_cache(struct fscache_cache *_cache)
				    ret);
}

/*
 * check if the backing cache is updated to FS-Cache
 * - called by FS-Cache when evaluates if need to invalidate the cache
 */
static bool cachefiles_check_consistency(struct fscache_operation *op)
{
	struct cachefiles_object *object;
	struct cachefiles_cache *cache;
	const struct cred *saved_cred;
	int ret;

	_enter("{OBJ%x}", op->object->debug_id);

	object = container_of(op->object, struct cachefiles_object, fscache);
	cache = container_of(object->fscache.cache,
			     struct cachefiles_cache, cache);

	cachefiles_begin_secure(cache, &saved_cred);
	ret = cachefiles_check_auxdata(object);
	cachefiles_end_secure(cache, saved_cred);

	_leave(" = %d", ret);
	return ret;
}

/*
 * notification the attributes on an object have changed
 * - called with reads/writes excluded by FS-Cache
@@ -522,4 +547,5 @@ const struct fscache_cache_ops cachefiles_cache_ops = {
	.write_page		= cachefiles_write_page,
	.uncache_page		= cachefiles_uncache_page,
	.dissociate_pages	= cachefiles_dissociate_pages,
	.check_consistency	= cachefiles_check_consistency,
};
+1 −0
Original line number Diff line number Diff line
@@ -235,6 +235,7 @@ extern int cachefiles_set_object_xattr(struct cachefiles_object *object,
				       struct cachefiles_xattr *auxdata);
extern int cachefiles_update_object_xattr(struct cachefiles_object *object,
					  struct cachefiles_xattr *auxdata);
extern int cachefiles_check_auxdata(struct cachefiles_object *object);
extern int cachefiles_check_object_xattr(struct cachefiles_object *object,
					 struct cachefiles_xattr *auxdata);
extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,
Loading