On Tue, Jan 6, 2009 at 11:09 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote: > On Tue, Jan 6, 2009 at 11:06 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote: >> On Tue, Jan 6, 2009 at 10:58 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote: >>> On Tue, Jan 6, 2009 at 10:55 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote: >>>> We can find out no. of block currently being used by the donor inode, >>>> The data we read from donor inode has to be in some buffer or page, >>> >>> Since we know the blocknumber of donor inode, it should be possible to >>> do a raw read and get the memory address of the data page using >>> sb_bread() and then accessing bh->b_data . Isn't it ? >> >> Yes that's the way we can read blocks but the major issue here >> is copying this content to newly allocated block. > > Apart from performance, is there anything else you are worried about ? Performance is only a bottleneck, this can be done in user land but kernel space solution will be more efficient. > > Thanks - > Manish > > > >>> >>> Thanks - >>> Manish >>> >>>> is there a way we can associate this buffer with the reciever inode >>>> or write the contents of the buffer to the new inode. >>>> >>>> >>>> On Tue, Jan 6, 2009 at 10:46 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote: >>>>> On Tue, Jan 6, 2009 at 10:43 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote: >>>>>> On Tue, Jan 6, 2009 at 10:15 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote: >>>>>>> On Tue, Jan 6, 2009 at 7:42 PM, rishi agrawal <postrishi@xxxxxxxxx> wrote: >>>>>>>> yes i suppose the donor inode is known >>>>>>>> moreover the receiver inode's number is also known >>>>>>>> >>>>>>>> On Tue, Jan 6, 2009 at 6:54 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote: >>>>>>>>> >>>>>>>>> On Tue, Jan 6, 2009 at 4:06 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote: >>>>>>>>> > I want to read data blocks from one inode >>>>>>>>> > and copy it to other inode. >>>>>>>>> > >>>>>>>>> > I mean to copy data from data blocks associated with one inode >>>>>>>>> > to the data blocks associated with other inode. >>>>>>>>> >>>>>>>>> Copying 4K chunk of data itself is a costly operation. and depending >>>>>>> >>>>>>> Yes its a costly operation, but if this can be done then >>>>>>> we can definitely copy n blocks at a time. >>>>>>> >>>>>>>>> on the size of your donor inode this can be huge . Why do you want to >>>>>>>>> do that ? Do you know the inode of the donor inode ? >>>>>>> >>>>>>> For physically relocating a file from one disk to other. >>>>>>> >>>>>>> Yes Manish, i know the donor inode and i will create the reciever inode. >>>>>> >>>>>> I am guessing .......will something like this work ? >>>>>> >>>>>> ino_t donor_inode_num; >>>>>> struct inode *donor_inode = FS_iget(sb , donor_inode_num); >>>>>> struct FS_inode_info * fsi = FSI(donor_inode) ; // Do the regular >>>>>> container_of stuff here >>>>>> >>>>>> for ( i = 0; i < (donor_inode->i_size + sb->s_blocksize - >>>>>> 1)/sb->s_blocksize ; i ++ ) { >>>>>> // Do a memmove or memcpy here from fsi->i_data[i] >>>>>> } >>>>>> >>>>>> I am not sure though how will you prevent the donor inode from being >>>>>> changed/resized during this period. >>>>> >>>>> I am thinking of remounting ext2 in readonly mode, or i'll change the >>>>> mount flags to readonly. But i m not sure if internally i can copy the >>>>> data from one block to other. >>>>> >>>>>> >>>>>> Thanks - >>>>>> Manish >>>>>> >>>>>> >>>>>>> >>>>>>> Can we do that in kernel space.? >>>>>>>>> >>>>>>>>> thanks - >>>>>>>>> Manish >>>>>>>>> > >>>>>>>>> > Is that possible in kernel space.? >>>>>>>>> > -- >>>>>>>>> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in >>>>>>>>> > the body of a message to majordomo@xxxxxxxxxxxxxxx >>>>>>>>> > More majordomo info at http://vger.kernel.org/majordomo-info.html >>>>>>>>> > >>>>>>>>> -- >>>>>>>>> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in >>>>>>>>> the body of a message to majordomo@xxxxxxxxxxxxxxx >>>>>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Regards, >>>>>>>> Rishi B. Agrawal >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ