Patch: Add subvol current-generation command
Hey,
this is my first patch against something related to btrfs. The attached patch adds the subvol current-generation command to retrieve the current generation of the given subvol. This is inteded to be used with the subvol find-new command.
After writing this patch I noticed that Sean Reifschneider already sugested something similar in 2010 [1]. His patch reminded me of adding a part to the manpage.
Thanks and Greetings
fabian
--
[1] http://markmail.org/thread/iztosuxysjt4zx2b
Quoted 1 line
From
d7fd192b7e013701560e9abba7a01bb7dbaade18Mon Sep 17 00:00:00 2001
From: Fabian Deutsch <[email protected]>
Date: Sat, 16 Jun 2012 22:50:57 +0200
Subject: [PATCH] btrfs: Add subvol current-generation command
Add a command (current-generation) to get the current generation of a subvolume. This is useful in combination with find-new.
--- btrfs-list.c | 7 +++++++ cmds-subvolume.c | 43 +++++++++++++++++++++++++++++++++++++++++++ man/btrfs.8.in | 8 ++++++++
3 Dateien geändert, 58 Zeilen hinzugefügt(+)
btrfs-list.c +7 -0
@@ -799,6 +799,13 @@ static int print_one_extent(int fd, struct btrfs_ioctl_search_header *sh,return 0 ; } +u64 current_generation (int fd,u64 root_id) +{ +u64 max_found =0 ; + max_found =find_root_gen (fd); +return max_found; +} +int find_updated_files (int fd,u64 root_id,u64 oldest_gen) {int ret;
cmds-subvolume.c +43 -0
61 lines not on this page · raw message
man/btrfs.8.in +8 -0
@@ -25,6 +25,8 @@ btrfs \- control a btrfs filesystem .PP \fBbtrfs\fP \fBfilesystem defrag\fP\fI [options] <file>|<dir> [<file>|<dir>...]\fP .PP +\fBbtrfs\fP \fBsubvolume current-generation\fP\fI <subvolume>\fP +.PP \fBbtrfs\fP \fBsubvolume find-new\fP\fI <subvolume> <last_gen>\fP .PP \fBbtrfs\fP \fBfilesystem balance\fP\fI <path> \fP
@@ -154,6 +156,12 @@ The start position and the number of bytes to deframention can be specified by \ NOTE: defragmenting with kernels up to 2.6.37 will unlink COW-ed copies of data, don't use it if you use snapshots, have de-duplicated your data or made copies with \fBcp --reflink\fP. +.TP + +\fBsubvolume current-generation\fR\fI <subvolume>\fR +Return the current generation used in subvolume \fI<subvolume>\fR. This number can be used with the \fBsubvolume find-new\fR command. +.TP + \fBsubvolume find-new\fR\fI <subvolume> <last_gen>\fR List the recently modified files in a subvolume, after \fI<last_gen>\fR ID. .TP
Signature · 1 line
1.7.10.4