aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/sufile.h
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-05-16 10:44:55 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-06-10 10:41:09 -0400
commit071cb4b81987a28c7ac2702003cff3e61684a630 (patch)
tree41e2f5a6d0e12d4ccc49850992ce6bfee68dd00e /fs/nilfs2/sufile.h
parentdda54f4b872512eba484c38631bd6ae5b5716f41 (diff)
nilfs2: eliminate removal list of segments
This will clean up the removal list of segments and the related functions from segment.c and ioctl.c, which have hurt code readability. This elimination is applied by using nilfs_sufile_updatev() previously introduced in the patch ("nilfs2: add sufile function that can modify multiple segment usages"). Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/sufile.h')
-rw-r--r--fs/nilfs2/sufile.h56
1 files changed, 34 insertions, 22 deletions
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h
index e8e26279c261..fd6232e365ca 100644
--- a/fs/nilfs2/sufile.h
+++ b/fs/nilfs2/sufile.h
@@ -54,36 +54,16 @@ int nilfs_sufile_update(struct inode *, __u64, int,
54 void (*dofunc)(struct inode *, __u64, 54 void (*dofunc)(struct inode *, __u64,
55 struct buffer_head *, 55 struct buffer_head *,
56 struct buffer_head *)); 56 struct buffer_head *));
57void nilfs_sufile_do_cancel_free(struct inode *, __u64, struct buffer_head *,
58 struct buffer_head *);
59void nilfs_sufile_do_scrap(struct inode *, __u64, struct buffer_head *, 57void nilfs_sufile_do_scrap(struct inode *, __u64, struct buffer_head *,
60 struct buffer_head *); 58 struct buffer_head *);
61void nilfs_sufile_do_free(struct inode *, __u64, struct buffer_head *, 59void nilfs_sufile_do_free(struct inode *, __u64, struct buffer_head *,
62 struct buffer_head *); 60 struct buffer_head *);
61void nilfs_sufile_do_cancel_free(struct inode *, __u64, struct buffer_head *,
62 struct buffer_head *);
63void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *, 63void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *,
64 struct buffer_head *); 64 struct buffer_head *);
65 65
66/** 66/**
67 * nilfs_sufile_cancel_free -
68 * @sufile: inode of segment usage file
69 * @segnum: segment number
70 *
71 * Description:
72 *
73 * Return Value: On success, 0 is returned. On error, one of the following
74 * negative error codes is returned.
75 *
76 * %-EIO - I/O error.
77 *
78 * %-ENOMEM - Insufficient amount of memory available.
79 */
80static inline int nilfs_sufile_cancel_free(struct inode *sufile, __u64 segnum)
81{
82 return nilfs_sufile_update(sufile, segnum, 0,
83 nilfs_sufile_do_cancel_free);
84}
85
86/**
87 * nilfs_sufile_scrap - make a segment garbage 67 * nilfs_sufile_scrap - make a segment garbage
88 * @sufile: inode of segment usage file 68 * @sufile: inode of segment usage file
89 * @segnum: segment number to be freed 69 * @segnum: segment number to be freed
@@ -104,6 +84,38 @@ static inline int nilfs_sufile_free(struct inode *sufile, __u64 segnum)
104} 84}
105 85
106/** 86/**
87 * nilfs_sufile_freev - free segments
88 * @sufile: inode of segment usage file
89 * @segnumv: array of segment numbers
90 * @nsegs: size of @segnumv array
91 * @ndone: place to store the number of freed segments
92 */
93static inline int nilfs_sufile_freev(struct inode *sufile, __u64 *segnumv,
94 size_t nsegs, size_t *ndone)
95{
96 return nilfs_sufile_updatev(sufile, segnumv, nsegs, 0, ndone,
97 nilfs_sufile_do_free);
98}
99
100/**
101 * nilfs_sufile_cancel_freev - reallocate freeing segments
102 * @sufile: inode of segment usage file
103 * @segnumv: array of segment numbers
104 * @nsegs: size of @segnumv array
105 * @ndone: place to store the number of cancelled segments
106 *
107 * Return Value: On success, 0 is returned. On error, a negative error codes
108 * is returned.
109 */
110static inline int nilfs_sufile_cancel_freev(struct inode *sufile,
111 __u64 *segnumv, size_t nsegs,
112 size_t *ndone)
113{
114 return nilfs_sufile_updatev(sufile, segnumv, nsegs, 0, ndone,
115 nilfs_sufile_do_cancel_free);
116}
117
118/**
107 * nilfs_sufile_set_error - mark a segment as erroneous 119 * nilfs_sufile_set_error - mark a segment as erroneous
108 * @sufile: inode of segment usage file 120 * @sufile: inode of segment usage file
109 * @segnum: segment number 121 * @segnum: segment number