From patchwork Tue Jul 2 09:29:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2811441 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F1A409F3EB for ; Tue, 2 Jul 2013 09:29:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 745702014B for ; Tue, 2 Jul 2013 09:29:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E56562013E for ; Tue, 2 Jul 2013 09:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932432Ab3GBJ3T (ORCPT ); Tue, 2 Jul 2013 05:29:19 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:49459 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753623Ab3GBJ3S (ORCPT ); Tue, 2 Jul 2013 05:29:18 -0400 Received: by mail-pb0-f43.google.com with SMTP id md12so5903915pbc.16 for ; Tue, 02 Jul 2013 02:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:reply-to:subject:x-priority:x-guid:x-has-attach :x-mailer:mime-version:message-id:content-type :content-transfer-encoding; bh=u6Z5g9lnapdcXwtZyOJBlyecqYNMP4oFjD8h4xhrrfI=; b=ctDBbr33WlaCr1vWGvM+E8a6aedtwQh/eo4KGRIzUPUt50zYI+tJSLtBznkjMrOoR1 xjfq+oQ3DZVieioNfGuZyQoTRQvvUjuuayhTb9/D6urQk7XvcRf0EMvAcTf4cmBKSNde xXhlIIZ/lUUEcDxRtu1XbVXmyiOxpb8vfJZ/5p0NBHD0kB89Wz5heEatQcbLmBle1eKW MeGeKZypjZZteGB8rphRHXdeJlyx09CgvLAcZiB9G4wb4WC8wPUoms4PsVb7xzfEbnfc 71/ehzeRh6E7nedIHbH/S0qJjPVqS/lEqSxtAgPR2lt66WEoobtnqUgK+VdivwJuFMVr pmEg== X-Received: by 10.68.232.225 with SMTP id tr1mr27710080pbc.143.1372757357895; Tue, 02 Jul 2013 02:29:17 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id x8sm26557223pbb.39.2013.07.02.02.29.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Jul 2013 02:29:16 -0700 (PDT) Date: Tue, 2 Jul 2013 17:29:15 +0800 From: majianpeng To: sage Cc: ceph-devel , linux-kernel Reply-To: majianpeng Subject: [RFC PATCH] ceph: send the ctime of file/snap when send a cap msg. X-Priority: 3 X-GUID: DDB9110B-B11B-476B-A07E-35E299E4755F X-Has-Attach: no X-Mailer: Foxmail 7.0.1.90[en] Mime-Version: 1.0 Message-ID: <201307021700280328740@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now,when sent a cap msg to inode/snap, it don't include the ctime of inode/snap.So make the mtime ahead of ctime. BTY,for snap, i'm not exactly send the ctime of snap or null. Signed-off-by: Jianpeng Ma --- fs/ceph/caps.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 1.8.1.2 diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index da0f9b8..8735108 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -943,7 +943,7 @@ static int send_cap_msg(struct ceph_mds_session *session, u32 seq, u64 flush_tid, u32 issue_seq, u32 mseq, u64 size, u64 max_size, struct timespec *mtime, struct timespec *atime, - u64 time_warp_seq, + struct timespec *ctime, u64 time_warp_seq, kuid_t uid, kgid_t gid, umode_t mode, u64 xattr_version, struct ceph_buffer *xattrs_buf, @@ -986,6 +986,8 @@ static int send_cap_msg(struct ceph_mds_session *session, ceph_encode_timespec(&fc->mtime, mtime); if (atime) ceph_encode_timespec(&fc->atime, atime); + if (ctime) + ceph_encode_timespec(&fc->ctime, ctime); fc->time_warp_seq = cpu_to_le32(time_warp_seq); fc->uid = cpu_to_le32(from_kuid(&init_user_ns, uid)); @@ -1092,7 +1094,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, int held, revoking, dropping, keep; u64 seq, issue_seq, mseq, time_warp_seq, follows; u64 size, max_size; - struct timespec mtime, atime; + struct timespec mtime, atime, ctime; int wake = 0; umode_t mode; kuid_t uid; @@ -1176,6 +1178,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, ci->i_requested_max_size = max_size; mtime = inode->i_mtime; atime = inode->i_atime; + ctime = inode->i_ctime; time_warp_seq = ci->i_time_warp_seq; uid = inode->i_uid; gid = inode->i_gid; @@ -1191,7 +1194,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id, op, keep, want, flushing, seq, flush_tid, issue_seq, mseq, - size, max_size, &mtime, &atime, time_warp_seq, + size, max_size, &mtime, &atime, &ctime, time_warp_seq, uid, gid, mode, xattr_version, xattr_blob, follows); if (ret < 0) { @@ -1310,7 +1313,7 @@ retry: CEPH_CAP_OP_FLUSHSNAP, capsnap->issued, 0, capsnap->dirty, 0, capsnap->flush_tid, 0, mseq, capsnap->size, 0, - &capsnap->mtime, &capsnap->atime, + &capsnap->mtime, &capsnap->atime, &capsnap->ctime, capsnap->time_warp_seq, capsnap->uid, capsnap->gid, capsnap->mode, capsnap->xattr_version, capsnap->xattr_blob,