6b13f685e
김민수
BSP 최초 추가
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
|
#ifndef _FS_FUSE_I_H
#define _FS_FUSE_I_H
#include <linux/fuse.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/wait.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/backing-dev.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/rbtree.h>
#include <linux/poll.h>
#include <linux/workqueue.h>
#define FUSE_MAX_PAGES_PER_REQ 32
#define FUSE_NOWRITE INT_MIN
#define FUSE_NAME_MAX 1024
#define FUSE_CTL_NUM_DENTRIES 5
#define FUSE_DEFAULT_PERMISSIONS (1 << 0)
#define FUSE_ALLOW_OTHER (1 << 1)
#define FUSE_REQ_INLINE_PAGES 1
extern struct list_head fuse_conn_list;
extern struct mutex fuse_mutex;
extern unsigned max_user_bgreq;
extern unsigned max_user_congthresh;
struct fuse_forget_link {
struct fuse_forget_one forget_one;
struct fuse_forget_link *next;
};
struct fuse_inode {
struct inode inode;
u64 nodeid;
u64 nlookup;
struct fuse_forget_link *forget;
u64 i_time;
umode_t orig_i_mode;
u64 orig_ino;
u64 attr_version;
struct list_head write_files;
struct list_head queued_writes;
int writectr;
wait_queue_head_t page_waitq;
struct list_head writepages;
unsigned long state;
};
enum {
FUSE_I_ADVISE_RDPLUS,
FUSE_I_INIT_RDPLUS,
FUSE_I_SIZE_UNSTABLE,
};
struct fuse_conn;
struct fuse_file {
struct fuse_conn *fc;
struct fuse_req *reserved_req;
u64 kh;
u64 fh;
u64 nodeid;
atomic_t count;
u32 open_flags;
struct list_head write_entry;
struct rb_node polled_node;
wait_queue_head_t poll_wait;
bool flock:1;
};
struct fuse_in_arg {
unsigned size;
const void *value;
};
struct fuse_in {
struct fuse_in_header h;
unsigned argpages:1;
unsigned numargs;
struct fuse_in_arg args[3];
};
struct fuse_arg {
unsigned size;
void *value;
};
struct fuse_out {
struct fuse_out_header h;
unsigned argvar:1;
unsigned argpages:1;
unsigned page_zeroing:1;
unsigned page_replace:1;
unsigned numargs;
struct fuse_arg args[3];
};
struct fuse_page_desc {
unsigned int length;
unsigned int offset;
};
enum fuse_req_state {
FUSE_REQ_INIT = 0,
FUSE_REQ_PENDING,
FUSE_REQ_READING,
FUSE_REQ_SENT,
FUSE_REQ_WRITING,
FUSE_REQ_FINISHED
};
struct fuse_io_priv {
int async;
spinlock_t lock;
unsigned reqs;
ssize_t bytes;
size_t size;
__u64 offset;
bool write;
int err;
struct kiocb *iocb;
struct file *file;
};
struct fuse_req {
struct list_head list;
struct list_head intr_entry;
atomic_t count;
u64 intr_unique;
unsigned isreply:1;
unsigned force:1;
unsigned aborted:1;
unsigned background:1;
unsigned interrupted:1;
unsigned locked:1;
unsigned waiting:1;
enum fuse_req_state state;
struct fuse_in in;
struct fuse_out out;
wait_queue_head_t waitq;
union {
struct {
union {
struct fuse_release_in in;
struct work_struct work;
};
struct path path;
} release;
struct fuse_init_in init_in;
struct fuse_init_out init_out;
struct cuse_init_in cuse_init_in;
struct {
struct fuse_read_in in;
u64 attr_ver;
} read;
struct {
struct fuse_write_in in;
struct fuse_write_out out;
struct fuse_req *next;
} write;
struct fuse_notify_retrieve_in retrieve_in;
struct fuse_lk_in lk_in;
} misc;
struct page **pages;
struct fuse_page_desc *page_descs;
unsigned max_pages;
struct page *inline_pages[FUSE_REQ_INLINE_PAGES];
struct fuse_page_desc inline_page_descs[FUSE_REQ_INLINE_PAGES];
unsigned num_pages;
struct fuse_file *ff;
struct inode *inode;
struct fuse_io_priv *io;
struct list_head writepages_entry;
void (*end)(struct fuse_conn *, struct fuse_req *);
struct file *stolen_file;
};
struct fuse_conn {
spinlock_t lock;
atomic_t count;
struct rcu_head rcu;
kuid_t user_id;
kgid_t group_id;
unsigned flags;
unsigned max_read;
unsigned max_write;
wait_queue_head_t waitq;
struct list_head pending;
struct list_head processing;
struct list_head io;
u64 khctr;
struct rb_root polled_files;
unsigned max_background;
unsigned congestion_threshold;
unsigned num_background;
unsigned active_background;
struct list_head bg_queue;
struct list_head interrupts;
struct fuse_forget_link forget_list_head;
struct fuse_forget_link *forget_list_tail;
int forget_batch;
int initialized;
int blocked;
wait_queue_head_t blocked_waitq;
wait_queue_head_t reserved_req_waitq;
u64 reqctr;
unsigned connected;
unsigned conn_error:1;
unsigned conn_init:1;
unsigned async_read:1;
unsigned atomic_o_trunc:1;
unsigned export_support:1;
unsigned bdi_initialized:1;
unsigned no_open:1;
unsigned no_fsync:1;
unsigned no_fsyncdir:1;
unsigned no_flush:1;
unsigned no_setxattr:1;
unsigned no_getxattr:1;
unsigned no_listxattr:1;
unsigned no_removexattr:1;
unsigned no_lock:1;
unsigned no_access:1;
unsigned no_create:1;
unsigned no_interrupt:1;
unsigned no_bmap:1;
unsigned no_poll:1;
unsigned big_writes:1;
unsigned dont_mask:1;
unsigned no_flock:1;
unsigned no_fallocate:1;
unsigned auto_inval_data:1;
unsigned do_readdirplus:1;
unsigned readdirplus_auto:1;
unsigned async_dio:1;
atomic_t num_waiting;
unsigned minor;
struct backing_dev_info bdi;
struct list_head entry;
dev_t dev;
struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES];
int ctl_ndents;
struct fasync_struct *fasync;
u32 scramble_key[4];
struct fuse_req *destroy_req;
u64 attr_version;
void (*release)(struct fuse_conn *);
struct super_block *sb;
struct rw_semaphore killsb;
};
static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
{
return sb->s_fs_info;
}
static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
{
return get_fuse_conn_super(inode->i_sb);
}
static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
{
return container_of(inode, struct fuse_inode, inode);
}
static inline u64 get_node_id(struct inode *inode)
{
return get_fuse_inode(inode)->nodeid;
}
extern const struct file_operations fuse_dev_operations;
extern const struct dentry_operations fuse_dentry_operations;
int fuse_inode_eq(struct inode *inode, void *_nodeidp);
struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
int generation, struct fuse_attr *attr,
u64 attr_valid, u64 attr_version);
int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name,
struct fuse_entry_out *outarg, struct inode **inode);
void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
u64 nodeid, u64 nlookup);
struct fuse_forget_link *fuse_alloc_forget(void);
void fuse_force_forget(struct file *file, u64 nodeid);
void fuse_read_fill(struct fuse_req *req, struct file *file,
loff_t pos, size_t count, int opcode);
int fuse_open_common(struct inode *inode, struct file *file, bool isdir);
struct fuse_file *fuse_file_alloc(struct fuse_conn *fc);
struct fuse_file *fuse_file_get(struct fuse_file *ff);
void fuse_file_free(struct fuse_file *ff);
void fuse_finish_open(struct inode *inode, struct file *file);
void fuse_sync_release(struct fuse_file *ff, int flags);
void fuse_release_common(struct file *file, int opcode);
int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
int datasync, int isdir);
int fuse_notify_poll_wakeup(struct fuse_conn *fc,
struct fuse_notify_poll_wakeup_out *outarg);
void fuse_init_file_inode(struct inode *inode);
void fuse_init_common(struct inode *inode);
void fuse_init_dir(struct inode *inode);
void fuse_init_symlink(struct inode *inode);
void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
u64 attr_valid, u64 attr_version);
void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
u64 attr_valid);
int fuse_dev_init(void);
void fuse_dev_cleanup(void);
int fuse_ctl_init(void);
void fuse_ctl_cleanup(void);
struct fuse_req *fuse_request_alloc(unsigned npages);
struct fuse_req *fuse_request_alloc_nofs(unsigned npages);
void fuse_request_free(struct fuse_req *req);
struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages);
struct fuse_req *fuse_get_req_for_background(struct fuse_conn *fc,
unsigned npages);
void __fuse_get_request(struct fuse_req *req);
static inline struct fuse_req *fuse_get_req_nopages(struct fuse_conn *fc)
{
return fuse_get_req(fc, 0);
}
struct fuse_req *fuse_get_req_nofail_nopages(struct fuse_conn *fc,
struct file *file);
void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req);
void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req);
void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req);
void fuse_request_send_background_locked(struct fuse_conn *fc,
struct fuse_req *req);
void fuse_abort_conn(struct fuse_conn *fc);
void fuse_invalidate_attr(struct inode *inode);
void fuse_invalidate_entry_cache(struct dentry *entry);
void fuse_invalidate_atime(struct inode *inode);
struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
void fuse_conn_kill(struct fuse_conn *fc);
void fuse_conn_init(struct fuse_conn *fc);
void fuse_conn_put(struct fuse_conn *fc);
int fuse_ctl_add_conn(struct fuse_conn *fc);
void fuse_ctl_remove_conn(struct fuse_conn *fc);
int fuse_valid_type(int m);
int fuse_allow_current_process(struct fuse_conn *fc);
u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
int fuse_update_attributes(struct inode *inode, struct kstat *stat,
struct file *file, bool *refreshed);
void fuse_flush_writepages(struct inode *inode);
void fuse_set_nowrite(struct inode *inode);
void fuse_release_nowrite(struct inode *inode);
u64 fuse_get_attr_version(struct fuse_conn *fc);
int fuse_reverse_inval_inode(struct super_block *sb, u64 nodeid,
loff_t offset, loff_t len);
int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
u64 child_nodeid, struct qstr *name);
int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
bool isdir);
ssize_t fuse_direct_io(struct fuse_io_priv *io, const struct iovec *iov,
unsigned long nr_segs, size_t count, loff_t *ppos,
int write);
long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
unsigned int flags);
long fuse_ioctl_common(struct file *file, unsigned int cmd,
unsigned long arg, unsigned int flags);
unsigned fuse_file_poll(struct file *file, poll_table *wait);
int fuse_dev_release(struct inode *inode, struct file *file);
void fuse_write_update_size(struct inode *inode, loff_t pos);
int fuse_do_setattr(struct inode *inode, struct iattr *attr,
struct file *file);
#endif /* _FS_FUSE_I_H */
|