aboutsummaryrefslogtreecommitdiffstats
path: root/block/Kconfig
blob: 2c39527aa7db026dc6c6b6c20fbe55024de46100 (plain) (blame)
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
#
# Block layer core configuration
#
menuconfig BLOCK
       bool "Enable the block layer" if EMBEDDED
       default y
       help
	 Provide block layer support for the kernel.

	 Disable this option to remove the block layer support from the
	 kernel. This may be useful for embedded devices.

	 If this option is disabled:

	   - block device files will become unusable
	   - some filesystems (such as ext3) will become unavailable.

	 Also, SCSI character devices and USB storage will be disabled since
	 they make use of various block layer definitions and facilities.

	 Say Y here unless you know you really don't want to mount disks and
	 suchlike.

if BLOCK

config LBD
	bool "Support for large block devices and files"
	depends on !64BIT
	default y
	help
	  Enable block devices or files of size 2TB and larger.

	  This option is required to support the full capacity of large
	  (2TB+) block devices, including RAID, disk, Network Block Device,
	  Logical Volume Manager (LVM) and loopback.
	
	  This option also enables support for single files larger than
	  2TB.

	  The ext4 filesystem requires that this feature be enabled in
	  order to support filesystems that have the huge_file feature
	  enabled.  Otherwise, it will refuse to mount in the read-write
	  mode any filesystems that use the huge_file feature, which is
	  enabled by default by mke2fs.ext4.

	  The GFS2 filesystem also requires this feature.

	  If unsure, say Y.

config BLK_DEV_BSG
	bool "Block layer SG support v4 (EXPERIMENTAL)"
	depends on EXPERIMENTAL
	---help---
	  Saying Y here will enable generic SG (SCSI generic) v4 support
	  for any block device.

	  Unlike SG v3 (aka block/scsi_ioctl.c drivers/scsi/sg.c), SG v4
	  can handle complicated SCSI commands: tagged variable length cdbs
	  with bidirectional data transfers and generic request/response
	  protocols (e.g. Task Management Functions and SMP in Serial
	  Attached SCSI).

	  If unsure, say N.

config BLK_DEV_INTEGRITY
	bool "Block layer data integrity support"
	---help---
	Some storage devices allow extra information to be
	stored/retrieved to help protect the data.  The block layer
	data integrity option provides hooks which can be used by
	filesystems to ensure better data integrity.

	Say yes here if you have a storage device that provides the
	T10/SCSI Data Integrity Field or the T13/ATA External Path
	Protection.  If in doubt, say N.

endif # BLOCK

config BLOCK_COMPAT
	bool
	depends on BLOCK && COMPAT
	default y

source block/Kconfig.iosched
dir.c?h=wip-aux-tasks&id=4b6f5d20b04dcbc3d888555522b90ba6d36c4106'>4b6f5d20b04d
1da177e4c3f4



1da177e4c3f4








ed36f723676b
1da177e4c3f4
1da177e4c3f4



ed36f723676b


1da177e4c3f4



ed36f723676b






1da177e4c3f4
ed36f723676b








1da177e4c3f4
1da177e4c3f4

1da177e4c3f4
ed36f723676b




1da177e4c3f4


e6305c43eda1
1da177e4c3f4

e6305c43eda1

1da177e4c3f4



f696a3659fc4


1da177e4c3f4

1da177e4c3f4









d728900cd550
1da177e4c3f4


d728900cd550
1da177e4c3f4






d728900cd550

1da177e4c3f4

d728900cd550
















1da177e4c3f4












1da177e4c3f4






















d728900cd550
1da177e4c3f4

d728900cd550
1da177e4c3f4











1da177e4c3f4





















d728900cd550
1da177e4c3f4
d728900cd550

1da177e4c3f4

d728900cd550
1da177e4c3f4











1da177e4c3f4








d728900cd550
1da177e4c3f4



d728900cd550
1da177e4c3f4

d8c76e6f45c1
d728900cd550
1da177e4c3f4











3cf01f28c303

1da177e4c3f4
1da177e4c3f4













d728900cd550
1da177e4c3f4

d728900cd550
1da177e4c3f4



d728900cd550
1da177e4c3f4

d728900cd550
1da177e4c3f4


9fe76c763f0e
1da177e4c3f4





1da177e4c3f4
d728900cd550

1da177e4c3f4
d728900cd550

1da177e4c3f4
d728900cd550
9a53c3a783c2
1da177e4c3f4
d728900cd550
1da177e4c3f4

9fe76c763f0e
1da177e4c3f4


8c6d21528406
1da177e4c3f4

1da177e4c3f4
1da177e4c3f4
8c6d21528406



1da177e4c3f4
8c6d21528406


d728900cd550
1da177e4c3f4
8c6d21528406
1da177e4c3f4


d728900cd550
1da177e4c3f4

d728900cd550

1da177e4c3f4

d728900cd550
1da177e4c3f4

1da177e4c3f4
d728900cd550

1da177e4c3f4

d728900cd550
1da177e4c3f4
d728900cd550





1da177e4c3f4



d728900cd550
1da177e4c3f4







9fe76c763f0e
1da177e4c3f4
1da177e4c3f4

1da177e4c3f4





978752534e94












1da177e4c3f4


978752534e94
1da177e4c3f4

978752534e94


1da177e4c3f4
978752534e94

1da177e4c3f4























978752534e94

1da177e4c3f4

978752534e94



1da177e4c3f4





978752534e94







1da177e4c3f4
f52720ca5f48
1da177e4c3f4

5f47c7eac65a
978752534e94
5f47c7eac65a

1da177e4c3f4
978752534e94
5f47c7eac65a

978752534e94
5f47c7eac65a

1da177e4c3f4
978752534e94
5f47c7eac65a
1da177e4c3f4

978752534e94
1da177e4c3f4

978752534e94

1da177e4c3f4





978752534e94

1da177e4c3f4




978752534e94

1da177e4c3f4

















978752534e94
1da177e4c3f4


978752534e94

1da177e4c3f4





978752534e94

5f47c7eac65a
1da177e4c3f4





















































































































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


























                                                                 
 

                     













                                                                                                  
                                                                         





                                                                           

                                                                







                                                   
                                                              




                                                 
                                                         














                                          
                                                    



                                              








                                                                                                
                                   
                                           



                                              


                                                                    



                                                         






                                                               
                      








                                                                    
                                      

     
                                              




                                                          


 
                                                  

                      

                                                



                          


                                                    

                      









                                                                 
                     


 
                                                           






                                                                        

                                                                             

                                                       
















                                                                              












                                                                                            






















                                                                     
                                   

                                 
                 











                                                                     





















                                                            
 
                                                         

                                   

                                 
                 











                                                                        








                                                                         
                    



                           
                                         

                                    
                         
 











                                                                   

                      
                      













                                                                  
                                                     

                   
                                                                              



                                               
                                                 

                        
                     


                                         
                                                            





                                           
 

                                                                  
                                

                             
 
                                   
                                
                        
                 

 
                                                           


                                           
                  

                      
 
                                                                 



                                              
 


                                                      
         
                        
                     


            
                                                                        

                                                                        

                                                       

                                                
                  

                      
 

                                                                       

                                                                              
                       
                                            





                                                                     



                                                                      
                 







                                     
                                                                             
 

                                   





                                                     












                                                                             


                                              
                                                                                

                                                 


                                                    
         

                                                                  























                                                    

                                                                

                                                   



                                    





                                                                 







                                                     
 
                                                  

                                  
                                    
                                                                          

                                 
                         
                                   

                                    
                                                                                     

                                 
                         
                                   
         

                                                          
                                                                                

                                                 

                                                                                





                                                                          

                                                                           




                                                                              

                                                                         

















                                                                            
                                                           


                                                       

                                                                   





                                                                              

                                                   
    





















































































































                                                                               

/*
 * Directory operations for Coda filesystem
 * Original version: (C) 1996 P. Braam and M. Callahan
 * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
 * 
 * Carnegie Mellon encourages users to contribute improvements to
 * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
 */

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/smp_lock.h>

#include <asm/uaccess.h>

#include <linux/coda.h>
#include <linux/coda_linux.h>
#include <linux/coda_psdev.h>
#include <linux/coda_fs_i.h>
#include <linux/coda_cache.h>

#include "coda_int.h"

/* dir inode-ops */
static int coda_create(struct inode *dir, struct dentry *new, int mode, struct nameidata *nd);
static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd);
static int coda_link(struct dentry *old_dentry, struct inode *dir_inode, 
		     struct dentry *entry);
static int coda_unlink(struct inode *dir_inode, struct dentry *entry);
static int coda_symlink(struct inode *dir_inode, struct dentry *entry,
			const char *symname);
static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, int mode);
static int coda_rmdir(struct inode *dir_inode, struct dentry *entry);
static int coda_rename(struct inode *old_inode, struct dentry *old_dentry, 
                       struct inode *new_inode, struct dentry *new_dentry);

/* dir file-ops */
static int coda_readdir(struct file *file, void *buf, filldir_t filldir);

/* dentry ops */
static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd);
static int coda_dentry_delete(struct dentry *);

/* support routines */
static int coda_venus_readdir(struct file *coda_file, void *buf,
			      filldir_t filldir);

/* same as fs/bad_inode.c */
static int coda_return_EIO(void)
{
	return -EIO;
}
#define CODA_EIO_ERROR ((void *) (coda_return_EIO))

static const struct dentry_operations coda_dentry_operations =
{
	.d_revalidate	= coda_dentry_revalidate,
	.d_delete	= coda_dentry_delete,
};

const struct inode_operations coda_dir_inode_operations =
{
	.create		= coda_create,
	.lookup		= coda_lookup,
	.link		= coda_link,
	.unlink		= coda_unlink,
	.symlink	= coda_symlink,
	.mkdir		= coda_mkdir,
	.rmdir		= coda_rmdir,
	.mknod		= CODA_EIO_ERROR,
	.rename		= coda_rename,
	.permission	= coda_permission,
	.getattr	= coda_getattr,
	.setattr	= coda_setattr,
};

const struct file_operations coda_dir_operations = {
	.llseek		= generic_file_llseek,
	.read		= generic_read_dir,
	.readdir	= coda_readdir,
	.open		= coda_open,
	.release	= coda_release,
	.fsync		= coda_fsync,
};


/* inode operations for directories */
/* access routines: lookup, readlink, permission */
static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd)
{
	struct inode *inode = NULL;
	struct CodaFid resfid = { { 0, } };
	int type = 0;
	int error = 0;
	const char *name = entry->d_name.name;
	size_t length = entry->d_name.len;

	if (length > CODA_MAXNAMLEN) {
		printk(KERN_ERR "name too long: lookup, %s (%*s)\n",
		       coda_i2s(dir), (int)length, name);
		return ERR_PTR(-ENAMETOOLONG);
	}

	/* control object, create inode on the fly */
	if (coda_isroot(dir) && coda_iscontrol(name, length)) {
		error = coda_cnode_makectl(&inode, dir->i_sb);
		type = CODA_NOCACHE;
		goto exit;
	}

	lock_kernel();

	error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length,
			     &type, &resfid);
	if (!error)
		error = coda_cnode_make(&inode, &resfid, dir->i_sb);

	unlock_kernel();

	if (error && error != -ENOENT)
		return ERR_PTR(error);

exit:
	entry->d_op = &coda_dentry_operations;

	if (inode && (type & CODA_NOCACHE))
		coda_flag_inode(inode, C_VATTR | C_PURGE);

	return d_splice_alias(inode, entry);
}


int coda_permission(struct inode *inode, int mask)
{
        int error = 0;

	mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
 
	if (!mask)
		return 0; 

	if ((mask & MAY_EXEC) && !execute_ok(inode))
		return -EACCES;

	lock_kernel();

	if (coda_cache_check(inode, mask))
		goto out; 

        error = venus_access(inode->i_sb, coda_i2f(inode), mask);
    
	if (!error)
		coda_cache_enter(inode, mask);

 out:
	unlock_kernel();
	return error;
}


static inline void coda_dir_update_mtime(struct inode *dir)
{
#ifdef REQUERY_VENUS_FOR_MTIME
	/* invalidate the directory cnode's attributes so we refetch the
	 * attributes from venus next time the inode is referenced */
	coda_flag_inode(dir, C_VATTR);
#else
	/* optimistically we can also act as if our nose bleeds. The
	 * granularity of the mtime is coarse anyways so we might actually be
	 * right most of the time. Note: we only do this for directories. */
	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
#endif
}

/* we have to wrap inc_nlink/drop_nlink because sometimes userspace uses a
 * trick to fool GNU find's optimizations. If we can't be sure of the link
 * (because of volume mount points) we set i_nlink to 1 which forces find
 * to consider every child as a possible directory. We should also never
 * see an increment or decrement for deleted directories where i_nlink == 0 */
static inline void coda_dir_inc_nlink(struct inode *dir)
{
	if (dir->i_nlink >= 2)
		inc_nlink(dir);
}

static inline void coda_dir_drop_nlink(struct inode *dir)
{
	if (dir->i_nlink > 2)
		drop_nlink(dir);
}

/* creation routines: create, mknod, mkdir, link, symlink */
static int coda_create(struct inode *dir, struct dentry *de, int mode, struct nameidata *nd)
{
        int error=0;
	const char *name=de->d_name.name;
	int length=de->d_name.len;
	struct inode *inode;
	struct CodaFid newfid;
	struct coda_vattr attrs;

	lock_kernel();

	if (coda_isroot(dir) && coda_iscontrol(name, length)) {
		unlock_kernel();
		return -EPERM;
	}

	error = venus_create(dir->i_sb, coda_i2f(dir), name, length, 
				0, mode, &newfid, &attrs);

        if ( error ) {
		unlock_kernel();
		d_drop(de);
		return error;
	}

	inode = coda_iget(dir->i_sb, &newfid, &attrs);
	if ( IS_ERR(inode) ) {
		unlock_kernel();
		d_drop(de);
		return PTR_ERR(inode);
	}

	/* invalidate the directory cnode's attributes */
	coda_dir_update_mtime(dir);
	unlock_kernel();
	d_instantiate(de, inode);
	return 0;
}

static int coda_mkdir(struct inode *dir, struct dentry *de, int mode)
{
	struct inode *inode;
	struct coda_vattr attrs;
	const char *name = de->d_name.name;
	int len = de->d_name.len;
	int error;
	struct CodaFid newfid;

	lock_kernel();

	if (coda_isroot(dir) && coda_iscontrol(name, len)) {
		unlock_kernel();
		return -EPERM;
	}

	attrs.va_mode = mode;
	error = venus_mkdir(dir->i_sb, coda_i2f(dir), 
			       name, len, &newfid, &attrs);
        
        if ( error ) {
		unlock_kernel();
		d_drop(de);
		return error;
        }
         
	inode = coda_iget(dir->i_sb, &newfid, &attrs);
	if ( IS_ERR(inode) ) {
		unlock_kernel();
		d_drop(de);
		return PTR_ERR(inode);
	}

	/* invalidate the directory cnode's attributes */
	coda_dir_inc_nlink(dir);
	coda_dir_update_mtime(dir);
	unlock_kernel();
	d_instantiate(de, inode);
	return 0;
}

/* try to make de an entry in dir_inodde linked to source_de */ 
static int coda_link(struct dentry *source_de, struct inode *dir_inode, 
	  struct dentry *de)
{
	struct inode *inode = source_de->d_inode;
        const char * name = de->d_name.name;
	int len = de->d_name.len;
	int error;

	lock_kernel();

	if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) {
		unlock_kernel();
		return -EPERM;
	}

	error = venus_link(dir_inode->i_sb, coda_i2f(inode),
			   coda_i2f(dir_inode), (const char *)name, len);

	if (error) {
		d_drop(de);
		goto out;
	}

	coda_dir_update_mtime(dir_inode);
	atomic_inc(&inode->i_count);
	d_instantiate(de, inode);
	inc_nlink(inode);

out:
	unlock_kernel();
	return(error);
}


static int coda_symlink(struct inode *dir_inode, struct dentry *de,
			const char *symname)
{
        const char *name = de->d_name.name;
	int len = de->d_name.len;
	int symlen;
	int error = 0;

	lock_kernel();

	if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) {
		unlock_kernel();
		return -EPERM;
	}