Skip to content

Commit 9556971

Browse files
ukernelidryomov
authored andcommitted
ceph: new cap message flags indicate if there is pending capsnap
These flags tell mds if there is pending capsnap explicitly. Without this explicit notification, mds can only conclude if client has pending capsnap. The method mds use is inefficient and error-prone. Signed-off-by: "Yan, Zheng" <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 3fb99d4 commit 9556971

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

fs/ceph/caps.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,10 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
12481248
arg.mode = inode->i_mode;
12491249

12501250
arg.inline_data = ci->i_inline_version != CEPH_INLINE_NONE;
1251-
arg.flags = 0;
1251+
if (list_empty(&ci->i_cap_snaps))
1252+
arg.flags = CEPH_CLIENT_CAPS_NO_CAPSNAP;
1253+
else
1254+
arg.flags = CEPH_CLIENT_CAPS_PENDING_CAPSNAP;
12521255
if (sync)
12531256
arg.flags |= CEPH_CLIENT_CAPS_SYNC;
12541257

include/linux/ceph/ceph_fs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,9 @@ enum {
669669
extern const char *ceph_cap_op_name(int op);
670670

671671
/* flags field in client cap messages (version >= 10) */
672-
#define CEPH_CLIENT_CAPS_SYNC (0x1)
672+
#define CEPH_CLIENT_CAPS_SYNC (1<<0)
673+
#define CEPH_CLIENT_CAPS_NO_CAPSNAP (1<<1)
674+
#define CEPH_CLIENT_CAPS_PENDING_CAPSNAP (1<<2);
673675

674676
/*
675677
* caps message, used for capability callbacks, acks, requests, etc.

0 commit comments

Comments
 (0)