Alexander Viro [Sat, 7 Sep 2002 10:05:14 +0000 (03:05 -0700)]
[PATCH] (25/25) more cleanups of struct gendisk.
* we remove the paritition 0 from ->part[] and put the old
contents of ->part[0] into gendisk itself; indexes are shifted, obviously.
* ->part is allocated at add_gendisk() time and freed at del_gendisk()
according to value of ->minor_shift; static arrays of hd_struct are gone
from drivers, ditto for manual allocations a-la ide. As the matter of fact,
none of the drivers know about struct hd_struct now.
Alexander Viro [Sat, 7 Sep 2002 10:05:09 +0000 (03:05 -0700)]
[PATCH] (24/25) disk capacity helpers
new helpers - get_capacity(gendisk)/set_capacity(gendisk, sectors).
Drivers switched to these; that eliminates most of the accesses to
disk->part[]... in the drivers (and makes code more readable, while
we are at it). That had caught several bugs when minor had been
used in place of minor>>minor_shift (acsi.c is especially nasty in
that respect; I don't know if it had ever been used with multiple
devices...)
Alexander Viro [Sat, 7 Sep 2002 10:05:04 +0000 (03:05 -0700)]
[PATCH] (23/25) move pointer to gendisk from hwif to drive
ide switched from hwif->gd[i] to hwif->drive[i]->disk - IOW, instead
of array of two pointers to gendisks refered from hwif, we keep these pointers
in relevant drives. Cleaned up.
Alexander Viro [Sat, 7 Sep 2002 10:04:42 +0000 (03:04 -0700)]
[PATCH] (18/25) pcd.c - cleanup, killed used of cdi->dev
pcd.c cleaned up, uses of cdi->dev eliminated, abuse of macros killed
(it used to have
#define PCD pcd[unit]
#define PI PCD.pi
and expected 'unit' to be local variable in each function that used these
(== almost every function in there)).
Alexander Viro [Sat, 7 Sep 2002 10:04:20 +0000 (03:04 -0700)]
[PATCH] (13/25) sbpcd.c - beginning of cleanup
sbpcd.c - sigh... It used to have a global variable inventively called
'd'. Current disk number. Tons of uses, 99% of them being D_S[d].<blah>.
Added a new variable - current_drive. Said animal is equal to D_S + d -
it's reassigned at the same place as d.
Alexander Viro [Sat, 7 Sep 2002 10:04:11 +0000 (03:04 -0700)]
[PATCH] (11/25) sr.c naming cleanup
Global search'n'replace job - 'SCp' (Scsi_CD pointer - I'm not kidding;
and yes, they spell it "Scsi") replaced with 'cd' (sr.c, sr_ioctl.c,
sr_vendor.c).
Alexander Viro [Sat, 7 Sep 2002 10:04:07 +0000 (03:04 -0700)]
[PATCH] (10/25) sr.c device name handling
sr.c: we set SCp->cdi.name from the very beginning, which allows
to kill passing minors in many cases (we can use "%s...", SCp->cd.name instead
of "sr%d...", minor and that turns out to be the majority of places where
we use minors at all).
Alexander Viro [Sat, 7 Sep 2002 10:04:02 +0000 (03:04 -0700)]
[PATCH] (9/25) update_partition()
new helper - update_partition(disk, partition_number); does the
right thing wrt devfs and driverfs (un)registration of partition entries.
BLKPG ioctls fixed - now they call that beast rather than calling only
devfs side. New helper - rescan_partitions(disk, bdev); does all work
with wiping/rereading/etc. and fs/block_dev.c now uses it instead of
check_partition(). The latter became static.
Each hd_struct used to have int number; in it. It's used _only_
in disk->part[0] - disk->part[n].number is never assigned/checked for any
positive n. Moved from hd_struct to gendisk (disk->part[0].number to
disk->number).
disk->driverfs_dev_arr is either NULL or consists of exactly one
element. Same change as above (struct device ** -> struct device *); old
"is the pointer to array itself NULL or not?" replaced with a flag (in
disk->flags).
Alexander Viro [Sat, 7 Sep 2002 10:03:44 +0000 (03:03 -0700)]
[PATCH] (5/25) Removing bogus arrays - ->flags[]
Seeing that now disk->flags[] always consists of one element, we
replace char *flags with int flags, remove the junk from places that used
to allocate these "arrays" and do obvious updates of the code
(s/->flags[0]/->flags/).
Alexander Viro [Sat, 7 Sep 2002 10:03:36 +0000 (03:03 -0700)]
[PATCH] (3/25) Removing useless minor arguments
driverfs_remove_partitions(), devfs_register_partitions(),
driverfs_create_partitions(), devfs_register_partition(), devfs_register_disc(),
had lost 'minor' argument - it's always disk->first_minor these days.
disk_name() takes partition number instead of minor now. Callers of
wipe_partitions() in fs/block_dev.c expanded. Remaining caller passes
gendisk instead of kdev_t now.
Alexander Viro [Sat, 7 Sep 2002 10:03:31 +0000 (03:03 -0700)]
[PATCH] (2/25) Removing ->nr_real
Since ->nr_real is always 1 now, we can remove that field completely.
Removed the last remnants of switch in disk_name() (it could be killed
a long time ago, I just forgot to remove the last two cases when md and i2o
got converted). Collapsed several instances of
disk->part[minor - disk->first_minor] - in cases when we know that we deal
with disk->part[0].
Alexander Viro [Sat, 7 Sep 2002 10:03:26 +0000 (03:03 -0700)]
[PATCH] (1/25) Unexporting helper functions
wipe_partitions() and driverfs_register_partitions(..., 1) (i.e.
unregistering them) pulled into del_gendisk() and removed from callers.
grok_partitions() merged with register_disk(). devfs_register_partitions(),
grok_partitions() and wipe_partitions() not exported anymore.
- Fix some bugs I introduced in zap_thread
- Improve the check for traced children in sys_wait4
- Fix parent links when using CLONE_PTRACE
My thanks to OGAWA Hirofumi for pointing out the first bit.
The only other issue I know of is something else Hirofumi pointed out
earlier; there are problems when a tracing process dies unexpectedly. I'll
come back to that later.
This is the pid-max patch, the one i sent for 2.5.31 was botched. I
have removed the 'once' debugging stupidity - now PIDs start at 0 again.
Also, for an unknown reason the previous patch missed the hunk that had
the declaration of 'DEFAULT_PID_MAX' which made it not compile ...
This contains Daniel's suggested fix that allows a parent to
PTRACE_ATTACH to a child it forked. That fixes the incorrect BUG_ON()
assert that Ogawa's patch was intended to fix, and we thus undo Ogawa's
patch.
I've tested various ptrace uses and they appear to work just fine.
Albert Cranford [Wed, 4 Sep 2002 13:18:16 +0000 (06:18 -0700)]
[PATCH] 2.5.33 i2c-proc.c remove inode_fill code
My previous patch added procs i2c_fill_inode and i2c_dir_fill_inode that
Al Viro deemed unnecessary. i2c developers are in contact with Al to
get the latest scoop. Meantime lets reverse the change before he flies
off at me about procfs abuse.
BTW, while merging aio from 2.5 to 2.4 and fixing and porting the libaio
(in particular thanks to one of Ben's testcases that was checkin for
this specific case) I found this bug in 2.5
Alexander Viro [Wed, 4 Sep 2002 10:15:18 +0000 (03:15 -0700)]
[PATCH] IDE cleanups (2.5; similar to ones done for other drivers)
OK, before the next bunch of gendisk merges, here comes a couple
of 2.5 IDE cleanups.
a) exclusion between rereading partition tables and open() is done
in fs/block_dev.c these days, so homegrown one in ide.c is redundant - that
code _never_ blocks now. Removed, just as it had been done with counterparts
in other drivers.
b) blk_ioctl() calls are done in blkdev_ioctl() now; driver doesn't
need to handle them. Again, removed as it had been done in all other drivers.
Paul Mackerras [Wed, 4 Sep 2002 03:00:23 +0000 (20:00 -0700)]
[PATCH] fix create_elf_tables on PPC
create_elf_tables in fs/binfmt_elf.c now sets up the list of aux table
entries in a buffer on the kernel stack before copying it to the user
stack.
Unfortunately, while the buffer is big enough for most architectures, it
isn't big enough on PPC, which uses 5 extra aux table entries (put on
with ARCH_DLINFO). The following patch increases the buffer to be big
enough for PPC. (Note that each aux table entry uses two elements of
the elf_info array.)
We need to sync the blockdevice mapping at umount although sync_blockdev
already does it as we need to make sure everything hits the disk before
we mark the superblock clean.
Rusty Russell [Tue, 3 Sep 2002 15:03:36 +0000 (08:03 -0700)]
[PATCH] list_t removal
This removes list_t, which is a gratuitous typedef for a "struct
list_head". Unless there is good reason, the kernel doesn't usually
typedef, as typedefs cannot be predeclared unlike structs.
This makes daemonize() call reparent_to_init() itself, as long
suggested for 2.5, and fixes the callers so they don't call it again.
Also fixes callers which set current->tty to NULL themselves (also
no longer neccessary).
RELOC_HIDE got miscompiled on gcc3.1/x86-64 in the access to softirq.c's per
cpu variables. This fixes the problem.
Clearly to hide the relocation the addition needs to be done after the
value obfuscation, not before.
I don't know if it triggers on other architectures (x86-64 is especially
stressf here because it has negative kernel addresses), but seems like the
right thing to do.
In sd.c we call MODE SENSE (6) in order to find out whether the
device is write protected. The info we need is in byte 2, the
header of the MODE SENSE answer, but in the request we have to
specify (i) what page(s) we want, and (ii) how many bytes we want.
Long ago we asked for 12 bytes from page 1 (Daniel Roche, 1.3.35).
Matthew Dharm made this 8 bytes from page 3F (all pages), patch-2.4.0-test8.
In patch-2.4.10 the 8 was increased to 255.
I found on the one hand devices that only react to page 0
(the vendor page), and return an error for page 3F.
And on the other hand devices that are unable to handle requests
for more bytes than they actually have.
So, it seems that the cautious way to ask for MODE SENSE data is
to first ask for the header only, see how much is available,
and then ask for everything.
The patch below first separates out the MODE SENSE call,
and then tries it three times: on all pages (3F), only the first
four bytes; on the vendor page (0), only the first four bytes;
on all pages (3F), 255 bytes.
This should be at least as robust as our current code.
I tried it on 8 SCSI devices (of which 2 fail under 2.5.33)
and found no problems.
Andrew Morton [Tue, 3 Sep 2002 12:34:07 +0000 (05:34 -0700)]
[PATCH] discontigmem support for ia32 NUMA
- All the support macros which assume a linear mem_map[] have been
wrapped in !CONFIG_DISCONTIGMEM. pfn_to_page, page_to_pfn,
page_to_phys, pmd_page, kern_addr_valid.
- Move some initialsation macros into setup.h so they can be used in
the i386 discontig.c (INITRD_START, INITRD_SIZE).
Andrew Morton [Tue, 3 Sep 2002 12:33:56 +0000 (05:33 -0700)]
[PATCH] reorganise setup_arch() for ia32 discontigmem
This restructures setup_arch() for i386 to make it easier to include the
i386 numa changes (for CONFIG_DISCONTIGMEM) I've been working on. It
also makes setup_arch() easier to read. A version of this patch is the
in 2.4 aa tree.
This does not depend on the other patches I'm submitting today, but my
discontigmem patch does depend on this one.
I've tested this patch on the following configurations: UP, SMP, SMP
PAE, multiquad, multiquad PAE.
Andrew Morton [Tue, 3 Sep 2002 12:33:51 +0000 (05:33 -0700)]
[PATCH] convert node/zone_start_paddr to pfns
I've had ia32-discontigmem under test for a month, uneventfully. Possibly
because I don't have a machine to test it on....
A major part of this work is a general move to convert the low-level
memory management to consistently use pageframe numbers. It's a bit
schizo at present..
This patch was written by Martin Bligh. A version of this patch is in
the 2.4 aa tree.
It changes the unsigned longs node_start_paddr and zone_start_paddr to
page frame numbers. This is necessary because a PAE address is 36 bits
and cannot be represented in an unsigned long.
- The per-node physical memory start address node_start_paddr becomes
a pfn, node_start_pfn.
- The per-zone physical memory start address zone_start_paddr becomes
a pfn, zone_start_pfn.
- free_area_init_node() takes a pfn rather than a physical address.
Patricia has tested this patch on the following configurations: UP,
SMP, SMP PAE, multiquad, multiquad PAE, multiquad DISCONTIGMEM,
multiquad DISCONTIGMEM PAE.
Robert Love [Tue, 3 Sep 2002 05:43:11 +0000 (22:43 -0700)]
[PATCH] bad: schedule() with irqs disabled!
OK, Linus, you are right... there are enough instances of this we are
not going to find them all (although I suspect Andrew's slab.c fixes
will cover most of the cases). Further, I think we can should actually
purposely call preempt_schedule() in certain cases after interrupt
reenable to check for reschedules...
Let's just make it a rule "no preemption if interrupts are off" and
enforce that.
James Morris [Tue, 3 Sep 2002 05:40:11 +0000 (22:40 -0700)]
[PATCH] sigio/sigurg cleanup for 2.5.32
This is a cleanup of the sigio/sigurg code.
Summary:
o Removed sk->proc, SIGURG now sent via vfs, credentials checked
during delivery.
o SIOCSPGRP etc. ioctls use vfs, and work now for SIGIO as well
as SIGURG.
o Removed socket fcntl code.
o Consolidate lsm file_set_fowner() hooks.
o Fixed fowner race.
o Fixed associated mainline memory leak in fcntl_dirnotify().
Fix floppy driver end_request() handling - it used to do insane
contortions instead of just calling "end_that_request_first()" with
the proper sector count.
Major partial request completion boo-boo in the bio layer.
This was _bad_. Major floppy corruption, and possibly the reason
for other block device corruption for any driver that generated
partial results for a block device request.