aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVyacheslav Dubeyko <slava@dubeyko.com>2014-01-23 18:55:23 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 19:37:00 -0500
commitd623a9420c9ae2b748ba458c0e9d59084419fce0 (patch)
tree2433b495dd6a6136be3231a60b325a29ae6fe815
parent4b15d61718f0d1bd3bc32e15bffb25a31c1d5782 (diff)
nilfs2: add comments for ioctls
Add comments for ioctls in fs/nilfs2/ioctl.c file and describe NILFS2 specific ioctls in Documentation/filesystems/nilfs2.txt. Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com> Reviewed-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Cc: Wenliang Fan <fanwlexca@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/filesystems/nilfs2.txt56
-rw-r--r--fs/nilfs2/ioctl.c363
2 files changed, 418 insertions, 1 deletions
diff --git a/Documentation/filesystems/nilfs2.txt b/Documentation/filesystems/nilfs2.txt
index 873a2ab2e9f8..06887d46ccf2 100644
--- a/Documentation/filesystems/nilfs2.txt
+++ b/Documentation/filesystems/nilfs2.txt
@@ -81,6 +81,62 @@ nodiscard(*) The discard/TRIM commands are sent to the underlying
81 block device when blocks are freed. This is useful 81 block device when blocks are freed. This is useful
82 for SSD devices and sparse/thinly-provisioned LUNs. 82 for SSD devices and sparse/thinly-provisioned LUNs.
83 83
84Ioctls
85======
86
87There is some NILFS2 specific functionality which can be accessed by applications
88through the system call interfaces. The list of all NILFS2 specific ioctls are
89shown in the table below.
90
91Table of NILFS2 specific ioctls
92..............................................................................
93 Ioctl Description
94 NILFS_IOCTL_CHANGE_CPMODE Change mode of given checkpoint between
95 checkpoint and snapshot state. This ioctl is
96 used in chcp and mkcp utilities.
97
98 NILFS_IOCTL_DELETE_CHECKPOINT Remove checkpoint from NILFS2 file system.
99 This ioctl is used in rmcp utility.
100
101 NILFS_IOCTL_GET_CPINFO Return info about requested checkpoints. This
102 ioctl is used in lscp utility and by
103 nilfs_cleanerd daemon.
104
105 NILFS_IOCTL_GET_CPSTAT Return checkpoints statistics. This ioctl is
106 used by lscp, rmcp utilities and by
107 nilfs_cleanerd daemon.
108
109 NILFS_IOCTL_GET_SUINFO Return segment usage info about requested
110 segments. This ioctl is used in lssu,
111 nilfs_resize utilities and by nilfs_cleanerd
112 daemon.
113
114 NILFS_IOCTL_GET_SUSTAT Return segment usage statistics. This ioctl
115 is used in lssu, nilfs_resize utilities and
116 by nilfs_cleanerd daemon.
117
118 NILFS_IOCTL_GET_VINFO Return information on virtual block addresses.
119 This ioctl is used by nilfs_cleanerd daemon.
120
121 NILFS_IOCTL_GET_BDESCS Return information about descriptors of disk
122 block numbers. This ioctl is used by
123 nilfs_cleanerd daemon.
124
125 NILFS_IOCTL_CLEAN_SEGMENTS Do garbage collection operation in the
126 environment of requested parameters from
127 userspace. This ioctl is used by
128 nilfs_cleanerd daemon.
129
130 NILFS_IOCTL_SYNC Make a checkpoint. This ioctl is used in
131 mkcp utility.
132
133 NILFS_IOCTL_RESIZE Resize NILFS2 volume. This ioctl is used
134 by nilfs_resize utility.
135
136 NILFS_IOCTL_SET_ALLOC_RANGE Define lower limit of segments in bytes and
137 upper limit of segments in bytes. This ioctl
138 is used by nilfs_resize utility.
139
84NILFS2 usage 140NILFS2 usage
85============ 141============
86 142
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index d22281d60071..2b34021948e4 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -37,7 +37,26 @@
37#include "sufile.h" 37#include "sufile.h"
38#include "dat.h" 38#include "dat.h"
39 39
40 40/**
41 * nilfs_ioctl_wrap_copy - wrapping function of get/set metadata info
42 * @nilfs: nilfs object
43 * @argv: vector of arguments from userspace
44 * @dir: set of direction flags
45 * @dofunc: concrete function of get/set metadata info
46 *
47 * Description: nilfs_ioctl_wrap_copy() gets/sets metadata info by means of
48 * calling dofunc() function on the basis of @argv argument.
49 *
50 * Return Value: On success, 0 is returned and requested metadata info
51 * is copied into userspace. On error, one of the following
52 * negative error codes is returned.
53 *
54 * %-EINVAL - Invalid arguments from userspace.
55 *
56 * %-ENOMEM - Insufficient amount of memory available.
57 *
58 * %-EFAULT - Failure during execution of requested operation.
59 */
41static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs, 60static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
42 struct nilfs_argv *argv, int dir, 61 struct nilfs_argv *argv, int dir,
43 ssize_t (*dofunc)(struct the_nilfs *, 62 ssize_t (*dofunc)(struct the_nilfs *,
@@ -107,6 +126,9 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
107 return ret; 126 return ret;
108} 127}
109 128
129/**
130 * nilfs_ioctl_getflags - ioctl to support lsattr
131 */
110static int nilfs_ioctl_getflags(struct inode *inode, void __user *argp) 132static int nilfs_ioctl_getflags(struct inode *inode, void __user *argp)
111{ 133{
112 unsigned int flags = NILFS_I(inode)->i_flags & FS_FL_USER_VISIBLE; 134 unsigned int flags = NILFS_I(inode)->i_flags & FS_FL_USER_VISIBLE;
@@ -114,6 +136,9 @@ static int nilfs_ioctl_getflags(struct inode *inode, void __user *argp)
114 return put_user(flags, (int __user *)argp); 136 return put_user(flags, (int __user *)argp);
115} 137}
116 138
139/**
140 * nilfs_ioctl_setflags - ioctl to support chattr
141 */
117static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp, 142static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp,
118 void __user *argp) 143 void __user *argp)
119{ 144{
@@ -166,11 +191,33 @@ out:
166 return ret; 191 return ret;
167} 192}
168 193
194/**
195 * nilfs_ioctl_getversion - get info about a file's version (generation number)
196 */
169static int nilfs_ioctl_getversion(struct inode *inode, void __user *argp) 197static int nilfs_ioctl_getversion(struct inode *inode, void __user *argp)
170{ 198{
171 return put_user(inode->i_generation, (int __user *)argp); 199 return put_user(inode->i_generation, (int __user *)argp);
172} 200}
173 201
202/**
203 * nilfs_ioctl_change_cpmode - change checkpoint mode (checkpoint/snapshot)
204 * @inode: inode object
205 * @filp: file object
206 * @cmd: ioctl's request code
207 * @argp: pointer on argument from userspace
208 *
209 * Description: nilfs_ioctl_change_cpmode() function changes mode of
210 * given checkpoint between checkpoint and snapshot state. This ioctl
211 * is used in chcp and mkcp utilities.
212 *
213 * Return Value: On success, 0 is returned and mode of a checkpoint is
214 * changed. On error, one of the following negative error codes
215 * is returned.
216 *
217 * %-EPERM - Operation not permitted.
218 *
219 * %-EFAULT - Failure during checkpoint mode changing.
220 */
174static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, 221static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp,
175 unsigned int cmd, void __user *argp) 222 unsigned int cmd, void __user *argp)
176{ 223{
@@ -206,6 +253,25 @@ out:
206 return ret; 253 return ret;
207} 254}
208 255
256/**
257 * nilfs_ioctl_delete_checkpoint - remove checkpoint
258 * @inode: inode object
259 * @filp: file object
260 * @cmd: ioctl's request code
261 * @argp: pointer on argument from userspace
262 *
263 * Description: nilfs_ioctl_delete_checkpoint() function removes
264 * checkpoint from NILFS2 file system. This ioctl is used in rmcp
265 * utility.
266 *
267 * Return Value: On success, 0 is returned and a checkpoint is
268 * removed. On error, one of the following negative error codes
269 * is returned.
270 *
271 * %-EPERM - Operation not permitted.
272 *
273 * %-EFAULT - Failure during checkpoint removing.
274 */
209static int 275static int
210nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp, 276nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp,
211 unsigned int cmd, void __user *argp) 277 unsigned int cmd, void __user *argp)
@@ -237,6 +303,21 @@ out:
237 return ret; 303 return ret;
238} 304}
239 305
306/**
307 * nilfs_ioctl_do_get_cpinfo - callback method getting info about checkpoints
308 * @nilfs: nilfs object
309 * @posp: pointer on array of checkpoint's numbers
310 * @flags: checkpoint mode (checkpoint or snapshot)
311 * @buf: buffer for storing checkponts' info
312 * @size: size in bytes of one checkpoint info item in array
313 * @nmembs: number of checkpoints in array (numbers and infos)
314 *
315 * Description: nilfs_ioctl_do_get_cpinfo() function returns info about
316 * requested checkpoints. The NILFS_IOCTL_GET_CPINFO ioctl is used in
317 * lscp utility and by nilfs_cleanerd daemon.
318 *
319 * Return value: count of nilfs_cpinfo structures in output buffer.
320 */
240static ssize_t 321static ssize_t
241nilfs_ioctl_do_get_cpinfo(struct the_nilfs *nilfs, __u64 *posp, int flags, 322nilfs_ioctl_do_get_cpinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
242 void *buf, size_t size, size_t nmembs) 323 void *buf, size_t size, size_t nmembs)
@@ -250,6 +331,27 @@ nilfs_ioctl_do_get_cpinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
250 return ret; 331 return ret;
251} 332}
252 333
334/**
335 * nilfs_ioctl_get_cpstat - get checkpoints statistics
336 * @inode: inode object
337 * @filp: file object
338 * @cmd: ioctl's request code
339 * @argp: pointer on argument from userspace
340 *
341 * Description: nilfs_ioctl_get_cpstat() returns information about checkpoints.
342 * The NILFS_IOCTL_GET_CPSTAT ioctl is used by lscp, rmcp utilities
343 * and by nilfs_cleanerd daemon.
344 *
345 * Return Value: On success, 0 is returned, and checkpoints information is
346 * copied into userspace pointer @argp. On error, one of the following
347 * negative error codes is returned.
348 *
349 * %-EIO - I/O error.
350 *
351 * %-ENOMEM - Insufficient amount of memory available.
352 *
353 * %-EFAULT - Failure during getting checkpoints statistics.
354 */
253static int nilfs_ioctl_get_cpstat(struct inode *inode, struct file *filp, 355static int nilfs_ioctl_get_cpstat(struct inode *inode, struct file *filp,
254 unsigned int cmd, void __user *argp) 356 unsigned int cmd, void __user *argp)
255{ 357{
@@ -268,6 +370,21 @@ static int nilfs_ioctl_get_cpstat(struct inode *inode, struct file *filp,
268 return ret; 370 return ret;
269} 371}
270 372
373/**
374 * nilfs_ioctl_do_get_suinfo - callback method getting segment usage info
375 * @nilfs: nilfs object
376 * @posp: pointer on array of segment numbers
377 * @flags: *not used*
378 * @buf: buffer for storing suinfo array
379 * @size: size in bytes of one suinfo item in array
380 * @nmembs: count of segment numbers and suinfos in array
381 *
382 * Description: nilfs_ioctl_do_get_suinfo() function returns segment usage
383 * info about requested segments. The NILFS_IOCTL_GET_SUINFO ioctl is used
384 * in lssu, nilfs_resize utilities and by nilfs_cleanerd daemon.
385 *
386 * Return value: count of nilfs_suinfo structures in output buffer.
387 */
271static ssize_t 388static ssize_t
272nilfs_ioctl_do_get_suinfo(struct the_nilfs *nilfs, __u64 *posp, int flags, 389nilfs_ioctl_do_get_suinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
273 void *buf, size_t size, size_t nmembs) 390 void *buf, size_t size, size_t nmembs)
@@ -281,6 +398,27 @@ nilfs_ioctl_do_get_suinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
281 return ret; 398 return ret;
282} 399}
283 400
401/**
402 * nilfs_ioctl_get_sustat - get segment usage statistics
403 * @inode: inode object
404 * @filp: file object
405 * @cmd: ioctl's request code
406 * @argp: pointer on argument from userspace
407 *
408 * Description: nilfs_ioctl_get_sustat() returns segment usage statistics.
409 * The NILFS_IOCTL_GET_SUSTAT ioctl is used in lssu, nilfs_resize utilities
410 * and by nilfs_cleanerd daemon.
411 *
412 * Return Value: On success, 0 is returned, and segment usage information is
413 * copied into userspace pointer @argp. On error, one of the following
414 * negative error codes is returned.
415 *
416 * %-EIO - I/O error.
417 *
418 * %-ENOMEM - Insufficient amount of memory available.
419 *
420 * %-EFAULT - Failure during getting segment usage statistics.
421 */
284static int nilfs_ioctl_get_sustat(struct inode *inode, struct file *filp, 422static int nilfs_ioctl_get_sustat(struct inode *inode, struct file *filp,
285 unsigned int cmd, void __user *argp) 423 unsigned int cmd, void __user *argp)
286{ 424{
@@ -299,6 +437,21 @@ static int nilfs_ioctl_get_sustat(struct inode *inode, struct file *filp,
299 return ret; 437 return ret;
300} 438}
301 439
440/**
441 * nilfs_ioctl_do_get_vinfo - callback method getting virtual blocks info
442 * @nilfs: nilfs object
443 * @posp: *not used*
444 * @flags: *not used*
445 * @buf: buffer for storing array of nilfs_vinfo structures
446 * @size: size in bytes of one vinfo item in array
447 * @nmembs: count of vinfos in array
448 *
449 * Description: nilfs_ioctl_do_get_vinfo() function returns information
450 * on virtual block addresses. The NILFS_IOCTL_GET_VINFO ioctl is used
451 * by nilfs_cleanerd daemon.
452 *
453 * Return value: count of nilfs_vinfo structures in output buffer.
454 */
302static ssize_t 455static ssize_t
303nilfs_ioctl_do_get_vinfo(struct the_nilfs *nilfs, __u64 *posp, int flags, 456nilfs_ioctl_do_get_vinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
304 void *buf, size_t size, size_t nmembs) 457 void *buf, size_t size, size_t nmembs)
@@ -311,6 +464,21 @@ nilfs_ioctl_do_get_vinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
311 return ret; 464 return ret;
312} 465}
313 466
467/**
468 * nilfs_ioctl_do_get_bdescs - callback method getting disk block descriptors
469 * @nilfs: nilfs object
470 * @posp: *not used*
471 * @flags: *not used*
472 * @buf: buffer for storing array of nilfs_bdesc structures
473 * @size: size in bytes of one bdesc item in array
474 * @nmembs: count of bdescs in array
475 *
476 * Description: nilfs_ioctl_do_get_bdescs() function returns information
477 * about descriptors of disk block numbers. The NILFS_IOCTL_GET_BDESCS ioctl
478 * is used by nilfs_cleanerd daemon.
479 *
480 * Return value: count of nilfs_bdescs structures in output buffer.
481 */
314static ssize_t 482static ssize_t
315nilfs_ioctl_do_get_bdescs(struct the_nilfs *nilfs, __u64 *posp, int flags, 483nilfs_ioctl_do_get_bdescs(struct the_nilfs *nilfs, __u64 *posp, int flags,
316 void *buf, size_t size, size_t nmembs) 484 void *buf, size_t size, size_t nmembs)
@@ -337,6 +505,29 @@ nilfs_ioctl_do_get_bdescs(struct the_nilfs *nilfs, __u64 *posp, int flags,
337 return nmembs; 505 return nmembs;
338} 506}
339 507
508/**
509 * nilfs_ioctl_get_bdescs - get disk block descriptors
510 * @inode: inode object
511 * @filp: file object
512 * @cmd: ioctl's request code
513 * @argp: pointer on argument from userspace
514 *
515 * Description: nilfs_ioctl_do_get_bdescs() function returns information
516 * about descriptors of disk block numbers. The NILFS_IOCTL_GET_BDESCS ioctl
517 * is used by nilfs_cleanerd daemon.
518 *
519 * Return Value: On success, 0 is returned, and disk block descriptors are
520 * copied into userspace pointer @argp. On error, one of the following
521 * negative error codes is returned.
522 *
523 * %-EINVAL - Invalid arguments from userspace.
524 *
525 * %-EIO - I/O error.
526 *
527 * %-ENOMEM - Insufficient amount of memory available.
528 *
529 * %-EFAULT - Failure during getting disk block descriptors.
530 */
340static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp, 531static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp,
341 unsigned int cmd, void __user *argp) 532 unsigned int cmd, void __user *argp)
342{ 533{
@@ -360,6 +551,26 @@ static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp,
360 return ret; 551 return ret;
361} 552}
362 553
554/**
555 * nilfs_ioctl_move_inode_block - prepare data/node block for moving by GC
556 * @inode: inode object
557 * @vdesc: descriptor of virtual block number
558 * @buffers: list of moving buffers
559 *
560 * Description: nilfs_ioctl_move_inode_block() function registers data/node
561 * buffer in the GC pagecache and submit read request.
562 *
563 * Return Value: On success, 0 is returned. On error, one of the following
564 * negative error codes is returned.
565 *
566 * %-EIO - I/O error.
567 *
568 * %-ENOMEM - Insufficient amount of memory available.
569 *
570 * %-ENOENT - Requested block doesn't exist.
571 *
572 * %-EEXIST - Blocks conflict is detected.
573 */
363static int nilfs_ioctl_move_inode_block(struct inode *inode, 574static int nilfs_ioctl_move_inode_block(struct inode *inode,
364 struct nilfs_vdesc *vdesc, 575 struct nilfs_vdesc *vdesc,
365 struct list_head *buffers) 576 struct list_head *buffers)
@@ -405,6 +616,19 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,
405 return 0; 616 return 0;
406} 617}
407 618
619/**
620 * nilfs_ioctl_move_blocks - move valid inode's blocks during garbage collection
621 * @sb: superblock object
622 * @argv: vector of arguments from userspace
623 * @buf: array of nilfs_vdesc structures
624 *
625 * Description: nilfs_ioctl_move_blocks() function reads valid data/node
626 * blocks that garbage collector specified with the array of nilfs_vdesc
627 * structures and stores them into page caches of GC inodes.
628 *
629 * Return Value: Number of processed nilfs_vdesc structures or
630 * error code, otherwise.
631 */
408static int nilfs_ioctl_move_blocks(struct super_block *sb, 632static int nilfs_ioctl_move_blocks(struct super_block *sb,
409 struct nilfs_argv *argv, void *buf) 633 struct nilfs_argv *argv, void *buf)
410{ 634{
@@ -470,6 +694,25 @@ static int nilfs_ioctl_move_blocks(struct super_block *sb,
470 return ret; 694 return ret;
471} 695}
472 696
697/**
698 * nilfs_ioctl_delete_checkpoints - delete checkpoints
699 * @nilfs: nilfs object
700 * @argv: vector of arguments from userspace
701 * @buf: array of periods of checkpoints numbers
702 *
703 * Description: nilfs_ioctl_delete_checkpoints() function deletes checkpoints
704 * in the period from p_start to p_end, excluding p_end itself. The checkpoints
705 * which have been already deleted are ignored.
706 *
707 * Return Value: Number of processed nilfs_period structures or
708 * error code, otherwise.
709 *
710 * %-EIO - I/O error.
711 *
712 * %-ENOMEM - Insufficient amount of memory available.
713 *
714 * %-EINVAL - invalid checkpoints.
715 */
473static int nilfs_ioctl_delete_checkpoints(struct the_nilfs *nilfs, 716static int nilfs_ioctl_delete_checkpoints(struct the_nilfs *nilfs,
474 struct nilfs_argv *argv, void *buf) 717 struct nilfs_argv *argv, void *buf)
475{ 718{
@@ -487,6 +730,24 @@ static int nilfs_ioctl_delete_checkpoints(struct the_nilfs *nilfs,
487 return nmembs; 730 return nmembs;
488} 731}
489 732
733/**
734 * nilfs_ioctl_free_vblocknrs - free virtual block numbers
735 * @nilfs: nilfs object
736 * @argv: vector of arguments from userspace
737 * @buf: array of virtual block numbers
738 *
739 * Description: nilfs_ioctl_free_vblocknrs() function frees
740 * the virtual block numbers specified by @buf and @argv->v_nmembs.
741 *
742 * Return Value: Number of processed virtual block numbers or
743 * error code, otherwise.
744 *
745 * %-EIO - I/O error.
746 *
747 * %-ENOMEM - Insufficient amount of memory available.
748 *
749 * %-ENOENT - The virtual block number have not been allocated.
750 */
490static int nilfs_ioctl_free_vblocknrs(struct the_nilfs *nilfs, 751static int nilfs_ioctl_free_vblocknrs(struct the_nilfs *nilfs,
491 struct nilfs_argv *argv, void *buf) 752 struct nilfs_argv *argv, void *buf)
492{ 753{
@@ -498,6 +759,24 @@ static int nilfs_ioctl_free_vblocknrs(struct the_nilfs *nilfs,
498 return (ret < 0) ? ret : nmembs; 759 return (ret < 0) ? ret : nmembs;
499} 760}
500 761
762/**
763 * nilfs_ioctl_mark_blocks_dirty - mark blocks dirty
764 * @nilfs: nilfs object
765 * @argv: vector of arguments from userspace
766 * @buf: array of block descriptors
767 *
768 * Description: nilfs_ioctl_mark_blocks_dirty() function marks
769 * metadata file or data blocks as dirty.
770 *
771 * Return Value: Number of processed block descriptors or
772 * error code, otherwise.
773 *
774 * %-ENOMEM - Insufficient memory available.
775 *
776 * %-EIO - I/O error
777 *
778 * %-ENOENT - the specified block does not exist (hole block)
779 */
501static int nilfs_ioctl_mark_blocks_dirty(struct the_nilfs *nilfs, 780static int nilfs_ioctl_mark_blocks_dirty(struct the_nilfs *nilfs,
502 struct nilfs_argv *argv, void *buf) 781 struct nilfs_argv *argv, void *buf)
503{ 782{
@@ -579,6 +858,20 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
579 return ret; 858 return ret;
580} 859}
581 860
861/**
862 * nilfs_ioctl_clean_segments - clean segments
863 * @inode: inode object
864 * @filp: file object
865 * @cmd: ioctl's request code
866 * @argp: pointer on argument from userspace
867 *
868 * Description: nilfs_ioctl_clean_segments() function makes garbage
869 * collection operation in the environment of requested parameters
870 * from userspace. The NILFS_IOCTL_CLEAN_SEGMENTS ioctl is used by
871 * nilfs_cleanerd daemon.
872 *
873 * Return Value: On success, 0 is returned or error code, otherwise.
874 */
582static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, 875static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
583 unsigned int cmd, void __user *argp) 876 unsigned int cmd, void __user *argp)
584{ 877{
@@ -690,6 +983,33 @@ out:
690 return ret; 983 return ret;
691} 984}
692 985
986/**
987 * nilfs_ioctl_sync - make a checkpoint
988 * @inode: inode object
989 * @filp: file object
990 * @cmd: ioctl's request code
991 * @argp: pointer on argument from userspace
992 *
993 * Description: nilfs_ioctl_sync() function constructs a logical segment
994 * for checkpointing. This function guarantees that all modified data
995 * and metadata are written out to the device when it successfully
996 * returned.
997 *
998 * Return Value: On success, 0 is retured. On errors, one of the following
999 * negative error code is returned.
1000 *
1001 * %-EROFS - Read only filesystem.
1002 *
1003 * %-EIO - I/O error
1004 *
1005 * %-ENOSPC - No space left on device (only in a panic state).
1006 *
1007 * %-ERESTARTSYS - Interrupted.
1008 *
1009 * %-ENOMEM - Insufficient memory available.
1010 *
1011 * %-EFAULT - Failure during execution of requested operation.
1012 */
693static int nilfs_ioctl_sync(struct inode *inode, struct file *filp, 1013static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
694 unsigned int cmd, void __user *argp) 1014 unsigned int cmd, void __user *argp)
695{ 1015{
@@ -718,6 +1038,14 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
718 return 0; 1038 return 0;
719} 1039}
720 1040
1041/**
1042 * nilfs_ioctl_resize - resize NILFS2 volume
1043 * @inode: inode object
1044 * @filp: file object
1045 * @argp: pointer on argument from userspace
1046 *
1047 * Return Value: On success, 0 is returned or error code, otherwise.
1048 */
721static int nilfs_ioctl_resize(struct inode *inode, struct file *filp, 1049static int nilfs_ioctl_resize(struct inode *inode, struct file *filp,
722 void __user *argp) 1050 void __user *argp)
723{ 1051{
@@ -743,6 +1071,17 @@ out:
743 return ret; 1071 return ret;
744} 1072}
745 1073
1074/**
1075 * nilfs_ioctl_set_alloc_range - limit range of segments to be allocated
1076 * @inode: inode object
1077 * @argp: pointer on argument from userspace
1078 *
1079 * Decription: nilfs_ioctl_set_alloc_range() function defines lower limit
1080 * of segments in bytes and upper limit of segments in bytes.
1081 * The NILFS_IOCTL_SET_ALLOC_RANGE is used by nilfs_resize utility.
1082 *
1083 * Return Value: On success, 0 is returned or error code, otherwise.
1084 */
746static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp) 1085static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp)
747{ 1086{
748 struct the_nilfs *nilfs = inode->i_sb->s_fs_info; 1087 struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
@@ -775,6 +1114,28 @@ out:
775 return ret; 1114 return ret;
776} 1115}
777 1116
1117/**
1118 * nilfs_ioctl_get_info - wrapping function of get metadata info
1119 * @inode: inode object
1120 * @filp: file object
1121 * @cmd: ioctl's request code
1122 * @argp: pointer on argument from userspace
1123 * @membsz: size of an item in bytes
1124 * @dofunc: concrete function of getting metadata info
1125 *
1126 * Description: nilfs_ioctl_get_info() gets metadata info by means of
1127 * calling dofunc() function.
1128 *
1129 * Return Value: On success, 0 is returned and requested metadata info
1130 * is copied into userspace. On error, one of the following
1131 * negative error codes is returned.
1132 *
1133 * %-EINVAL - Invalid arguments from userspace.
1134 *
1135 * %-ENOMEM - Insufficient amount of memory available.
1136 *
1137 * %-EFAULT - Failure during execution of requested operation.
1138 */
778static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp, 1139static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp,
779 unsigned int cmd, void __user *argp, 1140 unsigned int cmd, void __user *argp,
780 size_t membsz, 1141 size_t membsz,