snap.c (58e16d792a6a8c6b750f637a4649967fcac853dc) snap.c (12fe3dda7ed89c95cc0ef7abc001ad1ad3e092f8)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/sort.h>
5#include <linux/slab.h>
6#include <linux/iversion.h>
7#include "super.h"
8#include "mds_client.h"

--- 451 unchanged lines hidden (view full) ---

460 * Caller must hold snap_rwsem for read (i.e., the realm topology won't
461 * change).
462 */
463void ceph_queue_cap_snap(struct ceph_inode_info *ci)
464{
465 struct inode *inode = &ci->vfs_inode;
466 struct ceph_cap_snap *capsnap;
467 struct ceph_snap_context *old_snapc, *new_snapc;
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/sort.h>
5#include <linux/slab.h>
6#include <linux/iversion.h>
7#include "super.h"
8#include "mds_client.h"

--- 451 unchanged lines hidden (view full) ---

460 * Caller must hold snap_rwsem for read (i.e., the realm topology won't
461 * change).
462 */
463void ceph_queue_cap_snap(struct ceph_inode_info *ci)
464{
465 struct inode *inode = &ci->vfs_inode;
466 struct ceph_cap_snap *capsnap;
467 struct ceph_snap_context *old_snapc, *new_snapc;
468 struct ceph_buffer *old_blob = NULL;
468 int used, dirty;
469
470 capsnap = kzalloc(sizeof(*capsnap), GFP_NOFS);
471 if (!capsnap) {
472 pr_err("ENOMEM allocating ceph_cap_snap on %p\n", inode);
473 return;
474 }
475

--- 60 unchanged lines hidden (view full) ---

536 capsnap->issued = __ceph_caps_issued(ci, NULL);
537 capsnap->dirty = dirty;
538
539 capsnap->mode = inode->i_mode;
540 capsnap->uid = inode->i_uid;
541 capsnap->gid = inode->i_gid;
542
543 if (dirty & CEPH_CAP_XATTR_EXCL) {
469 int used, dirty;
470
471 capsnap = kzalloc(sizeof(*capsnap), GFP_NOFS);
472 if (!capsnap) {
473 pr_err("ENOMEM allocating ceph_cap_snap on %p\n", inode);
474 return;
475 }
476

--- 60 unchanged lines hidden (view full) ---

537 capsnap->issued = __ceph_caps_issued(ci, NULL);
538 capsnap->dirty = dirty;
539
540 capsnap->mode = inode->i_mode;
541 capsnap->uid = inode->i_uid;
542 capsnap->gid = inode->i_gid;
543
544 if (dirty & CEPH_CAP_XATTR_EXCL) {
544 __ceph_build_xattrs_blob(ci);
545 old_blob = __ceph_build_xattrs_blob(ci);
545 capsnap->xattr_blob =
546 ceph_buffer_get(ci->i_xattrs.blob);
547 capsnap->xattr_version = ci->i_xattrs.version;
548 } else {
549 capsnap->xattr_blob = NULL;
550 capsnap->xattr_version = 0;
551 }
552

--- 26 unchanged lines hidden (view full) ---

579 ci->i_flushing_caps == 0) {
580 ci->i_head_snapc = NULL;
581 } else {
582 ci->i_head_snapc = ceph_get_snap_context(new_snapc);
583 dout(" new snapc is %p\n", new_snapc);
584 }
585 spin_unlock(&ci->i_ceph_lock);
586
546 capsnap->xattr_blob =
547 ceph_buffer_get(ci->i_xattrs.blob);
548 capsnap->xattr_version = ci->i_xattrs.version;
549 } else {
550 capsnap->xattr_blob = NULL;
551 capsnap->xattr_version = 0;
552 }
553

--- 26 unchanged lines hidden (view full) ---

580 ci->i_flushing_caps == 0) {
581 ci->i_head_snapc = NULL;
582 } else {
583 ci->i_head_snapc = ceph_get_snap_context(new_snapc);
584 dout(" new snapc is %p\n", new_snapc);
585 }
586 spin_unlock(&ci->i_ceph_lock);
587
588 ceph_buffer_put(old_blob);
587 kfree(capsnap);
588 ceph_put_snap_context(old_snapc);
589}
590
591/*
592 * Finalize the size, mtime for a cap_snap.. that is, settle on final values
593 * to be used for the snapshot, to be flushed back to the mds.
594 *

--- 563 unchanged lines hidden ---
589 kfree(capsnap);
590 ceph_put_snap_context(old_snapc);
591}
592
593/*
594 * Finalize the size, mtime for a cap_snap.. that is, settle on final values
595 * to be used for the snapshot, to be flushed back to the mds.
596 *

--- 563 unchanged lines hidden ---