Re: [linux-lvm] *** ANNOUNCEMENT *** LVM 0.9.1 Beta 7 available at www.sistina.com

From: Martin K. Petersen (mkp@mkp.net)
Date: Tue Apr 10 2001 - 15:01:04 EST


>>>>> "Heinz" == Heinz J Mauelshagen <Mauelshagen@sistina.com> writes:

Heinz> a tarball of the Linux Logical Volume Manager 0.9.1 Beta 7 is
Heinz> available now at

The following code is baaaad, m'kay...

[...]

        down(&_pe_lock);
        if((pe_lock_req.lock == LOCK_PE) &&
           (rdev_map == pe_lock_req.data.pv_dev) &&
           (rsector_map >= pe_lock_req.data.pv_offset) &&
           (rsector_map < (pe_lock_req.data.pv_offset + vg_this->pe_size)) &&
           ((rw == WRITE) || (rw == WRITEA))) {
                /* defer this bh until the PE has moved */
                if(((int) bh) & 0x3) {
                        printk(KERN_ERR
                               "%s -- bh uses low 2 bits of pointer\n",
                               lvm_name);
                        up(&_pe_lock);
                        goto bad;
                }

                bh->b_reqnext = _pe_requests;
                _pe_requests = (struct buffer_head *) ((int) bh | rw);
                up(&_pe_lock);
                up(&lv->lv_snapshot_sem);
                return 0;
        }
        up(&_pe_lock);

[...]

                /* handle all deferred io for this PE */
                while(q) {
                        struct buffer_head *d_bh =
                               (struct buffer_head *) (q & ~0x3);
                        int rw = q & 0x3;
                        q = (uint) d_bh->b_reqnext;
 
                        /* resubmit this buffer head */
                        d_bh->b_reqnext = 0;
                        generic_make_request(rw, d_bh);
                }

Not only is this an evil hack from hell, I don't understand why you go
through such a huge effort of storing rw in the pointer. Afaict, the
only valid value is WRITE. And WRITEA is #defined to WRITE in lvm.c.

-- 
Martin K. Petersen, Principal Linux Consultant, Linuxcare, Inc.
mkp@linuxcare.com, http://www.linuxcare.com/
SGI XFS for Linux Developer, http://oss.sgi.com/projects/xfs/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 15 2001 - 21:00:14 EST