Skip to content

Commit

Permalink
patch non_persistent_enabled.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
amir73il committed May 27, 2010
1 parent 5d244ac commit 9fde69e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
7 changes: 2 additions & 5 deletions fs/next3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3992,15 +3992,12 @@ struct inode *next3_iget(struct super_block *sb, unsigned long ino)
/*
* snapshot size is stored in i_snapshot_blocks_count. in-memory
* i_disksize of snapshot files is set to snapshot size.
* in-memory i_size of disabled snapshot files is set to 0.
* in-memory i_size of snapshot files is set to 0.
*/
ei->i_disksize = le32_to_cpu(
raw_inode->i_snapshot_blocks_count);
ei->i_disksize <<= SNAPSHOT_BLOCK_SIZE_BITS;
if (ei->i_flags & NEXT3_SNAPFILE_ENABLED_FL)
SNAPSHOT_SET_ENABLED(inode);
else
SNAPSHOT_SET_DISABLED(inode);
SNAPSHOT_SET_DISABLED(inode);
}

#ifdef CONFIG_NEXT3_FS_SNAPSHOT_EXCLUDE_INODE
Expand Down
3 changes: 2 additions & 1 deletion fs/next3/next3.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ struct next3_group_desc

/* non-persistent snapshot status flags */
#define NEXT3_FL_SNAPSHOT_DYN_MASK \
(NEXT3_SNAPFILE_LIST_FL|NEXT3_SNAPFILE_ACTIVE_FL| \
(NEXT3_SNAPFILE_LIST_FL|NEXT3_SNAPFILE_ENABLED_FL| \
NEXT3_SNAPFILE_ACTIVE_FL| \
NEXT3_SNAPFILE_OPEN_FL|NEXT3_SNAPFILE_INUSE_FL)

/* snapshot flags visible to lsattr */
Expand Down
2 changes: 1 addition & 1 deletion fs/next3/snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "snapshot_debug.h"


#define NEXT3_SNAPSHOT_VERSION "next3 snapshot v1.0.10 (20-May-2010)"
#define NEXT3_SNAPSHOT_VERSION "next3 snapshot v1.0.10-WIP (24-May-2010)"

/*
* use signed 64bit for snapshot image addresses
Expand Down
15 changes: 8 additions & 7 deletions fs/next3/snapshot_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,12 +1149,9 @@ static int next3_snapshot_enable(struct inode *inode)
return -EINVAL;
}

if ((ei->i_flags & NEXT3_SNAPFILE_DELETED_FL) ||
!(ei->i_flags & NEXT3_SNAPFILE_LIST_FL)) {
snapshot_debug(1, "enable of %s snapshot (%u) "
if (ei->i_flags & NEXT3_SNAPFILE_DELETED_FL) {
snapshot_debug(1, "enable of deleted snapshot (%u) "
"is not permitted\n",
(ei->i_flags & NEXT3_SNAPFILE_DELETED_FL) ?
"deleted" : "detached",
inode->i_generation);
return -EPERM;
}
Expand Down Expand Up @@ -2174,13 +2171,19 @@ int next3_snapshot_update(struct super_block *sb, int cleanup, int read_only)
goto prev_snapshot;
}

deleted = ei->i_flags & NEXT3_SNAPFILE_DELETED_FL;
if (!deleted && read_only)
/* auto enable snapshots on readonly mount */
next3_snapshot_enable(inode);

/*
* after completion of a snapshot management operation,
* only the active snapshot can have the ACTIVE flag
*/
if (inode == active_snapshot) {
ei->i_flags |= NEXT3_SNAPFILE_ACTIVE_FL;
found_active = 1;
deleted = 0;
} else
ei->i_flags &= ~NEXT3_SNAPFILE_ACTIVE_FL;

Expand All @@ -2191,8 +2194,6 @@ int next3_snapshot_update(struct super_block *sb, int cleanup, int read_only)
/* snapshot is not in use by older enabled snapshots */
ei->i_flags &= ~NEXT3_SNAPFILE_INUSE_FL;

deleted = ((ei->i_flags & NEXT3_SNAPFILE_DELETED_FL) &&
!(ei->i_flags & NEXT3_SNAPFILE_ACTIVE_FL));
#ifdef CONFIG_NEXT3_FS_SNAPSHOT_CLEANUP
if (cleanup)
err = next3_snapshot_cleanup(inode, used_by, deleted,
Expand Down

0 comments on commit 9fde69e

Please sign in to comment.