From: "Manish Katiyar" Subject: Re: Copying Data Blocks Date: Tue, 6 Jan 2009 22:43:00 +0530 Message-ID: References: <2d08ef090901060236p46d4d396x797e4bceb24a2a34@mail.gmail.com> <5feb302e0901060612p4e114953pb6e297778aa7c0a4@mail.gmail.com> <2d08ef090901060845t85ac2b0i11c684a09d930608@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "rishi agrawal" , ext4 , Kernelnewbies To: "Rohit Sharma" Return-path: Received: from ti-out-0910.google.com ([209.85.142.191]:8189 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbZAFRNE (ORCPT ); Tue, 6 Jan 2009 12:13:04 -0500 Received: by ti-out-0910.google.com with SMTP id b6so9863685tic.23 for ; Tue, 06 Jan 2009 09:13:00 -0800 (PST) In-Reply-To: <2d08ef090901060845t85ac2b0i11c684a09d930608@mail.gmail.com> Content-Disposition: inline Sender: linux-ext4-owner@vger.kernel.org List-ID: On Tue, Jan 6, 2009 at 10:15 PM, Rohit Sharma wrote: > On Tue, Jan 6, 2009 at 7:42 PM, rishi agrawal 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 wrote: >>> >>> On Tue, Jan 6, 2009 at 4:06 PM, Rohit Sharma 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. 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@vger.kernel.org >>> > 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@vger.kernel.org >>> More majordomo info at http://vger.kernel.org/majordomo-info.html >> >> >> >> -- >> Regards, >> Rishi B. Agrawal >> >> >