]> git.hungrycats.org Git - linux/commitdiff
[PATCH] remove PF_READAHEAD
authorAndrew Morton <akpm@osdl.org>
Wed, 6 Aug 2003 15:57:31 +0000 (08:57 -0700)
committerDave Jones <davej@redhat.com>
Wed, 6 Aug 2003 15:57:31 +0000 (08:57 -0700)
The problem with PF_READAHEAD is that if someone does a non-GFP_ATOMIC memory
allocation we can enter page reclaim and then call writepage, while
PF_READAHEAD is set.  The block layer then drops writes or the wrong reads on
the floor.  It can cause data loss.

A fix is complex (well, intrusive).  Given that the readahead code is now
skipping the entire readahead attempt if the queue is congested, the setting
of PF_READAHEAD probably is not doing anything useful anyway, so simply
remove it.

drivers/block/ll_rw_blk.c
fs/buffer.c
include/linux/sched.h
mm/readahead.c

index 16773ffa778a7fddb48e695fed2dd5436e189250..619be12e3f259e61ff7f182135647f64b973a38e 100644 (file)
@@ -1833,7 +1833,7 @@ static int __make_request(request_queue_t *q, struct bio *bio)
 
        barrier = test_bit(BIO_RW_BARRIER, &bio->bi_rw);
 
-       ra = bio_flagged(bio, BIO_RW_AHEAD) || current->flags & PF_READAHEAD;
+       ra = bio_flagged(bio, BIO_RW_AHEAD);
 
 again:
        insert_here = NULL;
index c0b1d2a2a248be49f907658a8d3fc2727d77639c..3cf7a205f54e3b5e9029262910ba2ead430ab07d 100644 (file)
@@ -506,8 +506,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
                set_buffer_uptodate(bh);
        } else {
                clear_buffer_uptodate(bh);
-               if (!(current->flags & PF_READAHEAD))
-                       buffer_io_error(bh);
+               buffer_io_error(bh);
                SetPageError(page);
        }
 
index a7e52205b47ad39e30d5ff587ece990c80d984ff..70eb61ecf4a3ee58f6d4d6957fd7184bb9f9c3a6 100644 (file)
@@ -487,7 +487,6 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
 #define PF_SWAPOFF     0x00080000      /* I am in swapoff */
 #define PF_LESS_THROTTLE 0x00100000    /* Throttle me less: I clean memory */
 #define PF_SYNCWRITE   0x00200000      /* I am doing a sync write */
-#define PF_READAHEAD   0x00400000      /* I am doing read-ahead */
 
 #ifdef CONFIG_SMP
 extern int set_cpus_allowed(task_t *p, unsigned long new_mask);
index a8b9cb1007f88435209ee016b7b6d7f894488c8b..69f24b9ce4d2fab64dbf290e2841c1b5e01cb2dc 100644 (file)
@@ -298,15 +298,10 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
 int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
                        unsigned long offset, unsigned long nr_to_read)
 {
-       int ret = 0;
-
-       if (!bdi_read_congested(mapping->backing_dev_info)) {
-               current->flags |= PF_READAHEAD;
-               ret = __do_page_cache_readahead(mapping, filp,
+       if (!bdi_read_congested(mapping->backing_dev_info))
+               return __do_page_cache_readahead(mapping, filp,
                                                offset, nr_to_read);
-               current->flags &= ~PF_READAHEAD;
-       }
-       return ret;
+       return 0;
 }
 
 /*